1 /**
2 ******************************************************************************
3 * @file stm32mp1xx_hal_pwr_ex.c
4 * @author MCD Application Team
5 * @brief Extended PWR HAL module driver.
6 * This file provides firmware functions to manage the following
7 * functionalities of PWR extension peripheral:
8 * + Peripheral Extended features functions
9 *
10 ******************************************************************************
11 * @attention
12 *
13 * Copyright (c) 2019 STMicroelectronics.
14 * All rights reserved.
15 *
16 * This software is licensed under terms that can be found in the LICENSE file
17 * in the root directory of this software component.
18 * If no LICENSE file comes with this software, it is provided AS-IS.
19 *
20 ******************************************************************************
21 */
22
23 /* Includes ------------------------------------------------------------------*/
24 #include "stm32mp1xx_hal.h"
25
26
27 /** @addtogroup STM32MP1xx_HAL_Driver
28 * @{
29 */
30
31 /** @defgroup PWREx PWREx
32 * @brief PWR HAL module driver
33 * @{
34 */
35
36 #ifdef HAL_PWR_MODULE_ENABLED
37
38 /* Private typedef -----------------------------------------------------------*/
39 /* Private define ------------------------------------------------------------*/
40 /** @addtogroup PWREx_Private_Constants PWREx Private Constants
41 * @{
42 */
43
44 /** @defgroup PWREx_AVD_Mode_Mask PWR Extended AVD Mode Mask
45 * @{
46 */
47 #define AVD_MODE_IT ((uint32_t)0x00010000U)
48 #define AVD_MODE_EVT ((uint32_t)0x00020000U)
49 #define AVD_RISING_EDGE ((uint32_t)0x00000001U)
50 #define AVD_FALLING_EDGE ((uint32_t)0x00000002U)
51 #define AVD_RISING_FALLING_EDGE ((uint32_t)0x00000003U)
52 /**
53 * @}
54 */
55
56 /** @defgroup PWREx_REG_SET_TIMEOUT PWR Extended Flag Setting Time Out Value
57 * @{
58 */
59 #define PWR_FLAG_SETTING_DELAY_US ((uint32_t)1000U)
60 /**
61 * @}
62 */
63
64 /**
65 * @}
66 */
67
68 /* Private macro -------------------------------------------------------------*/
69 /* Private variables ---------------------------------------------------------*/
70 /* Private function prototypes -----------------------------------------------*/
71 /* Private functions ---------------------------------------------------------*/
72
73 /** @defgroup PWREx_Private_Functions PWREx Private Functions
74 * @{
75 */
76
77 /** @defgroup PWREx_Group1 Peripheral Extended features functions
78 * @brief Peripheral Extended features functions
79 *
80 @verbatim
81
82 ===============================================================================
83 ##### Peripheral extended features functions #####
84 ===============================================================================
85
86 *** Main and Backup Regulators configuration ***
87 ================================================
88 [..]
89 (+) The backup domain includes 4 Kbytes of backup SRAM accessible only from
90 the CPU, and address in 32-bit, 16-bit or 8-bit mode. Its content is
91 retained even in Standby or VBAT mode when the low power backup regulator
92 is enabled. It can be considered as an internal EEPROM when VBAT is
93 always present. You can use the HAL_PWR_EnableBkUpReg() function to
94 enable the low power backup regulator.
95
96 (+) When the backup domain is supplied by VDD (analog switch connected to VDD)
97 the backup SRAM is powered from VDD which replaces the VBAT power supply to
98 save battery life.
99
100 (+) The backup SRAM is not mass erased by a tamper event. It is read
101 protected to prevent confidential data, such as cryptographic private
102 key, from being accessed.
103
104 Refer to the product datasheets for more details.
105
106
107 *** VBAT battery charging ***
108 =============================
109 [..]
110 (+) When VDD is present, the external battery connected to VBAT can be charged through an
111 internal resistance. VBAT charging can be performed either through a 5 KOhm resistor
112 or through a 1.5 KOhm resistor.
113 (+) VBAT charging is enabled by HAL_PWREx_EnableBatteryCharging(ResistorValue) function
114 with:
115 (++) ResistorValue:
116 (+++) PWR_BATTERY_CHARGING_RESISTOR_5: 5 KOhm resistor.
117 (+++) PWR_BATTERY_CHARGING_RESISTOR_1_5: 1.5 KOhm resistor.
118 (+) VBAT charging is disabled by HAL_PWREx_DisableBatteryCharging() function.
119
120 *** VBAT and Temperature supervision ***
121 ========================================
122 [..]
123 (+) The VBAT battery voltage supply can be monitored by comparing it with two threshold
124 levels: VBAThigh and VBATlow. VBATH flag and VBATL flag in the PWR control register 2
125 (PWR_CR2), indicate if VBAT is higher or lower than the threshold.
126 (+) The temperature can be monitored by comparing it with two threshold levels, TEMPhigh
127 and TEMPlow. TEMPH and TEMPL flags, in the PWR control register 2 (PWR_CR2),
128 indicate whether the device temperature is higher or lower than the threshold.
129 (+) The VBAT and the temperature monitoring is enabled by HAL_PWREx_EnableMonitoring()
130 function and disabled by HAL_PWREx_DisableMonitoring() function.
131 (+) The HAL_PWREx_GetVBATLevel() function return the VBAT level which can be:
132 PWR_VBAT_BELOW_LOW_THRESHOLD or PWR_VBAT_ABOVE_HIGH_THRESHOLD or
133 PWR_VBAT_BETWEEN_HIGH_LOW_THRESHOLD.
134 (+) The HAL_PWREx_GetTemperatureLevel() function return the Temperature level which
135 can be: PWR_TEMP_BELOW_LOW_THRESHOLD or PWR_TEMP_ABOVE_HIGH_THRESHOLD or
136 PWR_TEMP_BETWEEN_HIGH_LOW_THRESHOLD.
137
138 *** AVD configuration ***
139 =========================
140 [..]
141 (+) The AVD is used to monitor the VDDA power supply by comparing it to a
142 threshold selected by the AVD Level (ALS[3:0] bits in the PWR_CSR1 register).
143 (+) A AVDO flag is available to indicate if VDDA is higher or lower
144 than the AVD threshold. This event is internally connected to the EXTI
145 line 16 to generate an interrupt if enabled.
146 It is configurable through __HAL_PWR_PVD_AVD_EXTI_ENABLE_IT() macro.
147 (+) The AVD is stopped in System Standby mode.
148
149
150 *** USB Regulator supervision ***
151 ===================================
152 [..]
153 (+) When the USB regulator is enabled, the VDD33USB supply level detector shall
154 be enabled through HAL_PWREx_EnableUSBVoltageDetector() function and disabled by
155 HAL_PWREx_DisableUSBVoltageDetector() function.
156
157 @endverbatim
158 * @{
159 */
160
161
162
163 /**
164 * @brief Enables the Backup Regulator.
165 * @note After reset PWR_CR2 register is write-protected and the DBP bit in the
166 * PWR control register 1 (PWR_CR1) has to be set before it can be written.
167 * Use HAL_PWR_EnableBkUpAccess() to do this.
168 * @retval HAL status
169 */
HAL_PWREx_EnableBkUpReg(void)170 HAL_StatusTypeDef HAL_PWREx_EnableBkUpReg(void)
171 {
172 uint32_t tickstart = 0;
173
174 /* Enable Backup regulator */
175 SET_BIT(PWR->CR2, PWR_CR2_BREN);
176
177 /* Get tick */
178 tickstart = HAL_GetTick();
179
180 /* Wait till Backup regulator ready flag is set */
181 while (__HAL_PWR_GET_FLAG(PWR_FLAG_BRR) == RESET)
182 {
183 if ((HAL_GetTick() - tickstart) > PWR_FLAG_SETTING_DELAY_US)
184 {
185 return HAL_TIMEOUT;
186 }
187 }
188
189 return HAL_OK;
190 }
191
192 /**
193 * @brief Disables the Backup Regulator.
194 * @note After reset PWR_CR2 register is write-protected and the DBP bit in the
195 * PWR control register 1 (PWR_CR1) has to be set before it can be written.
196 * Use HAL_PWR_EnableBkUpAccess() to do this.
197 * @retval HAL status
198 */
HAL_PWREx_DisableBkUpReg(void)199 HAL_StatusTypeDef HAL_PWREx_DisableBkUpReg(void)
200 {
201 uint32_t tickstart = 0;
202
203 /* Disable Backup regulator */
204 CLEAR_BIT(PWR->CR2, PWR_CR2_BREN);
205
206 /* Get tick */
207 tickstart = HAL_GetTick();
208
209 /* Wait till Backup regulator ready flag is reset */
210 while (__HAL_PWR_GET_FLAG(PWR_FLAG_BRR) != RESET)
211 {
212 if ((HAL_GetTick() - tickstart) > PWR_FLAG_SETTING_DELAY_US)
213 {
214 return HAL_TIMEOUT;
215 }
216 }
217 return HAL_OK;
218 }
219
220 /**
221 * @brief Enables the Retention Regulator.
222 * @note After reset PWR_CR2 register is write-protected and the DBP bit in the
223 * PWR control register 1 (PWR_CR1) has to be set before it can be written.
224 * Use HAL_PWR_EnableBkUpAccess() to do this.
225 * @retval HAL status
226 */
HAL_PWREx_EnableRetReg(void)227 HAL_StatusTypeDef HAL_PWREx_EnableRetReg(void)
228 {
229 uint32_t tickstart = 0;
230
231 /* Enable Backup regulator */
232 SET_BIT(PWR->CR2, PWR_CR2_RREN);
233
234 /* Get tick */
235 tickstart = HAL_GetTick();
236
237 /* Wait till Retention regulator ready flag is set */
238 while (__HAL_PWR_GET_FLAG(PWR_FLAG_RRR) == RESET)
239 {
240 if ((HAL_GetTick() - tickstart) > PWR_FLAG_SETTING_DELAY_US)
241 {
242 return HAL_TIMEOUT;
243 }
244 }
245
246 return HAL_OK;
247 }
248
249 /**
250 * @brief Disables the Retention Regulator.
251 * @note After reset PWR_CR2 register is write-protected and the DBP bit in the
252 * PWR control register 1 (PWR_CR1) has to be set before it can be written.
253 * Use HAL_PWR_EnableBkUpAccess() to do this.
254 * @retval HAL status
255 */
HAL_PWREx_DisableRetReg(void)256 HAL_StatusTypeDef HAL_PWREx_DisableRetReg(void)
257 {
258 uint32_t tickstart = 0;
259
260 /* Disable Backup regulator */
261 CLEAR_BIT(PWR->CR2, PWR_CR2_RREN);
262
263 /* Get tick */
264 tickstart = HAL_GetTick();
265
266 /* Wait till Backup regulator ready flag is set */
267 while (__HAL_PWR_GET_FLAG(PWR_FLAG_RRR) != RESET)
268 {
269 if ((HAL_GetTick() - tickstart) > PWR_FLAG_SETTING_DELAY_US)
270 {
271 return HAL_TIMEOUT;
272 }
273 }
274 return HAL_OK;
275 }
276
277 /**
278 * @brief Enables the 1V1 Regulator.
279 * @retval HAL status
280 */
HAL_PWREx_Enable1V1Reg(void)281 HAL_StatusTypeDef HAL_PWREx_Enable1V1Reg(void)
282 {
283 uint32_t tickstart = 0;
284
285 /* Enable 1V1 regulator */
286 SET_BIT(PWR->CR3, PWR_CR3_REG11EN);
287
288 /* Get tick */
289 tickstart = HAL_GetTick();
290
291 /* Wait till 1V1 regulator ready flag is set */
292 while (__HAL_PWR_GET_FLAG(PWR_FLAG_11R) == RESET)
293 {
294 if ((HAL_GetTick() - tickstart) > PWR_FLAG_SETTING_DELAY_US)
295 {
296 return HAL_TIMEOUT;
297 }
298 }
299
300 return HAL_OK;
301 }
302
303
304 /**
305 * @brief Disables the 1V1 Regulator.
306 * @retval HAL status
307 */
HAL_PWREx_Disable1V1Reg(void)308 HAL_StatusTypeDef HAL_PWREx_Disable1V1Reg(void)
309 {
310 uint32_t tickstart = 0;
311
312 /* Disable 1V1 regulator */
313 CLEAR_BIT(PWR->CR3, PWR_CR3_REG11EN);
314
315 /* Get tick */
316 tickstart = HAL_GetTick();
317
318 /* Wait till 1V1 regulator ready flag is reset */
319 while (__HAL_PWR_GET_FLAG(PWR_FLAG_11R) != RESET)
320 {
321 if ((HAL_GetTick() - tickstart) > PWR_FLAG_SETTING_DELAY_US)
322 {
323 return HAL_TIMEOUT;
324 }
325 }
326
327 return HAL_OK;
328 }
329
330 /**
331 * @brief Enables the 1V8 Regulator.
332 * @retval HAL status
333 */
HAL_PWREx_Enable1V8Reg(void)334 HAL_StatusTypeDef HAL_PWREx_Enable1V8Reg(void)
335 {
336 uint32_t tickstart = 0;
337
338 /* Enable 1V8 regulator */
339 SET_BIT(PWR->CR3, PWR_CR3_REG18EN);
340
341 /* Get tick */
342 tickstart = HAL_GetTick();
343
344 /* Wait till 1V8 regulator ready flag is set */
345 while (__HAL_PWR_GET_FLAG(PWR_FLAG_18R) == RESET)
346 {
347 if ((HAL_GetTick() - tickstart) > PWR_FLAG_SETTING_DELAY_US)
348 {
349 return HAL_TIMEOUT;
350 }
351 }
352 return HAL_OK;
353 }
354
355
356 /**
357 * @brief Disables the 1V8 Regulator.
358 * @retval HAL status
359 */
HAL_PWREx_Disable1V8Reg(void)360 HAL_StatusTypeDef HAL_PWREx_Disable1V8Reg(void)
361 {
362 uint32_t tickstart = 0;
363
364 /* Disable 1V8 regulator */
365 CLEAR_BIT(PWR->CR3, PWR_CR3_REG18EN);
366
367 /* Get tick */
368 tickstart = HAL_GetTick();
369
370 /* Wait till 1V8 regulator ready flag is reset */
371 while (__HAL_PWR_GET_FLAG(PWR_FLAG_18R) != RESET)
372 {
373 if ((HAL_GetTick() - tickstart) > PWR_FLAG_SETTING_DELAY_US)
374 {
375 return HAL_TIMEOUT;
376 }
377 }
378 return HAL_OK;
379 }
380
381
382 /**
383 * @brief Enable the USB voltage level detector.
384 * @retval HAL status
385 */
HAL_PWREx_EnableUSBVoltageDetector(void)386 HAL_StatusTypeDef HAL_PWREx_EnableUSBVoltageDetector(void)
387 {
388 uint32_t tickstart = 0;
389
390 /* Enable the USB voltage detector */
391 SET_BIT(PWR->CR3, PWR_CR3_USB33DEN);
392
393 /* Get tick */
394 tickstart = HAL_GetTick();
395
396 /* Wait until USB33 regulator ready flag is set */
397 while (__HAL_PWR_GET_FLAG(PWR_FLAG_USB) == RESET)
398 {
399 if ((HAL_GetTick() - tickstart) > PWR_FLAG_SETTING_DELAY_US)
400 {
401 return HAL_TIMEOUT;
402 }
403 }
404 return HAL_OK;
405 }
406
407 /**
408 * @brief Disable the USB voltage level detector.
409 * @retval HAL status
410 */
HAL_PWREx_DisableUSBVoltageDetector(void)411 HAL_StatusTypeDef HAL_PWREx_DisableUSBVoltageDetector(void)
412 {
413 uint32_t tickstart = 0;
414
415 /* Disable the USB voltage detector */
416 CLEAR_BIT(PWR->CR3, PWR_CR3_USB33DEN);
417
418 /* Get tick */
419 tickstart = HAL_GetTick();
420
421 /* Wait until USB33 regulator ready flag is reset */
422 while (__HAL_PWR_GET_FLAG(PWR_FLAG_USB) != RESET)
423 {
424 if ((HAL_GetTick() - tickstart) > PWR_FLAG_SETTING_DELAY_US)
425 {
426 return HAL_TIMEOUT;
427 }
428 }
429 return HAL_OK;
430 }
431
432
433 /**
434 * @brief Enable the Battery charging.
435 * When VDD is present, charge the external battery through an internal resistor.
436 * @param ResistorValue: Specifies the charging resistor.
437 * This parameter can be one of the following values:
438 * @arg PWR_BATTERY_CHARGING_RESISTOR_5: 5 KOhm resistor.
439 * @arg PWR_BATTERY_CHARGING_RESISTOR_1_5: 1.5 KOhm resistor.
440 * @retval None
441 */
HAL_PWREx_EnableBatteryCharging(uint32_t ResistorValue)442 void HAL_PWREx_EnableBatteryCharging(uint32_t ResistorValue)
443 {
444 assert_param(IS_PWR_BATTERY_RESISTOR_SELECT(ResistorValue));
445
446 /* Specify the charging resistor */
447 MODIFY_REG(PWR->CR3, PWR_CR3_VBRS, ResistorValue);
448
449 /* Enable the Battery charging */
450 SET_BIT(PWR->CR3, PWR_CR3_VBE);
451 }
452
453
454 /**
455 * @brief Disable the Battery charging.
456 * @retval None
457 */
HAL_PWREx_DisableBatteryCharging(void)458 void HAL_PWREx_DisableBatteryCharging(void)
459 {
460 /* Disable the Battery charging */
461 CLEAR_BIT(PWR->CR3, PWR_CR3_VBE);
462 }
463
464
465 /**
466 * @brief Enable the VBAT and temperature monitoring.
467 * @note After reset PWR_CR2 register is write-protected and the DBP bit in the
468 * PWR control register 1 (PWR_CR1) has to be set before it can be written.
469 * Use HAL_PWR_EnableBkUpAccess() to do this.
470 * @retval HAL status
471 */
HAL_PWREx_EnableMonitoring(void)472 void HAL_PWREx_EnableMonitoring(void)
473 {
474 /* Enable the VBAT and Temperature monitoring */
475 SET_BIT(PWR->CR2, PWR_CR2_MONEN);
476 }
477
478 /**
479 * @brief Disable the VBAT and temperature monitoring.
480 * @note After reset PWR_CR2 register is write-protected and the DBP bit in the
481 * PWR control register 1 (PWR_CR1) has to be set before it can be written.
482 * Use HAL_PWR_EnableBkUpAccess() to do this.
483 * @retval HAL status
484 */
HAL_PWREx_DisableMonitoring(void)485 void HAL_PWREx_DisableMonitoring(void)
486 {
487 /* Disable the VBAT and Temperature monitoring */
488 CLEAR_BIT(PWR->CR2, PWR_CR2_MONEN);
489 }
490
491 /**
492 * @brief Indicate whether the junction temperature is between, above or below the threshold.
493 * @retval Temperature level.
494 */
HAL_PWREx_GetTemperatureLevel(void)495 uint32_t HAL_PWREx_GetTemperatureLevel(void)
496 {
497 uint32_t tempLevel;
498 uint32_t regValue;
499
500 /* Read the temperature flags */
501 regValue = PWR->CR2 & (PWR_CR2_TEMPH | PWR_CR2_TEMPL);
502
503 /* Compare the read value to the temperature threshold */
504 if (regValue == PWR_CR2_TEMPL)
505 {
506 tempLevel = PWR_TEMP_BELOW_LOW_THRESHOLD;
507 }
508 else if (regValue == PWR_CR2_TEMPH)
509 {
510 tempLevel = PWR_TEMP_ABOVE_HIGH_THRESHOLD;
511 }
512 else
513 {
514 tempLevel = PWR_TEMP_BETWEEN_HIGH_LOW_THRESHOLD;
515 }
516
517 return tempLevel;
518 }
519
520
521 /**
522 * @brief Indicate whether the Battery voltage level is between, above or below the threshold.
523 * @retval VBAT level.
524 */
HAL_PWREx_GetVBATLevel(void)525 uint32_t HAL_PWREx_GetVBATLevel(void)
526 {
527 uint32_t VBATLevel;
528 uint32_t regValue;
529
530 /* Read the VBAT flags */
531 regValue = PWR->CR2 & (PWR_CR2_VBATH | PWR_CR2_VBATL);
532
533 /* Compare the read value to the VBAT threshold */
534 if (regValue == PWR_CR2_VBATL)
535 {
536 VBATLevel = PWR_VBAT_BELOW_LOW_THRESHOLD;
537 }
538 else if (regValue == PWR_CR2_VBATH)
539 {
540 VBATLevel = PWR_VBAT_ABOVE_HIGH_THRESHOLD;
541 }
542 else
543 {
544 VBATLevel = PWR_VBAT_BETWEEN_HIGH_LOW_THRESHOLD;
545 }
546
547 return VBATLevel;
548 }
549
550
551 /**
552 * @brief Configure the analog voltage threshold detected by the Analog Voltage Detector(AVD).
553 * @param sConfigAVD: pointer to an PWR_AVDTypeDef structure that contains the configuration
554 * information for the AVD.
555 * @note Refer to the electrical characteristics of your device datasheet for more details
556 * about the voltage threshold corresponding to each detection level.
557 * @retval None
558 */
HAL_PWREx_ConfigAVD(PWREx_AVDTypeDef * sConfigAVD)559 void HAL_PWREx_ConfigAVD(PWREx_AVDTypeDef *sConfigAVD)
560 {
561 /* Check the parameters */
562 assert_param(IS_PWR_AVD_LEVEL(sConfigAVD->AVDLevel));
563 assert_param(IS_PWR_AVD_MODE(sConfigAVD->Mode));
564
565 /* Set the ALS[18:17] bits according to AVDLevel value */
566 MODIFY_REG(PWR->CR1, PWR_CR1_ALS, sConfigAVD->AVDLevel);
567
568 /* Clear any previous config. Keep it clear if no IT mode is selected */
569 __HAL_PWR_PVD_AVD_EXTI_DISABLE_IT();
570 __HAL_PWR_PVD_AVD_EXTI_DISABLE_RISING_EDGE();
571 __HAL_PWR_PVD_AVD_EXTI_DISABLE_FALLING_EDGE();
572
573 /* Configure the interrupt mode */
574 if (AVD_MODE_IT == (sConfigAVD->Mode & AVD_MODE_IT))
575 {
576 __HAL_PWR_PVD_AVD_EXTI_ENABLE_IT();
577 }
578
579 /* Configure the edge */
580 if (AVD_RISING_EDGE == (sConfigAVD->Mode & AVD_RISING_EDGE))
581 {
582 __HAL_PWR_PVD_AVD_EXTI_ENABLE_RISING_EDGE();
583 }
584
585 if (AVD_FALLING_EDGE == (sConfigAVD->Mode & AVD_FALLING_EDGE))
586 {
587 __HAL_PWR_PVD_AVD_EXTI_ENABLE_FALLING_EDGE();
588 }
589 }
590
591
592 /**
593 * @brief Enable the Analog Voltage Detector(AVD).
594 * @retval None
595 */
HAL_PWREx_EnableAVD(void)596 void HAL_PWREx_EnableAVD(void)
597 {
598 /* Enable the Analog Voltage Detector */
599 SET_BIT(PWR->CR1, PWR_CR1_AVDEN);
600 }
601
602 /**
603 * @brief Disable the Analog Voltage Detector(AVD).
604 * @retval None
605 */
HAL_PWREx_DisableAVD(void)606 void HAL_PWREx_DisableAVD(void)
607 {
608 /* Disable the Analog Voltage Detector */
609 CLEAR_BIT(PWR->CR1, PWR_CR1_AVDEN);
610 }
611
612
613 /**
614 * @brief This function handles the PWR PVD/AVD interrupt request.
615 * @note This API should be called under the PVD_AVD_IRQHandler().
616 * @retval None
617 */
HAL_PWREx_PVD_AVD_IRQHandler(void)618 void HAL_PWREx_PVD_AVD_IRQHandler(void)
619 {
620 /* PVD EXTI line interrupt detected */
621 if (READ_BIT(PWR->CR1, PWR_CR1_PVDEN) != RESET)
622 {
623 /* PWR PVD interrupt user callback */
624 HAL_PWR_PVDCallback();
625 }
626
627 /* AVD EXTI line interrupt detected */
628 if (READ_BIT(PWR->CR1, PWR_CR1_AVDEN) != RESET)
629 {
630 /* PWR AVD interrupt user callback */
631 HAL_PWREx_AVDCallback();
632 }
633
634 /* Clear PWR PVD AVD EXTI pending bit */
635 __HAL_PWR_PVD_AVD_EXTI_CLEAR_FLAG();
636 }
637
638 /**
639 * @brief PWR AVD interrupt callback
640 * @retval None
641 */
HAL_PWREx_AVDCallback(void)642 __weak void HAL_PWREx_AVDCallback(void)
643 {
644 /* NOTE : This function Should not be modified, when the callback is needed,
645 the HAL_PWREx_AVDCallback could be implemented in the user file
646 */
647 }
648
649
HAL_PWREx_WAKEUP_PIN_IRQHandler(void)650 void HAL_PWREx_WAKEUP_PIN_IRQHandler(void)
651 {
652
653 /* Wakeup pin EXTI line interrupt detected */
654 if (READ_BIT(PWR->WKUPFR, PWR_WKUPFR_WKUPF1) != RESET)
655 {
656 /* Clear PWR WKUPF1 flag */
657 SET_BIT(PWR->WKUPCR, PWR_WKUPCR_WKUPC1);
658
659 /* PWR WKUP1 interrupt user callback */
660 HAL_PWREx_WKUP1_Callback();
661 }
662
663 if (READ_BIT(PWR->WKUPFR, PWR_WKUPFR_WKUPF2) != RESET)
664 {
665 /* Clear PWR WKUPF2 flag */
666 SET_BIT(PWR->WKUPCR, PWR_WKUPCR_WKUPC2);
667
668 /* PWR WKUP2 interrupt user callback */
669 HAL_PWREx_WKUP2_Callback();
670 }
671
672 if (READ_BIT(PWR->WKUPFR, PWR_WKUPFR_WKUPF3) != RESET)
673 {
674 /* Clear PWR WKUPF3 flag */
675 SET_BIT(PWR->WKUPCR, PWR_WKUPCR_WKUPC3);
676
677 /* PWR WKUP3 interrupt user callback */
678 HAL_PWREx_WKUP3_Callback();
679 }
680
681 if (READ_BIT(PWR->WKUPFR, PWR_WKUPFR_WKUPF4) != RESET)
682 {
683 /* Clear PWR WKUPF4 flag */
684 SET_BIT(PWR->WKUPCR, PWR_WKUPCR_WKUPC4);
685
686 /* PWR WKUP4 interrupt user callback */
687 HAL_PWREx_WKUP4_Callback();
688 }
689
690 if (READ_BIT(PWR->WKUPFR, PWR_WKUPFR_WKUPF5) != RESET)
691 {
692 /* Clear PWR WKUPF5 flag */
693 SET_BIT(PWR->WKUPCR, PWR_WKUPCR_WKUPC5);
694
695 /* PWR WKUP5 interrupt user callback */
696 HAL_PWREx_WKUP5_Callback();
697 }
698
699 if (READ_BIT(PWR->WKUPFR, PWR_WKUPFR_WKUPF6) != RESET)
700 {
701 /* Clear PWR WKUPF6 flag */
702 SET_BIT(PWR->WKUPCR, PWR_WKUPCR_WKUPC6);
703
704 /* PWR WKUP6 interrupt user callback */
705 HAL_PWREx_WKUP6_Callback();
706 }
707
708 }
709
710 /**
711 * @brief PWR WKUP1 interrupt callback
712 * @retval None
713 */
HAL_PWREx_WKUP1_Callback(void)714 __weak void HAL_PWREx_WKUP1_Callback(void)
715 {
716 /* NOTE : This function Should not be modified, when the callback is needed,
717 the HAL_PWREx_WKUP1Callback could be implemented in the user file
718 */
719 }
720
721 /**
722 * @brief PWR WKUP2 interrupt callback
723 * @retval None
724 */
HAL_PWREx_WKUP2_Callback(void)725 __weak void HAL_PWREx_WKUP2_Callback(void)
726 {
727 /* NOTE : This function Should not be modified, when the callback is needed,
728 the HAL_PWREx_WKUP2Callback could be implemented in the user file
729 */
730 }
731
732 /**
733 * @brief PWR WKUP3 interrupt callback
734 * @retval None
735 */
HAL_PWREx_WKUP3_Callback(void)736 __weak void HAL_PWREx_WKUP3_Callback(void)
737 {
738 /* NOTE : This function Should not be modified, when the callback is needed,
739 the HAL_PWREx_WKUP3Callback could be implemented in the user file
740 */
741 }
742
743 /**
744 * @brief PWR WKUP4 interrupt callback
745 * @retval None
746 */
HAL_PWREx_WKUP4_Callback(void)747 __weak void HAL_PWREx_WKUP4_Callback(void)
748 {
749 /* NOTE : This function Should not be modified, when the callback is needed,
750 the HAL_PWREx_WKUP4Callback could be implemented in the user file
751 */
752 }
753
754 /**
755 * @brief PWR WKUP5 interrupt callback
756 * @retval None
757 */
HAL_PWREx_WKUP5_Callback(void)758 __weak void HAL_PWREx_WKUP5_Callback(void)
759 {
760 /* NOTE : This function Should not be modified, when the callback is needed,
761 the HAL_PWREx_WKUP5Callback could be implemented in the user file
762 */
763 }
764
765 /**
766 * @brief PWR WKUP6 interrupt callback
767 * @retval None
768 */
HAL_PWREx_WKUP6_Callback(void)769 __weak void HAL_PWREx_WKUP6_Callback(void)
770 {
771 /* NOTE : This function Should not be modified, when the callback is needed,
772 the HAL_PWREx_WKUP6Callback could be implemented in the user file
773 */
774 }
775
776
777 /**
778 * @}
779 */
780
781 /**
782 * @}
783 */
784
785 #endif /* HAL_PWR_MODULE_ENABLED */
786 /**
787 * @}
788 */
789
790 /**
791 * @}
792 */
793