Skip to content

Commit f3d32c7

Browse files
GitHub BuildGitHub Build
authored andcommitted
Applied Formatting Changes During GitHub Build
1 parent 732c897 commit f3d32c7

12 files changed

Lines changed: 74 additions & 71 deletions

File tree

include/core/dev/Timer.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
/**
77
* If AUTO_PRESCALER is sent as a prescaler the timer will calculate its own Prescaler.
8-
* Yes, this is a negative in an uint32_t, but it ends up just causing an underflow, and making it the max of an uint32_t.
8+
* Yes, this is a negative in an uint32_t, but it ends up just causing an underflow, and making it the max of an
9+
* uint32_t.
910
*/
1011
#define AUTO_PRESCALER uint32_t(-1)
1112

include/core/dev/platform/f3xx/Timerf3xx.hpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@ class TimerF3xx : public Timer {
2424
* @param[in] timerPeripheral The timer to use
2525
* @param[in] clockPeriod the clock period in ticks (ms when using AUTO_PRESCALER). An interrupt will be triggered
2626
* at this frequency.
27-
* @param[in] configuration the configuration tells the timer how to configure itself. Defaults to @ref TimerF3xx::defaultConfig.
27+
* @param[in] configuration the configuration tells the timer how to configure itself. Defaults to @ref
28+
* TimerF3xx::defaultConfig.
2829
* @param[in] clockPrescaler the prescaler that the clock will use. If clockPrescaler is set to @ref AUTO_PRESCALER,
2930
* this function will calculate its own prescaler value.
3031
*/
31-
explicit TimerF3xx(TIM_TypeDef* timerPeripheral, uint32_t clockPeriod, const TimerConfiguration_t& configuration = defaultConfig, uint32_t clockPrescaler = AUTO_PRESCALER);
32+
explicit TimerF3xx(TIM_TypeDef* timerPeripheral, uint32_t clockPeriod,
33+
const TimerConfiguration_t& configuration = defaultConfig,
34+
uint32_t clockPrescaler = AUTO_PRESCALER);
3235

3336
/**
3437
* Starts the given timer and registers the given interrupt pointer to trigger when the timer overflows
@@ -89,15 +92,14 @@ class TimerF3xx : public Timer {
8992
* this function will calculate its own prescaler value.
9093
*/
9194
void initTimer(TIM_TypeDef* timerPeripheral, uint32_t clockPeriod, uint32_t clockPrescaler);
95+
9296
private:
93-
static constexpr TimerConfiguration_t defaultConfig = {
94-
TIM_COUNTERMODE_UP,
95-
TIM_CLOCKDIVISION_DIV1,
96-
TIM_AUTORELOAD_PRELOAD_ENABLE,
97-
TIM_CLOCKSOURCE_INTERNAL,
98-
TIM_TRGO_RESET,
99-
TIM_MASTERSLAVEMODE_DISABLE
100-
};
97+
static constexpr TimerConfiguration_t defaultConfig = {TIM_COUNTERMODE_UP,
98+
TIM_CLOCKDIVISION_DIV1,
99+
TIM_AUTORELOAD_PRELOAD_ENABLE,
100+
TIM_CLOCKSOURCE_INTERNAL,
101+
TIM_TRGO_RESET,
102+
TIM_MASTERSLAVEMODE_DISABLE};
101103
};
102104

103105
} // namespace core::dev

include/core/dev/platform/f4xx/Timerf4xx.hpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ class TimerF4xx final : public Timer {
2626
* @param[in] timerPeripheral the timer peripheral to use.
2727
* @param[in] clockPeriod the clock period in ticks (ms when using AUTO_PRESCALER). An interrupt will be triggered
2828
* at this frequency.
29-
* @param[in] configuration the configuration tells the timer how to configure itself. Defaults to @ref TimerF4xx::defaultConfig.
29+
* @param[in] configuration the configuration tells the timer how to configure itself. Defaults to @ref
30+
* TimerF4xx::defaultConfig.
3031
* @param[in] clockPrescaler the prescaler that the clock will use. If clockPrescaler is set to @ref AUTO_PRESCALER,
3132
* this function will calculate its own prescaler value.
3233
*/
33-
explicit TimerF4xx(TIM_TypeDef* timerPeripheral, uint32_t clockPeriod, const TimerConfiguration_t& configuration = defaultConfig,
34-
uint32_t clockPrescaler = AUTO_PRESCALER);
34+
explicit TimerF4xx(TIM_TypeDef* timerPeripheral, uint32_t clockPeriod,
35+
const TimerConfiguration_t& configuration = defaultConfig,
36+
uint32_t clockPrescaler = AUTO_PRESCALER);
3537

3638
/**
3739
* Starts the given timer and registers the given interrupt pointer to trigger when the timer overflows
@@ -65,6 +67,7 @@ class TimerF4xx final : public Timer {
6567
* own prescaler.
6668
*/
6769
void setPeriod(uint32_t clockPeriod, uint32_t clockPrescaler = AUTO_PRESCALER) override;
70+
6871
protected:
6972
/**
7073
* Pointer to the halTimer struct stored in the global array in Timerf4xx.cpp
@@ -91,15 +94,14 @@ class TimerF4xx final : public Timer {
9194
* this function will calculate its own prescaler value.
9295
*/
9396
void initTimer(TIM_TypeDef* timerPeripheral, uint32_t clockPeriod, uint32_t clockPrescaler);
97+
9498
private:
95-
static constexpr TimerConfiguration_t defaultConfig = {
96-
TIM_COUNTERMODE_UP,
97-
TIM_CLOCKDIVISION_DIV1,
98-
TIM_AUTORELOAD_PRELOAD_ENABLE,
99-
TIM_CLOCKSOURCE_INTERNAL,
100-
TIM_TRGO_RESET,
101-
TIM_MASTERSLAVEMODE_DISABLE
102-
};
99+
static constexpr TimerConfiguration_t defaultConfig = {TIM_COUNTERMODE_UP,
100+
TIM_CLOCKDIVISION_DIV1,
101+
TIM_AUTORELOAD_PRELOAD_ENABLE,
102+
TIM_CLOCKSOURCE_INTERNAL,
103+
TIM_TRGO_RESET,
104+
TIM_MASTERSLAVEMODE_DISABLE};
103105
};
104106
} // namespace core::dev
105107

