Skip to content

Commit 51412b5

Browse files
Mathieu Choplainhenrikbrixandersen
authored andcommitted
soc: st: stm32wb0: make SMPS mode visible to drivers
Make the SMPS_MODE define visible from drivers by moving it to soc.h This define is for example used by the ADC driver to determine if sampling should be synchronized with the SMPS clock. Signed-off-by: Mathieu Choplain <[email protected]>
1 parent 4670181 commit 51412b5

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

soc/st/stm32/stm32wb0x/soc.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,9 @@ uint32_t SystemCoreClock = 16000000U;
4141
Z_GENERIC_SECTION("stm32wb0_RAM_VR")
4242
__used RAM_VR_TypeDef RAM_VR;
4343

44-
/** Power Controller node */
44+
/** Power Controller node (shorthand for upcoming macros) */
4545
#define PWRC DT_INST(0, st_stm32wb0_pwr)
4646

47-
/** SMPS modes */
48-
#define STM32WB0_SMPS_MODE_OFF 0
49-
#define STM32WB0_SMPS_MODE_PRECHARGE 1
50-
#define STM32WB0_SMPS_MODE_RUN 2
51-
52-
#define SMPS_MODE _CONCAT(STM32WB0_SMPS_MODE_, DT_STRING_UNQUOTED(PWRC, smps_mode))
53-
5447
/* Convert DTS properties to LL macros */
5548
#define SMPS_PRESCALER _CONCAT(LL_RCC_SMPS_DIV_, DT_PROP(PWRC, smps_clock_prescaler))
5649

soc/st/stm32/stm32wb0x/soc.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@
1717

1818
#include <stm32wb0x.h>
1919

20+
/** SMPS modes */
21+
#define STM32WB0_SMPS_MODE_OFF 0
22+
#define STM32WB0_SMPS_MODE_PRECHARGE 1
23+
#define STM32WB0_SMPS_MODE_RUN 2
24+
25+
/** Active SMPS mode (provided here for usage in drivers) */
26+
#define SMPS_MODE _CONCAT(STM32WB0_SMPS_MODE_, \
27+
DT_STRING_UNQUOTED( \
28+
DT_INST(0, st_stm32wb0_pwr), \
29+
smps_mode))
30+
2031
#endif /* !_ASMLANGUAGE */
2132

2233
#endif /* _STM32WB0_SOC_H_ */

0 commit comments

Comments
 (0)