Skip to content

Commit d41a60b

Browse files
committed
fix: astyle
1 parent e5b5e33 commit d41a60b

File tree

2 files changed

+51
-51
lines changed

2 files changed

+51
-51
lines changed

variants/STM32L4xx/L433C(B-C)(T-U)_L443CC(T-U)/variant_CYGNET.cpp

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ const PinName digitalPin[] = {
5656

5757
// Analog (Ax) to digital pin number array
5858
const uint32_t analogInputPin[] = {
59-
0, // PA0, A0
60-
1, // PA1, A1
61-
2, // PA2, A2
62-
3, // PA3, A3
63-
4, // PB1, A4
59+
0, // PA0, A0
60+
1, // PA1, A1
61+
2, // PA2, A2
62+
3, // PA3, A3
63+
4, // PB1, A4
6464
14, // PA7, A5
6565
30 // PA4, A6/BATTERY_VOLTAGE (STAT)
6666
};
@@ -194,7 +194,7 @@ WEAK void SystemClock_Config(void)
194194
* - FLASH_LATENCY: 4 (required for 80 MHz / VOS1 per RM0394 s.3.3)
195195
*/
196196
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE
197-
| RCC_OSCILLATORTYPE_MSI;
197+
| RCC_OSCILLATORTYPE_MSI;
198198
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
199199
RCC_OscInitStruct.HSIState = RCC_HSI_OFF;
200200
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
@@ -257,35 +257,35 @@ WEAK void SystemClock_Config(void)
257257
Error_Handler();
258258
}
259259

260-
/** Enable MSI Auto calibration (MSIPLLEN, RCC_CR[2])
261-
*
262-
* RM0394 s.6.2 (MSI clock): setting MSIPLLEN causes the MSI hardware
263-
* to automatically trim itself against LSE as a phase reference,
264-
* reducing MSI frequency error to < +/-0.25%. LSE must already be
265-
* stable (LSERDY=1) before the bit is set -- guaranteed here because
266-
* HAL_RCC_OscConfig() waited for LSERDY before returning.
267-
*
268-
* Setting MSIPLLEN causes MSIRDY to deassert transiently while MSI
269-
* re-synchronises to LSE. HAL_RCCEx_EnableMSIPLLMode() returns
270-
* immediately (it is a single SET_BIT); no MSIRDY wait is performed
271-
* inside it. Two conclusions follow:
272-
*
273-
* (1) This call must come AFTER any HAL routine that polls MSIRDY
274-
* under a HAL_GetTick() timeout -- if MSIRDY drops inside such
275-
* a routine, the routine returns HAL_TIMEOUT and leaves the
276-
* clock tree in an undefined state.
277-
*
278-
* (2) If SYSCLK were MSI, a deadlock would be possible: MSIRDY
279-
* drops -> SysTick stalls -> HAL_GetTick() freezes -> any
280-
* subsequent timeout loop never exits. RM0394 s.6.2.9 confirms
281-
* SysTick is driven by HCLK (= SYSCLK / AHBdiv). Because
282-
* SYSCLK is now PLLCLK (80 MHz), SysTick is completely
283-
* decoupled from MSI and the transient is harmless.
284-
*
285-
* Placement here -- after PeriphCLKConfig -- satisfies both constraints
286-
* and mirrors the ordering generated by CubeMX for the Nucleo L432KC.
287-
*/
288-
HAL_RCCEx_EnableMSIPLLMode();
260+
/** Enable MSI Auto calibration (MSIPLLEN, RCC_CR[2])
261+
*
262+
* RM0394 s.6.2 (MSI clock): setting MSIPLLEN causes the MSI hardware
263+
* to automatically trim itself against LSE as a phase reference,
264+
* reducing MSI frequency error to < +/-0.25%. LSE must already be
265+
* stable (LSERDY=1) before the bit is set -- guaranteed here because
266+
* HAL_RCC_OscConfig() waited for LSERDY before returning.
267+
*
268+
* Setting MSIPLLEN causes MSIRDY to deassert transiently while MSI
269+
* re-synchronises to LSE. HAL_RCCEx_EnableMSIPLLMode() returns
270+
* immediately (it is a single SET_BIT); no MSIRDY wait is performed
271+
* inside it. Two conclusions follow:
272+
*
273+
* (1) This call must come AFTER any HAL routine that polls MSIRDY
274+
* under a HAL_GetTick() timeout -- if MSIRDY drops inside such
275+
* a routine, the routine returns HAL_TIMEOUT and leaves the
276+
* clock tree in an undefined state.
277+
*
278+
* (2) If SYSCLK were MSI, a deadlock would be possible: MSIRDY
279+
* drops -> SysTick stalls -> HAL_GetTick() freezes -> any
280+
* subsequent timeout loop never exits. RM0394 s.6.2.9 confirms
281+
* SysTick is driven by HCLK (= SYSCLK / AHBdiv). Because
282+
* SYSCLK is now PLLCLK (80 MHz), SysTick is completely
283+
* decoupled from MSI and the transient is harmless.
284+
*
285+
* Placement here -- after PeriphCLKConfig -- satisfies both constraints
286+
* and mirrors the ordering generated by CubeMX for the Nucleo L432KC.
287+
*/
288+
HAL_RCCEx_EnableMSIPLLMode();
289289