include/core/io/platform/f3xx/PWMf3xx.hpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@ namespace core::io {
1616
class PWMf3xx : public PWM, public dev::TimerF3xx {
1717
public:
1818
/**
19-
* Set up the given pin for PWM usage.
20-
*
21-
* @param pin[in] The pin to set up for PWM
22-
*/
19+
* Set up the given pin for PWM usage.
20+
*
21+
* @param pin[in] The pin to set up for PWM
22+
*/
2323
explicit PWMf3xx(Pin pin);
2424

25-
2625
/**
2726
* Set the duty cycle for PWM
2827
* @param[in] dutyCycle The duty cycle to set PWM at.
@@ -48,15 +47,12 @@ class PWMf3xx : public PWM, public dev::TimerF3xx {
4847
uint32_t getPeriod();
4948

5049
private:
51-
static constexpr dev::TimerConfiguration_t defaultConfig = {
52-
TIM_COUNTERMODE_UP,
53-
TIM_CLOCKDIVISION_DIV1,
54-
TIM_AUTORELOAD_PRELOAD_ENABLE,
55-
TIM_CLOCKSOURCE_INTERNAL,
56-
TIM_TRGO_RESET,
57-
TIM_MASTERSLAVEMODE_DISABLE
58-
};
59-
50+
static constexpr dev::TimerConfiguration_t defaultConfig = {TIM_COUNTERMODE_UP,
51+
TIM_CLOCKDIVISION_DIV1,
52+
TIM_AUTORELOAD_PRELOAD_ENABLE,
53+
TIM_CLOCKSOURCE_INTERNAL,
54+
TIM_TRGO_RESET,
55+
TIM_MASTERSLAVEMODE_DISABLE};
6056

6157
/**
6258
* The channel that the timer will run on for this PWM instance

samples/canopen/canopen_rpdo/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ int main() {
6161

6262
// Initialize a configuration object for the timer.
6363
dev::TimerConfiguration_t configuration = {TIM_COUNTERMODE_UP,
64-
TIM_CLOCKDIVISION_DIV1,
65-
TIM_AUTORELOAD_PRELOAD_ENABLE,
66-
TIM_CLOCKSOURCE_INTERNAL,
67-
TIM_TRGO_RESET,
68-
TIM_MASTERSLAVEMODE_DISABLE};
64+
TIM_CLOCKDIVISION_DIV1,
65+
TIM_AUTORELOAD_PRELOAD_ENABLE,
66+
TIM_CLOCKSOURCE_INTERNAL,
67+
TIM_TRGO_RESET,
68+
TIM_MASTERSLAVEMODE_DISABLE};
6969

7070
// Initialize the timer
7171
dev::Timer& timer = dev::getTimer<dev::MCUTimer::Timer2>(100, configuration);

samples/canopen/canopen_sample/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ int main() {
5252

5353
// Initialize a configuration object for the timer.
5454
dev::TimerConfiguration_t configuration = {TIM_COUNTERMODE_UP,
55-
TIM_CLOCKDIVISION_DIV1,
56-
TIM_AUTORELOAD_PRELOAD_ENABLE,
57-
TIM_CLOCKSOURCE_INTERNAL,
58-
TIM_TRGO_RESET,
59-
TIM_MASTERSLAVEMODE_DISABLE};
55+
TIM_CLOCKDIVISION_DIV1,
56+
TIM_AUTORELOAD_PRELOAD_ENABLE,
57+
TIM_CLOCKSOURCE_INTERNAL,
58+
TIM_TRGO_RESET,
59+
TIM_MASTERSLAVEMODE_DISABLE};
6060

6161
// Initialize the timer
6262
dev::Timer& timer = dev::getTimer<dev::MCUTimer::Timer2>(100, configuration);

samples/canopen/canopen_tpdo/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ int main() {
7373

7474
// Initialize a configuration object for the timer.
7575
dev::TimerConfiguration_t configuration = {TIM_COUNTERMODE_UP,
76-
TIM_CLOCKDIVISION_DIV1,
77-
TIM_AUTORELOAD_PRELOAD_ENABLE,
78-
TIM_CLOCKSOURCE_INTERNAL,
79-
TIM_TRGO_RESET,
80-
TIM_MASTERSLAVEMODE_DISABLE};
76+
TIM_CLOCKDIVISION_DIV1,
77+
TIM_AUTORELOAD_PRELOAD_ENABLE,
78+
TIM_CLOCKSOURCE_INTERNAL,
79+
TIM_TRGO_RESET,
80+
TIM_MASTERSLAVEMODE_DISABLE};
8181

8282
// Initialize the timer
8383
dev::Timer& timer = dev::getTimer<dev::MCUTimer::Timer2>(100, configuration);

samples/timer/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ int main() {
4545

4646
// Initialize a configuration object for the timer.
4747
dev::TimerConfiguration_t configuration = {TIM_COUNTERMODE_UP,
48-
TIM_CLOCKDIVISION_DIV1,
49-
TIM_AUTORELOAD_PRELOAD_ENABLE,
50-
TIM_CLOCKSOURCE_INTERNAL,
51-
TIM_TRGO_RESET,
52-
TIM_MASTERSLAVEMODE_DISABLE};
48+
TIM_CLOCKDIVISION_DIV1,
49+
TIM_AUTORELOAD_PRELOAD_ENABLE,
50+
TIM_CLOCKSOURCE_INTERNAL,
51+
TIM_TRGO_RESET,
52+
TIM_MASTERSLAVEMODE_DISABLE};
5353

5454
// Set up the Timer
5555
dev::Timer& sampleTimer1 = dev::getTimer<dev::MCUTimer::Timer2>(1000, configuration);

src/core/dev/platform/f3xx/Timerf3xx.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ extern "C" void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef* htim) {
237237

238238
namespace core::dev {
239239

240-
TimerF3xx::TimerF3xx(TIM_TypeDef* timerPeripheral, const uint32_t clockPeriod, const TimerConfiguration_t& configuration, const uint32_t clockPrescaler)
240+
TimerF3xx::TimerF3xx(TIM_TypeDef* timerPeripheral, const uint32_t clockPeriod,
241+
const TimerConfiguration_t& configuration, const uint32_t clockPrescaler)
241242
: configuration(configuration) {
242243
this->halTimer = &halTimers[getTimerInterruptIndex(timerPeripheral)];
243244
initTimer(timerPeripheral, clockPeriod, clockPrescaler);
@@ -249,8 +250,8 @@ void TimerF3xx::initTimer(TIM_TypeDef* timerPeripheral, const uint32_t clockPeri
249250

250251
htim.Instance = timerPeripheral;
251252
if (clockPrescaler == AUTO_PRESCALER) {
252-
const uint32_t prescaler = HAL_RCC_GetHCLKFreq() / 1000;
253-
htim.Init.Prescaler = prescaler - 1; // Sets f_CK_PSC to 1000 Hz
253+
const uint32_t prescaler = HAL_RCC_GetHCLKFreq() / 1000;
254+
htim.Init.Prescaler = prescaler - 1; // Sets f_CK_PSC to 1000 Hz
254255
} else {
255256
htim.Init.Prescaler = clockPrescaler;
256257
}

src/core/dev/platform/f4xx/Timerf4xx.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ extern "C" void TIM5_IRQHandler(void) {
205205
}
206206

207207
namespace core::dev {
208-
TimerF4xx::TimerF4xx(TIM_TypeDef* timerPeripheral, const uint32_t clockPeriod, const TimerConfiguration_t& configuration, const uint32_t clockPrescaler)
208+
TimerF4xx::TimerF4xx(TIM_TypeDef* timerPeripheral, const uint32_t clockPeriod,
209+
const TimerConfiguration_t& configuration, const uint32_t clockPrescaler)
209210
: configuration(configuration) {
210211
this->clockPeriod = clockPeriod;
211212
this->halTimer = &halTimers[getTimerInterruptIndex(timerPeripheral)];
@@ -225,8 +226,8 @@ void TimerF4xx::initTimer(TIM_TypeDef* timerPeripheral, const uint32_t clockPeri
225226
htim.Init.AutoReloadPreload = this->configuration.autoReloadPreload;
226227

227228
if (clockPrescaler == AUTO_PRESCALER) {
228-
const uint32_t prescaler = SystemCoreClock / 1000;
229-
htim.Init.Prescaler = prescaler - 1; // Sets f_CK_PSC to 1000 Hz
229+
const uint32_t prescaler = SystemCoreClock / 1000;
230+
htim.Init.Prescaler = prescaler - 1; // Sets f_CK_PSC to 1000 Hz
230231
} else {
231232
htim.Init.Prescaler = clockPrescaler;
232233
}

0 commit comments

Comments
 (0)