@@ -132,7 +132,7 @@ void* _configureADCLowSide(const void* driver_params, const int pinA,const int p
132
132
Stm32CurrentSenseParams* params = new Stm32CurrentSenseParams {
133
133
.pins = { pinA, pinB, pinC },
134
134
.adc_voltage_conv = (_ADC_VOLTAGE) / (_ADC_RESOLUTION),
135
- .timer_handle = (HardwareTimer *)(HardwareTimer_Handle[ get_timer_index (TIM1)]-> __this )
135
+ .timer_handle = ((STM32DriverParams*)driver_params)-> timers_handle [ 0 ],
136
136
};
137
137
138
138
return params;
@@ -153,21 +153,21 @@ void* _driverSyncLowSide(void* _driver_params, void* _cs_params){
153
153
Stm32CurrentSenseParams* cs_params = (Stm32CurrentSenseParams*)_cs_params;
154
154
155
155
// stop all the timers for the driver
156
- _stopTimers (driver_params-> timers , 6 );
156
+ stm32_pause (driver_params);
157
157
158
158
// if timer has repetition counter - it will downsample using it
159
159
// and it does not need the software downsample
160
- if ( IS_TIM_REPETITION_COUNTER_INSTANCE (cs_params->timer_handle ->getHandle ()-> Instance ) ){
160
+ if ( IS_TIM_REPETITION_COUNTER_INSTANCE (cs_params->timer_handle ->Instance ) ){
161
161
// adjust the initial timer state such that the trigger for DMA transfer aligns with the pwm peaks instead of throughs.
162
162
// only necessary for the timers that have repetition counters
163
- cs_params->timer_handle ->getHandle ()-> Instance ->CR1 |= TIM_CR1_DIR;
164
- cs_params->timer_handle ->getHandle ()-> Instance ->CNT = cs_params->timer_handle -> getHandle () ->Instance ->ARR ;
163
+ cs_params->timer_handle ->Instance ->CR1 |= TIM_CR1_DIR;
164
+ cs_params->timer_handle ->Instance ->CNT = cs_params->timer_handle ->Instance ->ARR ;
165
165
}
166
166
// set the trigger output event
167
- LL_TIM_SetTriggerOutput (cs_params->timer_handle ->getHandle ()-> Instance , LL_TIM_TRGO_UPDATE);
167
+ LL_TIM_SetTriggerOutput (cs_params->timer_handle ->Instance , LL_TIM_TRGO_UPDATE);
168
168
169
169
// restart all the timers of the driver
170
- _startTimers (driver_params-> timers , 6 );
170
+ stm32_resume (driver_params);
171
171
172
172
// return the cs parameters
173
173
// successfully initialized
0 commit comments