Skip to content

Commit 69a8466

Browse files
authored
take values as references in for loop
1 parent 7c24d06 commit 69a8466

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Src/HALAL/Models/TimerPeripheral/TimerPeripheral.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void TimerPeripheral::init() {
4848
handle->Init.Prescaler = init_data.prescaler;
4949
handle->Init.CounterMode = TIM_COUNTERMODE_UP;
5050
handle->Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
51-
for (PWMData pwm_data : init_data.pwm_channels) {
51+
for (PWMData &pwm_data : init_data.pwm_channels) {
5252
if (pwm_data.mode == PHASED) {
5353
handle->Init.CounterMode = TIM_COUNTERMODE_CENTERALIGNED1;
5454
break;
@@ -91,7 +91,7 @@ void TimerPeripheral::init() {
9191
ErrorHandler("Unable to configure master synchronization on %d", name.c_str());
9292
}
9393

94-
for (pair<uint32_t, uint32_t> channels_rising_falling : init_data.input_capture_channels) {
94+
for (pair<uint32_t, uint32_t> &channels_rising_falling : init_data.input_capture_channels) {
9595
sConfigIC.ICPolarity = TIM_INPUTCHANNELPOLARITY_RISING;
9696
sConfigIC.ICPrescaler = TIM_ICPSC_DIV1;
9797
sConfigIC.ICFilter = 0;
@@ -107,7 +107,7 @@ void TimerPeripheral::init() {
107107
}
108108
}
109109

110-
for (PWMData pwm_data : init_data.pwm_channels) {
110+
for (PWMData &pwm_data : init_data.pwm_channels) {
111111
sConfigOC.OCPolarity = init_data.polarity;
112112
sConfigOC.OCNPolarity = init_data.negated_polarity;
113113
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
@@ -159,7 +159,7 @@ void TimerPeripheral::init() {
159159
}
160160

161161
void TimerPeripheral::start() {
162-
for (TimerPeripheral timer : timers) {
162+
for (TimerPeripheral &timer : timers) {
163163
if (timer.is_registered()) {
164164
timer.init();
165165
}

0 commit comments

Comments
 (0)