290290
/** Ensure that MSI is wake-up system clock
291291
*

variants/STM32L4xx/L433C(B-C)(T-U)_L443CC(T-U)/variant_CYGNET.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,23 @@
100100

101101
// Macro functions for 3V3 regulator management
102102
#ifndef ENABLE_3V3_REGULATOR
103-
#define ENABLE_3V3_REGULATOR() do { \
104-
digitalWrite(DISCHARGE_3V3, DISABLE_DISCHARGING); \
105-
digitalWrite(ENABLE_3V3, HIGH); \
106-
} while (0)
103+
# define ENABLE_3V3_REGULATOR() do { \
104+
digitalWrite(DISCHARGE_3V3, DISABLE_DISCHARGING); \
105+
digitalWrite(ENABLE_3V3, HIGH); \
106+
} while (0)
107107
#endif
108108
#ifndef DISABLE_3V3_REGULATOR
109-
#define DISABLE_3V3_REGULATOR() do { \
110-
digitalWrite(ENABLE_3V3, LOW); \
111-
} while (0)
109+
# define DISABLE_3V3_REGULATOR() do { \
110+
digitalWrite(ENABLE_3V3, LOW); \
111+
} while (0)
112112
#endif
113113
#ifndef DRAIN_3V3_REGULATOR_MS
114-
#define DRAIN_3V3_REGULATOR_MS(ms) do { \
115-
if (digitalRead(ENABLE_3V3)) { break; } \
116-
digitalWrite(DISCHARGE_3V3, ENABLE_DISCHARGING); \
117-
delay(ms); \
118-
digitalWrite(DISCHARGE_3V3, DISABLE_DISCHARGING); \
119-
} while (0)
114+
# define DRAIN_3V3_REGULATOR_MS(ms) do { \
115+
if (digitalRead(ENABLE_3V3)) { break; } \
116+
digitalWrite(DISCHARGE_3V3, ENABLE_DISCHARGING); \
117+
delay(ms); \
118+
digitalWrite(DISCHARGE_3V3, DISABLE_DISCHARGING); \
119+
} while (0)
120120
#endif
121121

122122
// Dedicated board pins
@@ -127,9 +127,9 @@
127127
#define VMAIN_DIV_K ((double)((VMAIN_ADC_DIV_TOP_R + VMAIN_ADC_DIV_BOT_R) / VMAIN_ADC_DIV_BOT_R))
128128
#endif
129129
#ifndef VMAIN_MV
130-
#define VMAIN_MV() ({ \
131-
__HAL_ADC_CALC_DATA_TO_VOLTAGE(__LL_ADC_CALC_VREFANALOG_VOLTAGE(analogRead(AVREF), LL_ADC_GetResolution(ADC1)), analogRead(VMAIN_ADC), LL_ADC_GetResolution(ADC1)) * VMAIN_DIV_K; \
132-
})
130+
# define VMAIN_MV() ({ \
131+
__HAL_ADC_CALC_DATA_TO_VOLTAGE(__LL_ADC_CALC_VREFANALOG_VOLTAGE(analogRead(AVREF), LL_ADC_GetResolution(ADC1)), analogRead(VMAIN_ADC), LL_ADC_GetResolution(ADC1)) * VMAIN_DIV_K; \
132+
})
133133
#endif
134134
#ifndef CHARGE_DETECT
135135
#define CHARGE_DETECT PA15

0 commit comments

Comments
 (0)