STM32L4xx_HAL_Driver  1.14.0
Initialization and de-initialization functions

Functions

uint32_t LL_EXTI_Init (LL_EXTI_InitTypeDef *EXTI_InitStruct)
 Initialize the EXTI registers according to the specified parameters in EXTI_InitStruct. More...
 
uint32_t LL_EXTI_DeInit (void)
 De-initialize the EXTI registers to their default reset values. More...
 
void LL_EXTI_StructInit (LL_EXTI_InitTypeDef *EXTI_InitStruct)
 Set each LL_EXTI_InitTypeDef field to default value. More...
 

Detailed Description

Function Documentation

◆ LL_EXTI_DeInit()

uint32_t LL_EXTI_DeInit ( void  )

De-initialize the EXTI registers to their default reset values.

Return values
AnErrorStatus enumeration value:
  • 0x00: EXTI registers are de-initialized

Definition at line 80 of file stm32l4xx_ll_exti.c.

81 {
82  /* Interrupt mask register set to default reset values */
83  LL_EXTI_WriteReg(IMR1, 0xFF820000U);
84  /* Event mask register set to default reset values */
85  LL_EXTI_WriteReg(EMR1, 0x00000000U);
86  /* Rising Trigger selection register set to default reset values */
87  LL_EXTI_WriteReg(RTSR1, 0x00000000U);
88  /* Falling Trigger selection register set to default reset values */
89  LL_EXTI_WriteReg(FTSR1, 0x00000000U);
90  /* Software interrupt event register set to default reset values */
91  LL_EXTI_WriteReg(SWIER1, 0x00000000U);
92  /* Pending register clear */
93  LL_EXTI_WriteReg(PR1, 0x007DFFFFU);
94 
95  /* Interrupt mask register 2 set to default reset values */
96 #if defined(LL_EXTI_LINE_40)
97  LL_EXTI_WriteReg(IMR2, 0x00000187U);
98 #else
99  LL_EXTI_WriteReg(IMR2, 0x00000087U);
100 #endif
101  /* Event mask register 2 set to default reset values */
102  LL_EXTI_WriteReg(EMR2, 0x00000000U);
103  /* Rising Trigger selection register 2 set to default reset values */
104  LL_EXTI_WriteReg(RTSR2, 0x00000000U);
105  /* Falling Trigger selection register 2 set to default reset values */
106  LL_EXTI_WriteReg(FTSR2, 0x00000000U);
107  /* Software interrupt event register 2 set to default reset values */
108  LL_EXTI_WriteReg(SWIER2, 0x00000000U);
109  /* Pending register 2 clear */
110  LL_EXTI_WriteReg(PR2, 0x00000078U);
111 
112  return 0x00u;
113 }

◆ LL_EXTI_Init()

uint32_t LL_EXTI_Init ( LL_EXTI_InitTypeDef EXTI_InitStruct)

Initialize the EXTI registers according to the specified parameters in EXTI_InitStruct.

Parameters
EXTI_InitStructpointer to a LL_EXTI_InitTypeDef structure.
Return values
AnErrorStatus enumeration value:
  • 0x00: EXTI registers are initialized
  • any other calue : wrong configuration

Definition at line 122 of file stm32l4xx_ll_exti.c.

