STM32L4xx_HAL_Driver  1.14.0
Initialization and de-initialization functions

Functions

ErrorStatus LL_SWPMI_DeInit (SWPMI_TypeDef *SWPMIx)
 De-initialize the SWPMI peripheral registers to their default reset values. More...
 
ErrorStatus LL_SWPMI_Init (SWPMI_TypeDef *SWPMIx, LL_SWPMI_InitTypeDef *SWPMI_InitStruct)
 Initialize the SWPMI peripheral according to the specified parameters in the SWPMI_InitStruct. More...
 
void LL_SWPMI_StructInit (LL_SWPMI_InitTypeDef *SWPMI_InitStruct)
 Set each LL_SWPMI_InitTypeDef field to default value. More...
 

Detailed Description

Function Documentation

◆ LL_SWPMI_DeInit()

ErrorStatus LL_SWPMI_DeInit ( SWPMI_TypeDef *  SWPMIx)

De-initialize the SWPMI peripheral registers to their default reset values.

Parameters
SWPMIxSWPMI Instance
Return values
AnErrorStatus enumeration value
  • SUCCESS: SWPMI registers are de-initialized
  • ERROR: Not applicable

Definition at line 81 of file stm32l4xx_ll_swpmi.c.

82 {
83  ErrorStatus status = SUCCESS;
84 
85  /* Check the parameter */
86  assert_param(IS_SWPMI_INSTANCE(SWPMIx));
87 
88  if (SWPMIx == SWPMI1)
89  {
90  LL_APB1_GRP2_ForceReset(LL_APB1_GRP2_PERIPH_SWPMI1);
91  LL_APB1_GRP2_ReleaseReset(LL_APB1_GRP2_PERIPH_SWPMI1);
92  }
93  else
94  {
95  status = ERROR;
96  }
97 
98  return status;
99 }
__STATIC_INLINE void LL_APB1_GRP2_ForceReset(uint32_t Periphs)
Force APB1 peripherals reset. APB1RSTR2 LPUART1RST LL_APB1_GRP2_ForceReset APB1RSTR2 I2C4RST LL_APB...
__STATIC_INLINE void LL_APB1_GRP2_ReleaseReset(uint32_t Periphs)
Release APB1 peripherals reset. APB1RSTR2 LPUART1RST LL_APB1_GRP2_ReleaseReset APB1RSTR2 I2C4RST LL...
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_SWPMI_Init()

ErrorStatus LL_SWPMI_Init ( SWPMI_TypeDef *  SWPMIx,
LL_SWPMI_InitTypeDef SWPMI_InitStruct 
)

Initialize the SWPMI peripheral according to the specified parameters in the SWPMI_InitStruct.

Note
As some bits in SWPMI configuration registers can only be written when the SWPMI is deactivated (SWPMI_CR_SWPACT bit = 0), SWPMI IP should be in deactivated state prior calling this function. Otherwise, ERROR result will be returned.
Parameters
SWPMIxSWPMI Instance
SWPMI_InitStructpointer to a LL_SWPMI_InitTypeDef structure that contains the configuration information for the SWPMI peripheral.
Return values
AnErrorStatus enumeration value
  • SUCCESS: SWPMI registers are initialized
  • ERROR: SWPMI registers are not initialized

Definition at line 112 of file stm32l4xx_ll_swpmi.c.

113 {
114  ErrorStatus status = SUCCESS;
115 
116  /* Check the parameters */
117  assert_param(IS_SWPMI_INSTANCE(SWPMIx));
118  assert_param(IS_LL_SWPMI_BITRATE_VALUE(SWPMI_InitStruct->BitRatePrescaler));
119  assert_param(IS_LL_SWPMI_SW_BUFFER_TX(SWPMI_InitStruct->TxBufferingMode));
120  assert_param(IS_LL_SWPMI_SW_BUFFER_RX(SWPMI_InitStruct->RxBufferingMode));
121  assert_param(IS_LL_SWPMI_VOLTAGE_CLASS(SWPMI_InitStruct->VoltageClass));
122 
123  /* SWPMI needs to be in deactivated state, in order to be able to configure some bits */
124  if (LL_SWPMI_IsActivated(SWPMIx) == 0U)
125  {
126  /* Configure the BRR register (Bitrate) */
127  LL_SWPMI_SetBitRatePrescaler(SWPMIx, SWPMI_InitStruct->BitRatePrescaler);
128 
129  /* Configure the voltage class */
130  LL_SWPMI_SetVoltageClass(SWPMIx, SWPMI_InitStruct->VoltageClass);
131 
132  /* Set the new configuration of the SWPMI peripheral */
133  MODIFY_REG(SWPMIx->CR,
134  (SWPMI_CR_RXMODE | SWPMI_CR_TXMODE),
135  (SWPMI_InitStruct->TxBufferingMode | SWPMI_InitStruct->RxBufferingMode));
136  }
137  /* Else (SWPMI not in deactivated state => return ERROR) */
138  else
139  {
140  status = ERROR;
141  }
142 
143  return status;
144 }
__STATIC_INLINE uint32_t LL_SWPMI_IsActivated(SWPMI_TypeDef *SWPMIx)
Check if Single wire protocol bus is in ACTIVATED state. CR SWPACT LL_SWPMI_Activate.
__STATIC_INLINE void LL_SWPMI_SetBitRatePrescaler(SWPMI_TypeDef *SWPMIx, uint32_t BitRatePrescaler)
Set Bitrate prescaler SWPMI_freq = SWPMI_clk / (((BitRate) + 1) * 4) BRR BR LL_SWPMI_SetBitRatePresc...
__STATIC_INLINE void LL_SWPMI_SetVoltageClass(SWPMI_TypeDef *SWPMIx, uint32_t VoltageClass)
Set SWP Voltage Class OR CLASS LL_SWPMI_SetVoltageClass.
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_SWPMI_StructInit()

void LL_SWPMI_StructInit ( LL_SWPMI_InitTypeDef SWPMI_InitStruct)

Set each LL_SWPMI_InitTypeDef field to default value.

Parameters
SWPMI_InitStructpointer to a LL_SWPMI_InitTypeDef structure that contains the configuration information for the SWPMI peripheral.
Return values
None

Definition at line 152 of file stm32l4xx_ll_swpmi.c.

153 {
154  /* Set SWPMI_InitStruct fields to default values */
155  SWPMI_InitStruct->VoltageClass = LL_SWPMI_VOLTAGE_CLASS_C;
156  SWPMI_InitStruct->BitRatePrescaler = (uint32_t)0x00000001;
157  SWPMI_InitStruct->TxBufferingMode = LL_SWPMI_SW_BUFFER_TX_SINGLE;
158  SWPMI_InitStruct->RxBufferingMode = LL_SWPMI_SW_BUFFER_RX_SINGLE;
159 }