STM32F4xx HAL Documentation
Hardware Abstraction Layer for STM32F4 familiy
Loading...
Searching...
No Matches
stm32f4xx_hal_fmpi2c_ex.c
Go to the documentation of this file.
1
45/* Includes ------------------------------------------------------------------*/
46#include "stm32f4xx_hal.h"
47
57#ifdef HAL_FMPI2C_MODULE_ENABLED
58#if defined(FMPI2C_CR1_PE)
59
60/* Private typedef -----------------------------------------------------------*/
61/* Private define ------------------------------------------------------------*/
62/* Private macro -------------------------------------------------------------*/
63/* Private variables ---------------------------------------------------------*/
64/* Private function prototypes -----------------------------------------------*/
65/* Private functions ---------------------------------------------------------*/
66
93{
94 /* Check the parameters */
95 assert_param(IS_FMPI2C_ALL_INSTANCE(hfmpi2c->Instance));
97
98 if (hfmpi2c->State == HAL_FMPI2C_STATE_READY)
99 {
100 /* Process Locked */
101 __HAL_LOCK(hfmpi2c);
102
103 hfmpi2c->State = HAL_FMPI2C_STATE_BUSY;
104
105 /* Disable the selected FMPI2C peripheral */
106 __HAL_FMPI2C_DISABLE(hfmpi2c);
107
108 /* Reset FMPI2Cx ANOFF bit */
109 hfmpi2c->Instance->CR1 &= ~(FMPI2C_CR1_ANFOFF);
110
111 /* Set analog filter bit*/
112 hfmpi2c->Instance->CR1 |= AnalogFilter;
113
114 __HAL_FMPI2C_ENABLE(hfmpi2c);
115
116 hfmpi2c->State = HAL_FMPI2C_STATE_READY;
117
118 /* Process Unlocked */
119 __HAL_UNLOCK(hfmpi2c);
120
121 return HAL_OK;
122 }
123 else
124 {
125 return HAL_BUSY;
126 }
127}
128
137{
138 uint32_t tmpreg;
139
140 /* Check the parameters */
141 assert_param(IS_FMPI2C_ALL_INSTANCE(hfmpi2c->Instance));
143
144 if (hfmpi2c->State == HAL_FMPI2C_STATE_READY)
145 {
146 /* Process Locked */
147 __HAL_LOCK(hfmpi2c);
148
149 hfmpi2c->State = HAL_FMPI2C_STATE_BUSY;
150
151 /* Disable the selected FMPI2C peripheral */
152 __HAL_FMPI2C_DISABLE(hfmpi2c);
153
154 /* Get the old register value */
155 tmpreg = hfmpi2c->Instance->CR1;
156
157 /* Reset FMPI2Cx DNF bits [11:8] */
158 tmpreg &= ~(FMPI2C_CR1_DNF);
159
160 /* Set FMPI2Cx DNF coefficient */
161 tmpreg |= DigitalFilter << 8U;
162
163 /* Store the new register value */
164 hfmpi2c->Instance->CR1 = tmpreg;
165
166 __HAL_FMPI2C_ENABLE(hfmpi2c);
167
168 hfmpi2c->State = HAL_FMPI2C_STATE_READY;
169
170 /* Process Unlocked */
171 __HAL_UNLOCK(hfmpi2c);
172
173 return HAL_OK;
174 }
175 else
176 {
177 return HAL_BUSY;
178 }
179}
209void HAL_FMPI2CEx_EnableFastModePlus(uint32_t ConfigFastModePlus)
210{
211 /* Check the parameter */
212 assert_param(IS_FMPI2C_FASTMODEPLUS(ConfigFastModePlus));
213
214 /* Enable SYSCFG clock */
216
217 /* Enable fast mode plus driving capability for selected pin */
218 SET_BIT(SYSCFG->CFGR, (uint32_t)ConfigFastModePlus);
219}
220
232void HAL_FMPI2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus)
233{
234 /* Check the parameter */
235 assert_param(IS_FMPI2C_FASTMODEPLUS(ConfigFastModePlus));
236
237 /* Enable SYSCFG clock */
239
240 /* Disable fast mode plus driving capability for selected pin */
241 CLEAR_BIT(SYSCFG->CFGR, (uint32_t)ConfigFastModePlus);
242}
250#endif /* FMPI2C_CR1_PE */
251#endif /* HAL_FMPI2C_MODULE_ENABLED */
HAL_StatusTypeDef HAL_FMPI2CEx_ConfigDigitalFilter(FMPI2C_HandleTypeDef *hfmpi2c, uint32_t DigitalFilter)
Configure FMPI2C Digital noise filter.
HAL_StatusTypeDef HAL_FMPI2CEx_ConfigAnalogFilter(FMPI2C_HandleTypeDef *hfmpi2c, uint32_t AnalogFilter)
Configure FMPI2C Analog noise filter.
void HAL_FMPI2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus)
Disable the FMPI2C fast mode plus driving capability.
void HAL_FMPI2CEx_EnableFastModePlus(uint32_t ConfigFastModePlus)
Enable the FMPI2C fast mode plus driving capability.
#define IS_FMPI2C_FASTMODEPLUS(__CONFIG__)
#define IS_FMPI2C_ANALOG_FILTER(FILTER)
#define IS_FMPI2C_DIGITAL_FILTER(FILTER)
#define __HAL_FMPI2C_DISABLE(__HANDLE__)
Disable the specified FMPI2C peripheral.
#define __HAL_FMPI2C_ENABLE(__HANDLE__)
Enable the specified FMPI2C peripheral.
@ HAL_FMPI2C_STATE_READY
@ HAL_FMPI2C_STATE_BUSY
#define __HAL_RCC_SYSCFG_CLK_ENABLE()
#define assert_param(expr)
This file contains all the functions prototypes for the HAL module driver.
HAL_StatusTypeDef
HAL Status structures definition
@ HAL_OK
@ HAL_BUSY
#define __HAL_UNLOCK(__HANDLE__)
#define __HAL_LOCK(__HANDLE__)
__IO HAL_FMPI2C_StateTypeDef State