1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
32
33
34
35
38
39
40
41
42
43
44
45
48
49
53
54
55
58
59
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
81
82
85
86
90
93
96
97
100
101
102
103
106
107
110
111
114
115
118
119
120
123
124
127
128
129
130
131
132
133
134
135
138
141
142
143
144
145
146
147
148
149
150
151
152
153
156
157
160
161
162
163
166
167
170
171
177
178
179
184
185
188
189
192
193
194
197
198
201
202
203
204
205
206
207
208
212
213
218
222
223
228
232
233
234
235
236
237
238
239
240
241
245
246
251
255
256
261
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
284
285
290
294
295
300
304
305
306
307
308
309
310
311
312
316
317
322
326
327
332
336
337
338
339
340
341
342
343
347
348
353
357
358
363
367
368
369
370
371
372
373
374
378
379
384
388
389
394
398
399
400
401
402
403
404
405
406
410
411
416
420
421
426
430
431
432
433
434
435
436
437
438
442
443
448
452
453
458
462
463
464
465
466
467
468
469
470
474
475
480
484
485
490
494
495
496
497
498
499
500
501
502
503
504
505
509
510
511
512
513
514
515
516
517
518
519
523
528
532
533
538
542
543
548
552
553
558
562
563
568
572
573
578
582
589
593
594
601
605
606
611
615
616
617
618
619
620
621
622
623
624
628
629
636
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
742
743
748
752
753
758
762
763
768
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
829
830
831
834
835
838
839
844
848
849
854
858
859
864
868
873
877
878
883
887
888
898
899
900
910
911
912
922
927
931
932
937
941
942
952
953
956
957
958
966
967
970
971
974
975
976
977
980
981
982
983
984
985
/* ... */
#ifndef __STM32F4xx_LL_PWR_H
#define __STM32F4xx_LL_PWR_H
#ifdef __cplusplus
extern "C" {
#endif
#include "stm32f4xx.h"
/* ... */
#if defined(PWR)
/* ... */
/* ... */
/* ... */
#define LL_PWR_CR_CSBF PWR_CR_CSBF
#define LL_PWR_CR_CWUF PWR_CR_CWUF
/* ... */
/* ... */
#define LL_PWR_CSR_WUF PWR_CSR_WUF
#define LL_PWR_CSR_SBF PWR_CSR_SBF
#define LL_PWR_CSR_PVDO PWR_CSR_PVDO
#define LL_PWR_CSR_VOS PWR_CSR_VOSRDY
6 defines#if defined(PWR_CSR_EWUP)
#define LL_PWR_CSR_EWUP1 PWR_CSR_EWUP
#elif defined(PWR_CSR_EWUP1)
#define LL_PWR_CSR_EWUP1 PWR_CSR_EWUP1
#endif
#if defined(PWR_CSR_EWUP2)
#define LL_PWR_CSR_EWUP2 PWR_CSR_EWUP2
#endif
#if defined(PWR_CSR_EWUP3)
#define LL_PWR_CSR_EWUP3 PWR_CSR_EWUP3
#endif
/* ... */
/* ... */
#if defined(PWR_CR_VOS_0)
#define LL_PWR_REGU_VOLTAGE_SCALE3 (PWR_CR_VOS_0)
#define LL_PWR_REGU_VOLTAGE_SCALE2 (PWR_CR_VOS_1)
#define LL_PWR_REGU_VOLTAGE_SCALE1 (PWR_CR_VOS_0 | PWR_CR_VOS_1)
/* ... */#else
#define LL_PWR_REGU_VOLTAGE_SCALE1 (PWR_CR_VOS)
#define LL_PWR_REGU_VOLTAGE_SCALE2 0x00000000U
/* ... */#endif
/* ... */
/* ... */
#define LL_PWR_MODE_STOP_MAINREGU 0x00000000U
#define LL_PWR_MODE_STOP_LPREGU (PWR_CR_LPDS)
#if defined(PWR_CR_MRUDS) && defined(PWR_CR_LPUDS) && defined(PWR_CR_FPDS)
#define LL_PWR_MODE_STOP_MAINREGU_UNDERDRIVE (PWR_CR_MRUDS | PWR_CR_FPDS)
#define LL_PWR_MODE_STOP_LPREGU_UNDERDRIVE (PWR_CR_LPDS | PWR_CR_LPUDS | PWR_CR_FPDS)
/* ... */#endif
#if defined(PWR_CR_MRLVDS) && defined(PWR_CR_LPLVDS) && defined(PWR_CR_FPDS)
#define LL_PWR_MODE_STOP_MAINREGU_DEEPSLEEP (PWR_CR_MRLVDS | PWR_CR_FPDS)
#define LL_PWR_MODE_STOP_LPREGU_DEEPSLEEP (PWR_CR_LPDS | PWR_CR_LPLVDS | PWR_CR_FPDS)
/* ... */#endif
#define LL_PWR_MODE_STANDBY (PWR_CR_PDDS)
/* ... */
/* ... */
#define LL_PWR_REGU_DSMODE_MAIN 0x00000000U
#define LL_PWR_REGU_DSMODE_LOW_POWER (PWR_CR_LPDS)
/* ... */
/* ... */
#define LL_PWR_PVDLEVEL_0 (PWR_CR_PLS_LEV0)
#define LL_PWR_PVDLEVEL_1 (PWR_CR_PLS_LEV1)
#define LL_PWR_PVDLEVEL_2 (PWR_CR_PLS_LEV2)
#define LL_PWR_PVDLEVEL_3 (PWR_CR_PLS_LEV3)
#define LL_PWR_PVDLEVEL_4 (PWR_CR_PLS_LEV4)
#define LL_PWR_PVDLEVEL_5 (PWR_CR_PLS_LEV5)
#define LL_PWR_PVDLEVEL_6 (PWR_CR_PLS_LEV6)
#define LL_PWR_PVDLEVEL_7 (PWR_CR_PLS_LEV7)
11 defines
/* ... */
/* ... */
#if defined(PWR_CSR_EWUP)
#define LL_PWR_WAKEUP_PIN1 (PWR_CSR_EWUP)
#endif
#if defined(PWR_CSR_EWUP1)
#define LL_PWR_WAKEUP_PIN1 (PWR_CSR_EWUP1)
#endif
#if defined(PWR_CSR_EWUP2)
#define LL_PWR_WAKEUP_PIN2 (PWR_CSR_EWUP2)
#endif
#if defined(PWR_CSR_EWUP3)
#define LL_PWR_WAKEUP_PIN3 (PWR_CSR_EWUP3)
#endif
/* ... */
/* ... */
Exported constants
/* ... */
/* ... */
/* ... */
#define LL_PWR_WriteReg(__REG__, __VALUE__) WRITE_REG(PWR->__REG__, (__VALUE__))
/* ... */
#define LL_PWR_ReadReg(__REG__) READ_REG(PWR->__REG__)
/* ... */
/* ... */
Exported macro
/* ... */
/* ... */
#if defined(PWR_CR_FISSR)
/* ... */
__STATIC_INLINE void LL_PWR_EnableFLASHInterfaceSTOP(void)
{
SET_BIT(PWR->CR, PWR_CR_FISSR);
}{ ... }
/* ... */
__STATIC_INLINE void LL_PWR_DisableFLASHInterfaceSTOP(void)
{
CLEAR_BIT(PWR->CR, PWR_CR_FISSR);
}{ ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsEnabledFLASHInterfaceSTOP(void)
{
return (READ_BIT(PWR->CR, PWR_CR_FISSR) == (PWR_CR_FISSR));
}{ ... }
#endif/* ... */
#if defined(PWR_CR_FMSSR)
/* ... */
__STATIC_INLINE void LL_PWR_EnableFLASHMemorySTOP(void)
{
SET_BIT(PWR->CR, PWR_CR_FMSSR);
}{ ... }
/* ... */
__STATIC_INLINE void LL_PWR_DisableFLASHMemorySTOP(void)
{
CLEAR_BIT(PWR->CR, PWR_CR_FMSSR);
}{ ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsEnabledFLASHMemorySTOP(void)
{
return (READ_BIT(PWR->CR, PWR_CR_FMSSR) == (PWR_CR_FMSSR));
}{ ... }
#endif/* ... */
#if defined(PWR_CR_UDEN)
/* ... */
__STATIC_INLINE void LL_PWR_EnableUnderDriveMode(void)
{
SET_BIT(PWR->CR, PWR_CR_UDEN);
}LL_PWR_EnableUnderDriveMode (void) { ... }
/* ... */
__STATIC_INLINE void LL_PWR_DisableUnderDriveMode(void)
{
CLEAR_BIT(PWR->CR, PWR_CR_UDEN);
}LL_PWR_DisableUnderDriveMode (void) { ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsEnabledUnderDriveMode(void)
{
return (READ_BIT(PWR->CR, PWR_CR_UDEN) == (PWR_CR_UDEN));
}LL_PWR_IsEnabledUnderDriveMode (void) { ... }
/* ... */#endif
#if defined(PWR_CR_ODSWEN)
/* ... */
__STATIC_INLINE void LL_PWR_EnableOverDriveSwitching(void)
{
SET_BIT(PWR->CR, PWR_CR_ODSWEN);
}LL_PWR_EnableOverDriveSwitching (void) { ... }
/* ... */
__STATIC_INLINE void LL_PWR_DisableOverDriveSwitching(void)
{
CLEAR_BIT(PWR->CR, PWR_CR_ODSWEN);
}LL_PWR_DisableOverDriveSwitching (void) { ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsEnabledOverDriveSwitching(void)
{
return (READ_BIT(PWR->CR, PWR_CR_ODSWEN) == (PWR_CR_ODSWEN));
}LL_PWR_IsEnabledOverDriveSwitching (void) { ... }
/* ... */#endif
#if defined(PWR_CR_ODEN)
/* ... */
__STATIC_INLINE void LL_PWR_EnableOverDriveMode(void)
{
SET_BIT(PWR->CR, PWR_CR_ODEN);
}LL_PWR_EnableOverDriveMode (void) { ... }
/* ... */
__STATIC_INLINE void LL_PWR_DisableOverDriveMode(void)
{
CLEAR_BIT(PWR->CR, PWR_CR_ODEN);
}LL_PWR_DisableOverDriveMode (void) { ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsEnabledOverDriveMode(void)
{
return (READ_BIT(PWR->CR, PWR_CR_ODEN) == (PWR_CR_ODEN));
}LL_PWR_IsEnabledOverDriveMode (void) { ... }
/* ... */#endif
#if defined(PWR_CR_MRUDS)
/* ... */
__STATIC_INLINE void LL_PWR_EnableMainRegulatorDeepSleepUDMode(void)
{
SET_BIT(PWR->CR, PWR_CR_MRUDS);
}LL_PWR_EnableMainRegulatorDeepSleepUDMode (void) { ... }
/* ... */
__STATIC_INLINE void LL_PWR_DisableMainRegulatorDeepSleepUDMode(void)
{
CLEAR_BIT(PWR->CR, PWR_CR_MRUDS);
}LL_PWR_DisableMainRegulatorDeepSleepUDMode (void) { ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsEnabledMainRegulatorDeepSleepUDMode(void)
{
return (READ_BIT(PWR->CR, PWR_CR_MRUDS) == (PWR_CR_MRUDS));
}LL_PWR_IsEnabledMainRegulatorDeepSleepUDMode (void) { ... }
/* ... */#endif
#if defined(PWR_CR_LPUDS)
/* ... */
__STATIC_INLINE void LL_PWR_EnableLowPowerRegulatorDeepSleepUDMode(void)
{
SET_BIT(PWR->CR, PWR_CR_LPUDS);
}LL_PWR_EnableLowPowerRegulatorDeepSleepUDMode (void) { ... }
/* ... */
__STATIC_INLINE void LL_PWR_DisableLowPowerRegulatorDeepSleepUDMode(void)
{
CLEAR_BIT(PWR->CR, PWR_CR_LPUDS);
}LL_PWR_DisableLowPowerRegulatorDeepSleepUDMode (void) { ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsEnabledLowPowerRegulatorDeepSleepUDMode(void)
{
return (READ_BIT(PWR->CR, PWR_CR_LPUDS) == (PWR_CR_LPUDS));
}LL_PWR_IsEnabledLowPowerRegulatorDeepSleepUDMode (void) { ... }
/* ... */#endif
#if defined(PWR_CR_MRLVDS)
/* ... */
__STATIC_INLINE void LL_PWR_EnableMainRegulatorLowVoltageMode(void)
{
SET_BIT(PWR->CR, PWR_CR_MRLVDS);
}{ ... }
/* ... */
__STATIC_INLINE void LL_PWR_DisableMainRegulatorLowVoltageMode(void)
{
CLEAR_BIT(PWR->CR, PWR_CR_MRLVDS);
}{ ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsEnabledMainRegulatorLowVoltageMode(void)
{
return (READ_BIT(PWR->CR, PWR_CR_MRLVDS) == (PWR_CR_MRLVDS));
}{ ... }
#endif/* ... */
#if defined(PWR_CR_LPLVDS)
/* ... */
__STATIC_INLINE void LL_PWR_EnableLowPowerRegulatorLowVoltageMode(void)
{
SET_BIT(PWR->CR, PWR_CR_LPLVDS);
}{ ... }
/* ... */
__STATIC_INLINE void LL_PWR_DisableLowPowerRegulatorLowVoltageMode(void)
{
CLEAR_BIT(PWR->CR, PWR_CR_LPLVDS);
}{ ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsEnabledLowPowerRegulatorLowVoltageMode(void)
{
return (READ_BIT(PWR->CR, PWR_CR_LPLVDS) == (PWR_CR_LPLVDS));
}{ ... }
#endif/* ... */
/* ... */
__STATIC_INLINE void LL_PWR_SetRegulVoltageScaling(uint32_t VoltageScaling)
{
MODIFY_REG(PWR->CR, PWR_CR_VOS, VoltageScaling);
}{ ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_GetRegulVoltageScaling(void)
{
return (uint32_t)(READ_BIT(PWR->CR, PWR_CR_VOS));
}{ ... }
/* ... */
__STATIC_INLINE void LL_PWR_EnableFlashPowerDown(void)
{
SET_BIT(PWR->CR, PWR_CR_FPDS);
}{ ... }
/* ... */
__STATIC_INLINE void LL_PWR_DisableFlashPowerDown(void)
{
CLEAR_BIT(PWR->CR, PWR_CR_FPDS);
}{ ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsEnabledFlashPowerDown(void)
{
return (READ_BIT(PWR->CR, PWR_CR_FPDS) == (PWR_CR_FPDS));
}{ ... }
/* ... */
__STATIC_INLINE void LL_PWR_EnableBkUpAccess(void)
{
SET_BIT(PWR->CR, PWR_CR_DBP);
}{ ... }
/* ... */
__STATIC_INLINE void LL_PWR_DisableBkUpAccess(void)
{
CLEAR_BIT(PWR->CR, PWR_CR_DBP);
}{ ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsEnabledBkUpAccess(void)
{
return (READ_BIT(PWR->CR, PWR_CR_DBP) == (PWR_CR_DBP));
}{ ... }
/* ... */
__STATIC_INLINE void LL_PWR_EnableBkUpRegulator(void)
{
SET_BIT(PWR->CSR, PWR_CSR_BRE);
}{ ... }
/* ... */
__STATIC_INLINE void LL_PWR_DisableBkUpRegulator(void)
{
CLEAR_BIT(PWR->CSR, PWR_CSR_BRE);
}{ ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsEnabledBkUpRegulator(void)
{
return (READ_BIT(PWR->CSR, PWR_CSR_BRE) == (PWR_CSR_BRE));
}{ ... }
/* ... */
__STATIC_INLINE void LL_PWR_SetRegulModeDS(uint32_t RegulMode)
{
MODIFY_REG(PWR->CR, PWR_CR_LPDS, RegulMode);
}{ ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_GetRegulModeDS(void)
{
return (uint32_t)(READ_BIT(PWR->CR, PWR_CR_LPDS));
}{ ... }
/* ... */
__STATIC_INLINE void LL_PWR_SetPowerMode(uint32_t PDMode)
{
#if defined(PWR_CR_MRUDS) && defined(PWR_CR_LPUDS) && defined(PWR_CR_FPDS)
MODIFY_REG(PWR->CR, (PWR_CR_PDDS | PWR_CR_LPDS | PWR_CR_FPDS | PWR_CR_LPUDS | PWR_CR_MRUDS), PDMode);
#elif defined(PWR_CR_MRLVDS) && defined(PWR_CR_LPLVDS) && defined(PWR_CR_FPDS)
MODIFY_REG(PWR->CR, (PWR_CR_PDDS | PWR_CR_LPDS | PWR_CR_FPDS | PWR_CR_LPLVDS | PWR_CR_MRLVDS), PDMode);
#else
MODIFY_REG(PWR->CR, (PWR_CR_PDDS| PWR_CR_LPDS), PDMode);
#endif
}{ ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_GetPowerMode(void)
{
#if defined(PWR_CR_MRUDS) && defined(PWR_CR_LPUDS) && defined(PWR_CR_FPDS)
return (uint32_t)(READ_BIT(PWR->CR, (PWR_CR_PDDS | PWR_CR_LPDS | PWR_CR_FPDS | PWR_CR_LPUDS | PWR_CR_MRUDS)));
#elif defined(PWR_CR_MRLVDS) && defined(PWR_CR_LPLVDS) && defined(PWR_CR_FPDS)
return (uint32_t)(READ_BIT(PWR->CR, (PWR_CR_PDDS | PWR_CR_LPDS | PWR_CR_FPDS | PWR_CR_LPLVDS | PWR_CR_MRLVDS)));
#else
return (uint32_t)(READ_BIT(PWR->CR, (PWR_CR_PDDS| PWR_CR_LPDS)));
#endif
}{ ... }
/* ... */
__STATIC_INLINE void LL_PWR_SetPVDLevel(uint32_t PVDLevel)
{
MODIFY_REG(PWR->CR, PWR_CR_PLS, PVDLevel);
}{ ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_GetPVDLevel(void)
{
return (uint32_t)(READ_BIT(PWR->CR, PWR_CR_PLS));
}{ ... }
/* ... */
__STATIC_INLINE void LL_PWR_EnablePVD(void)
{
SET_BIT(PWR->CR, PWR_CR_PVDE);
}{ ... }
/* ... */
__STATIC_INLINE void LL_PWR_DisablePVD(void)
{
CLEAR_BIT(PWR->CR, PWR_CR_PVDE);
}{ ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsEnabledPVD(void)
{
return (READ_BIT(PWR->CR, PWR_CR_PVDE) == (PWR_CR_PVDE));
}{ ... }
/* ... */
__STATIC_INLINE void LL_PWR_EnableWakeUpPin(uint32_t WakeUpPin)
{
SET_BIT(PWR->CSR, WakeUpPin);
}{ ... }
/* ... */
__STATIC_INLINE void LL_PWR_DisableWakeUpPin(uint32_t WakeUpPin)
{
CLEAR_BIT(PWR->CSR, WakeUpPin);
}{ ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsEnabledWakeUpPin(uint32_t WakeUpPin)
{
return (READ_BIT(PWR->CSR, WakeUpPin) == (WakeUpPin));
}{ ... }
/* ... */
/* ... */
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU(void)
{
return (READ_BIT(PWR->CSR, PWR_CSR_WUF) == (PWR_CSR_WUF));
}{ ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_SB(void)
{
return (READ_BIT(PWR->CSR, PWR_CSR_SBF) == (PWR_CSR_SBF));
}{ ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_BRR(void)
{
return (READ_BIT(PWR->CSR, PWR_CSR_BRR) == (PWR_CSR_BRR));
}{ ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVDO(void)
{
return (READ_BIT(PWR->CSR, PWR_CSR_PVDO) == (PWR_CSR_PVDO));
}{ ... }
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_VOS(void)
{
return (READ_BIT(PWR->CSR, LL_PWR_CSR_VOS) == (LL_PWR_CSR_VOS));
}{ ... }
#if defined(PWR_CR_ODEN)
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_OD(void)
{
return (READ_BIT(PWR->CSR, PWR_CSR_ODRDY) == (PWR_CSR_ODRDY));
}LL_PWR_IsActiveFlag_OD (void) { ... }
/* ... */#endif
#if defined(PWR_CR_ODSWEN)
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_ODSW(void)
{
return (READ_BIT(PWR->CSR, PWR_CSR_ODSWRDY) == (PWR_CSR_ODSWRDY));
}LL_PWR_IsActiveFlag_ODSW (void) { ... }
/* ... */#endif
#if defined(PWR_CR_UDEN)
/* ... */
__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_UD(void)
{
return (READ_BIT(PWR->CSR, PWR_CSR_UDRDY) == (PWR_CSR_UDRDY));
}LL_PWR_IsActiveFlag_UD (void) { ... }
/* ... */#endif
/* ... */
__STATIC_INLINE void LL_PWR_ClearFlag_SB(void)
{
SET_BIT(PWR->CR, PWR_CR_CSBF);
}{ ... }
/* ... */
__STATIC_INLINE void LL_PWR_ClearFlag_WU(void)
{
SET_BIT(PWR->CR, PWR_CR_CWUF);
}{ ... }
#if defined(PWR_CSR_UDRDY)
/* ... */
__STATIC_INLINE void LL_PWR_ClearFlag_UD(void)
{
WRITE_REG(PWR->CSR, PWR_CSR_UDRDY);
}LL_PWR_ClearFlag_UD (void) { ... }
/* ... */#endif
/* ... */
#if defined(USE_FULL_LL_DRIVER)
/* ... */
ErrorStatus LL_PWR_DeInit(void);
/* ... */
/* ... */#endif
/* ... */
/* ... */
/* ... */
#endif
/* ... */
#ifdef __cplusplus
}extern "C" { ... }
#endif
/* ... */
#endif