123 {
124  uint32_t status = 0x00u;
125 
126  /* Check the parameters */
127  assert_param(IS_LL_EXTI_LINE_0_31(EXTI_InitStruct->Line_0_31));
128  assert_param(IS_LL_EXTI_LINE_32_63(EXTI_InitStruct->Line_32_63));
129  assert_param(IS_FUNCTIONAL_STATE(EXTI_InitStruct->LineCommand));
130  assert_param(IS_LL_EXTI_MODE(EXTI_InitStruct->Mode));
131 
132  /* ENABLE LineCommand */
133  if (EXTI_InitStruct->LineCommand != DISABLE)
134  {
135  assert_param(IS_LL_EXTI_TRIGGER(EXTI_InitStruct->Trigger));
136 
137  /* Configure EXTI Lines in range from 0 to 31 */
138  if (EXTI_InitStruct->Line_0_31 != LL_EXTI_LINE_NONE)
139  {
140  switch (EXTI_InitStruct->Mode)
141  {
142  case LL_EXTI_MODE_IT:
143  /* First Disable Event on provided Lines */
144  LL_EXTI_DisableEvent_0_31(EXTI_InitStruct->Line_0_31);
145  /* Then Enable IT on provided Lines */
146  LL_EXTI_EnableIT_0_31(EXTI_InitStruct->Line_0_31);
147  break;
148  case LL_EXTI_MODE_EVENT:
149  /* First Disable IT on provided Lines */
150  LL_EXTI_DisableIT_0_31(EXTI_InitStruct->Line_0_31);
151  /* Then Enable Event on provided Lines */
152  LL_EXTI_EnableEvent_0_31(EXTI_InitStruct->Line_0_31);
153  break;
154  case LL_EXTI_MODE_IT_EVENT:
155  /* Directly Enable IT & Event on provided Lines */
156  LL_EXTI_EnableIT_0_31(EXTI_InitStruct->Line_0_31);
157  LL_EXTI_EnableEvent_0_31(EXTI_InitStruct->Line_0_31);
158  break;
159  default:
160  status = 0x01u;
161  break;
162  }
163  if (EXTI_InitStruct->Trigger != LL_EXTI_TRIGGER_NONE)
164  {
165  switch (EXTI_InitStruct->Trigger)
166  {
167  case LL_EXTI_TRIGGER_RISING:
168  /* First Disable Falling Trigger on provided Lines */
169  LL_EXTI_DisableFallingTrig_0_31(EXTI_InitStruct->Line_0_31);
170  /* Then Enable Rising Trigger on provided Lines */
171  LL_EXTI_EnableRisingTrig_0_31(EXTI_InitStruct->Line_0_31);
172  break;
173  case LL_EXTI_TRIGGER_FALLING:
174  /* First Disable Rising Trigger on provided Lines */
175  LL_EXTI_DisableRisingTrig_0_31(EXTI_InitStruct->Line_0_31);
176  /* Then Enable Falling Trigger on provided Lines */
177  LL_EXTI_EnableFallingTrig_0_31(EXTI_InitStruct->Line_0_31);
178  break;
179  case LL_EXTI_TRIGGER_RISING_FALLING:
180  LL_EXTI_EnableRisingTrig_0_31(EXTI_InitStruct->Line_0_31);
181  LL_EXTI_EnableFallingTrig_0_31(EXTI_InitStruct->Line_0_31);
182  break;
183  default:
184  status |= 0x02u;
185  break;
186  }
187  }
188  }
189  /* Configure EXTI Lines in range from 32 to 63 */
190  if (EXTI_InitStruct->Line_32_63 != LL_EXTI_LINE_NONE)
191  {
192  switch (EXTI_InitStruct->Mode)
193  {
194  case LL_EXTI_MODE_IT:
195  /* First Disable Event on provided Lines */
196  LL_EXTI_DisableEvent_32_63(EXTI_InitStruct->Line_32_63);
197  /* Then Enable IT on provided Lines */
198  LL_EXTI_EnableIT_32_63(EXTI_InitStruct->Line_32_63);
199  break;
200  case LL_EXTI_MODE_EVENT:
201  /* First Disable IT on provided Lines */
202  LL_EXTI_DisableIT_32_63(EXTI_InitStruct->Line_32_63);
203  /* Then Enable Event on provided Lines */
204  LL_EXTI_EnableEvent_32_63(EXTI_InitStruct->Line_32_63);
205  break;
206  case LL_EXTI_MODE_IT_EVENT:
207  /* Directly Enable IT & Event on provided Lines */
208  LL_EXTI_EnableIT_32_63(EXTI_InitStruct->Line_32_63);
209  LL_EXTI_EnableEvent_32_63(EXTI_InitStruct->Line_32_63);
210  break;
211  default:
212  status |= 0x04u;
213  break;
214  }
215  if (EXTI_InitStruct->Trigger != LL_EXTI_TRIGGER_NONE)
216  {
217  switch (EXTI_InitStruct->Trigger)
218  {
219  case LL_EXTI_TRIGGER_RISING:
220  /* First Disable Falling Trigger on provided Lines */
222  /* Then Enable IT on provided Lines */
223  LL_EXTI_EnableRisingTrig_32_63(EXTI_InitStruct->Line_32_63);
224  break;
225  case LL_EXTI_TRIGGER_FALLING:
226  /* First Disable Rising Trigger on provided Lines */
228  /* Then Enable Falling Trigger on provided Lines */
230  break;
231  case LL_EXTI_TRIGGER_RISING_FALLING:
232  LL_EXTI_EnableRisingTrig_32_63(EXTI_InitStruct->Line_32_63);
234  break;
235  default:
236  status = ERROR;
237  break;
238  }
239  }
240  }
241  }
242  /* DISABLE LineCommand */
243  else
244  {
245  /* De-configure EXTI Lines in range from 0 to 31 */
246  LL_EXTI_DisableIT_0_31(EXTI_InitStruct->Line_0_31);
247  LL_EXTI_DisableEvent_0_31(EXTI_InitStruct->Line_0_31);
248  /* De-configure EXTI Lines in range from 32 to 63 */
249  LL_EXTI_DisableIT_32_63(EXTI_InitStruct->Line_32_63);
250  LL_EXTI_DisableEvent_32_63(EXTI_InitStruct->Line_32_63);
251  }
252 
253  return status;
254 }
__STATIC_INLINE void LL_EXTI_DisableEvent_0_31(uint32_t ExtiLine)
Disable ExtiLine Event request for Lines in range 0 to 31 EMR1 EMx LL_EXTI_DisableEvent_0_31.
__STATIC_INLINE void LL_EXTI_DisableRisingTrig_32_63(uint32_t ExtiLine)
Disable ExtiLine Rising Edge Trigger for Lines in range 32 to 63.
__STATIC_INLINE void LL_EXTI_DisableFallingTrig_0_31(uint32_t ExtiLine)
Disable ExtiLine Falling Edge Trigger for Lines in range 0 to 31.
__STATIC_INLINE void LL_EXTI_EnableFallingTrig_0_31(uint32_t ExtiLine)
Enable ExtiLine Falling Edge Trigger for Lines in range 0 to 31.
__STATIC_INLINE void LL_EXTI_DisableEvent_32_63(uint32_t ExtiLine)
Disable ExtiLine Event request for Lines in range 32 to 63 EMR2 EMx LL_EXTI_DisableEvent_32_63.
__STATIC_INLINE void LL_EXTI_EnableRisingTrig_0_31(uint32_t ExtiLine)
Enable ExtiLine Rising Edge Trigger for Lines in range 0 to 31.
__STATIC_INLINE void LL_EXTI_DisableFallingTrig_32_63(uint32_t ExtiLine)
Disable ExtiLine Falling Edge Trigger for Lines in range 32 to 63.
__STATIC_INLINE void LL_EXTI_EnableEvent_0_31(uint32_t ExtiLine)
Enable ExtiLine Event request for Lines in range 0 to 31 EMR1 EMx LL_EXTI_EnableEvent_0_31.
__STATIC_INLINE void LL_EXTI_DisableRisingTrig_0_31(uint32_t ExtiLine)
Disable ExtiLine Rising Edge Trigger for Lines in range 0 to 31.
__STATIC_INLINE void LL_EXTI_DisableIT_0_31(uint32_t ExtiLine)
Disable ExtiLine Interrupt request for Lines in range 0 to 31.
__STATIC_INLINE void LL_EXTI_EnableIT_0_31(uint32_t ExtiLine)
Enable ExtiLine Interrupt request for Lines in range 0 to 31.
__STATIC_INLINE void LL_EXTI_EnableEvent_32_63(uint32_t ExtiLine)
Enable ExtiLine Event request for Lines in range 32 to 63 EMR2 EMx LL_EXTI_EnableEvent_32_63.
__STATIC_INLINE void LL_EXTI_EnableFallingTrig_32_63(uint32_t ExtiLine)
Enable ExtiLine Falling Edge Trigger for Lines in range 32 to 63.
__STATIC_INLINE void LL_EXTI_EnableIT_32_63(uint32_t ExtiLine)
Enable ExtiLine Interrupt request for Lines in range 32 to 63.
__STATIC_INLINE void LL_EXTI_EnableRisingTrig_32_63(uint32_t ExtiLine)
Enable ExtiLine Rising Edge Trigger for Lines in range 32 to 63.
FunctionalState LineCommand
__STATIC_INLINE void LL_EXTI_DisableIT_32_63(uint32_t ExtiLine)
Disable ExtiLine Interrupt request for Lines in range 32 to 63.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_EXTI_StructInit()

void LL_EXTI_StructInit ( LL_EXTI_InitTypeDef EXTI_InitStruct)

Set each LL_EXTI_InitTypeDef field to default value.

Parameters
EXTI_InitStructPointer to a LL_EXTI_InitTypeDef structure.
Return values
None

Definition at line 261 of file stm32l4xx_ll_exti.c.

262 {
263  EXTI_InitStruct->Line_0_31 = LL_EXTI_LINE_NONE;
264  EXTI_InitStruct->Line_32_63 = LL_EXTI_LINE_NONE;
265  EXTI_InitStruct->LineCommand = DISABLE;
266  EXTI_InitStruct->Mode = LL_EXTI_MODE_IT;
267  EXTI_InitStruct->Trigger = LL_EXTI_TRIGGER_FALLING;
268 }
FunctionalState LineCommand