Channel operation functions.
More...
Channel operation functions.
==============================================================================
##### Channel operation functions #####
==============================================================================
[..] This section provides functions allowing to:
(+) Manage clock absence detector feature.
(+) Manage short circuit detector feature.
(+) Get analog watchdog value.
(+) Modify offset value.
◆ HAL_DFSDM_ChannelCkabCallback()
Clock absence detection callback.
- Parameters
-
| hdfsdm_channel | DFSDM channel handle. |
- Return values
-
Definition at line 905 of file stm32l4xx_hal_dfsdm.c.
908 UNUSED(hdfsdm_channel);
◆ HAL_DFSDM_ChannelCkabStart()
This function allows to start clock absence detection in polling mode.
- Note
- Same mode has to be used for all channels.
-
If clock is not available on this channel during 5 seconds, clock absence detection will not be activated and function will return HAL_TIMEOUT error.
- Parameters
-
| hdfsdm_channel | DFSDM channel handle. |
- Return values
-
Definition at line 711 of file stm32l4xx_hal_dfsdm.c.
713 HAL_StatusTypeDef status =
HAL_OK;
718 assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
735 while ((((DFSDM1_Filter0->FLTISR & DFSDM_FLTISR_CKABF) >> (DFSDM_FLTISR_CKABF_Pos + channel)) & 1U) != 0U)
737 DFSDM1_Filter0->FLTICR = (1UL << (DFSDM_FLTICR_CLRCKABF_Pos + channel));
740 if ((
HAL_GetTick() - tickstart) > DFSDM_CKAB_TIMEOUT)
743 status = HAL_TIMEOUT;
751 hdfsdm_channel->Instance->CHCFGR1 |= DFSDM_CHCFGR1_CKABEN;
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
static uint32_t DFSDM_GetChannelFromInstance(const DFSDM_Channel_TypeDef *Instance)
This function allows to get the channel number from channel instance.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_DFSDM_ChannelCkabStart_IT()
This function allows to start clock absence detection in interrupt mode.
- Note
- Same mode has to be used for all channels.
-
If clock is not available on this channel during 5 seconds, clock absence detection will not be activated and function will return HAL_TIMEOUT error.
- Parameters
-
| hdfsdm_channel | DFSDM channel handle. |
- Return values
-
Definition at line 850 of file stm32l4xx_hal_dfsdm.c.
852 HAL_StatusTypeDef status =
HAL_OK;
857 assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
874 while ((((DFSDM1_Filter0->FLTISR & DFSDM_FLTISR_CKABF) >> (DFSDM_FLTISR_CKABF_Pos + channel)) & 1U) != 0U)
876 DFSDM1_Filter0->FLTICR = (1UL << (DFSDM_FLTICR_CLRCKABF_Pos + channel));
879 if ((
HAL_GetTick() - tickstart) > DFSDM_CKAB_TIMEOUT)
882 status = HAL_TIMEOUT;
890 DFSDM1_Filter0->FLTCR2 |= DFSDM_FLTCR2_CKABIE;
893 hdfsdm_channel->Instance->CHCFGR1 |= DFSDM_CHCFGR1_CKABEN;
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
static uint32_t DFSDM_GetChannelFromInstance(const DFSDM_Channel_TypeDef *Instance)
This function allows to get the channel number from channel instance.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_DFSDM_ChannelCkabStop()
This function allows to stop clock absence detection in polling mode.
- Parameters
-
| hdfsdm_channel | DFSDM channel handle. |
- Return values
-
Definition at line 814 of file stm32l4xx_hal_dfsdm.c.
816 HAL_StatusTypeDef status =
HAL_OK;
820 assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
831 hdfsdm_channel->Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_CKABEN);
835 DFSDM1_Filter0->FLTICR = (1UL << (DFSDM_FLTICR_CLRCKABF_Pos + channel));
static uint32_t DFSDM_GetChannelFromInstance(const DFSDM_Channel_TypeDef *Instance)
This function allows to get the channel number from channel instance.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_DFSDM_ChannelCkabStop_IT()
This function allows to stop clock absence detection in interrupt mode.
- Note
- Interrupt will be disabled for all channels
- Parameters
-
| hdfsdm_channel | DFSDM channel handle. |
- Return values
-
Definition at line 921 of file stm32l4xx_hal_dfsdm.c.
923 HAL_StatusTypeDef status =
HAL_OK;
927 assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
938 hdfsdm_channel->Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_CKABEN);
942 DFSDM1_Filter0->FLTICR = (1UL << (DFSDM_FLTICR_CLRCKABF_Pos + channel));
945 DFSDM1_Filter0->FLTCR2 &= ~(DFSDM_FLTCR2_CKABIE);
static uint32_t DFSDM_GetChannelFromInstance(const DFSDM_Channel_TypeDef *Instance)
This function allows to get the channel number from channel instance.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_DFSDM_ChannelGetAwdValue()
This function allows to get channel analog watchdog value.
- Parameters
-
| hdfsdm_channel | DFSDM channel handle. |
- Return values
-
| Channel | analog watchdog value. |
Definition at line 1175 of file stm32l4xx_hal_dfsdm.c.
1177 return (int16_t) hdfsdm_channel->Instance->CHWDATAR;
◆ HAL_DFSDM_ChannelModifyOffset()
This function allows to modify channel offset value.
- Parameters
-
| hdfsdm_channel | DFSDM channel handle. |
| Offset | DFSDM channel offset. This parameter must be a number between Min_Data = -8388608 and Max_Data = 8388607. |
- Return values
-
Definition at line 1187 of file stm32l4xx_hal_dfsdm.c.
1190 HAL_StatusTypeDef status =
HAL_OK;
1193 assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
1205 hdfsdm_channel->Instance->CHCFGR2 &= ~(DFSDM_CHCFGR2_OFFSET);
1206 hdfsdm_channel->Instance->CHCFGR2 |= ((uint32_t) Offset << DFSDM_CHCFGR2_OFFSET_Pos);
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_DFSDM_ChannelPollForCkab()
This function allows to poll for the clock absence detection.
- Parameters
-
| hdfsdm_channel | DFSDM channel handle. |
| Timeout | Timeout value in milliseconds. |
- Return values
-
Definition at line 764 of file stm32l4xx_hal_dfsdm.c.
771 assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
788 while ((((DFSDM1_Filter0->FLTISR & DFSDM_FLTISR_CKABF) >> (DFSDM_FLTISR_CKABF_Pos + channel)) & 1U) == 0U)
791 if (Timeout != HAL_MAX_DELAY)
793 if (((
HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
802 DFSDM1_Filter0->FLTICR = (1UL << (DFSDM_FLTICR_CLRCKABF_Pos + channel));
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
static uint32_t DFSDM_GetChannelFromInstance(const DFSDM_Channel_TypeDef *Instance)
This function allows to get the channel number from channel instance.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_DFSDM_ChannelPollForScd()
This function allows to poll for the short circuit detection.
- Parameters
-
| hdfsdm_channel | DFSDM channel handle. |
| Timeout | Timeout value in milliseconds. |
- Return values
-
Definition at line 998 of file stm32l4xx_hal_dfsdm.c.
1005 assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
1022 while (((DFSDM1_Filter0->FLTISR & DFSDM_FLTISR_SCDF) >> (DFSDM_FLTISR_SCDF_Pos + channel)) == 0U)
1025 if (Timeout != HAL_MAX_DELAY)
1027 if (((
HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
1036 DFSDM1_Filter0->FLTICR = (1UL << (DFSDM_FLTICR_CLRSCDF_Pos + channel));
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
static uint32_t DFSDM_GetChannelFromInstance(const DFSDM_Channel_TypeDef *Instance)
This function allows to get the channel number from channel instance.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_DFSDM_ChannelScdCallback()
Short circuit detection callback.
- Parameters
-
| hdfsdm_channel | DFSDM channel handle. |
- Return values
-
Definition at line 1124 of file stm32l4xx_hal_dfsdm.c.
1127 UNUSED(hdfsdm_channel);
◆ HAL_DFSDM_ChannelScdStart()
This function allows to start short circuit detection in polling mode.
- Note
- Same mode has to be used for all channels
- Parameters
-
| hdfsdm_channel | DFSDM channel handle. |
| Threshold | Short circuit detector threshold. This parameter must be a number between Min_Data = 0 and Max_Data = 255. |
| BreakSignal | Break signals assigned to short circuit event. This parameter can be a values combination of DFSDM break signals. |
- Return values
-
Definition at line 961 of file stm32l4xx_hal_dfsdm.c.
965 HAL_StatusTypeDef status =
HAL_OK;
968 assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
969 assert_param(IS_DFSDM_CHANNEL_SCD_THRESHOLD(Threshold));
981 hdfsdm_channel->Instance->CHAWSCDR &= ~(DFSDM_CHAWSCDR_BKSCD | DFSDM_CHAWSCDR_SCDT);
982 hdfsdm_channel->Instance->CHAWSCDR |= ((BreakSignal << DFSDM_CHAWSCDR_BKSCD_Pos) | \
986 hdfsdm_channel->Instance->CHCFGR1 |= DFSDM_CHCFGR1_SCDEN;
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_DFSDM_ChannelScdStart_IT()
| HAL_StatusTypeDef HAL_DFSDM_ChannelScdStart_IT |
( |
DFSDM_Channel_HandleTypeDef * |
hdfsdm_channel, |
|
|
uint32_t |
Threshold, |
|
|
uint32_t |
BreakSignal |
|
) |
| |
This function allows to start short circuit detection in interrupt mode.
- Note
- Same mode has to be used for all channels
- Parameters
-
| hdfsdm_channel | DFSDM channel handle. |
| Threshold | Short circuit detector threshold. This parameter must be a number between Min_Data = 0 and Max_Data = 255. |
| BreakSignal | Break signals assigned to short circuit event. This parameter can be a values combination of DFSDM break signals. |
- Return values
-
Definition at line 1085 of file stm32l4xx_hal_dfsdm.c.
1089 HAL_StatusTypeDef status =
HAL_OK;
1092 assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
1093 assert_param(IS_DFSDM_CHANNEL_SCD_THRESHOLD(Threshold));
1105 DFSDM1_Filter0->FLTCR2 |= DFSDM_FLTCR2_SCDIE;
1108 hdfsdm_channel->Instance->CHAWSCDR &= ~(DFSDM_CHAWSCDR_BKSCD | DFSDM_CHAWSCDR_SCDT);
1109 hdfsdm_channel->Instance->CHAWSCDR |= ((BreakSignal << DFSDM_CHAWSCDR_BKSCD_Pos) | \
1113 hdfsdm_channel->Instance->CHCFGR1 |= DFSDM_CHCFGR1_SCDEN;
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_DFSDM_ChannelScdStop()
This function allows to stop short circuit detection in polling mode.
- Parameters
-
| hdfsdm_channel | DFSDM channel handle. |
- Return values
-
Definition at line 1048 of file stm32l4xx_hal_dfsdm.c.
1050 HAL_StatusTypeDef status =
HAL_OK;
1054 assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
1065 hdfsdm_channel->Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_SCDEN);
1069 DFSDM1_Filter0->FLTICR = (1UL << (DFSDM_FLTICR_CLRSCDF_Pos + channel));
static uint32_t DFSDM_GetChannelFromInstance(const DFSDM_Channel_TypeDef *Instance)
This function allows to get the channel number from channel instance.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_DFSDM_ChannelScdStop_IT()
This function allows to stop short circuit detection in interrupt mode.
- Note
- Interrupt will be disabled for all channels
- Parameters
-
| hdfsdm_channel | DFSDM channel handle. |
- Return values
-
Definition at line 1140 of file stm32l4xx_hal_dfsdm.c.
1142 HAL_StatusTypeDef status =
HAL_OK;
1146 assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
1157 hdfsdm_channel->Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_SCDEN);
1161 DFSDM1_Filter0->FLTICR = (1UL << (DFSDM_FLTICR_CLRSCDF_Pos + channel));
1164 DFSDM1_Filter0->FLTCR2 &= ~(DFSDM_FLTCR2_SCDIE);
static uint32_t DFSDM_GetChannelFromInstance(const DFSDM_Channel_TypeDef *Instance)
This function allows to get the channel number from channel instance.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))