@@ -144,7 +144,7 @@ bool configureTimerPin(RenesasHardwareDriverParams* params, uint8_t index, bool
144
144
uint8_t timer_channel = GET_CHANNEL (pinCfgs[0 ]);
145
145
// check its not used
146
146
if (channel_used[timer_channel]) {
147
- SIMPLEFOC_DEBUG (" DRV: channel in use" );
147
+ SIMPLEFOC_DEBUG (" DRV: channel in use: " , timer_channel );
148
148
return false ;
149
149
}
150
150
@@ -258,26 +258,17 @@ bool configureTimerPin(RenesasHardwareDriverParams* params, uint8_t index, bool
258
258
t->ext_cfg .gtior_setting .gtior_b .gtiob = 0x03 | (active_high ? 0x00 : 0x10 );
259
259
t->ext_cfg .gtior_setting .gtior_b .obdflt = active_high ? 0x00 : 0x01 ;
260
260
}
261
-
262
- // lets stop the timer in case its running
263
- if (GPT_OPEN == t->ctrl .open ) {
264
- if (R_GPT_Stop (&(t->ctrl )) != FSP_SUCCESS) {
265
- SIMPLEFOC_DEBUG (" DRV: timer stop failed" );
266
- return false ;
267
- }
268
- }
269
-
270
261
memset (&(t->ctrl ), 0 , sizeof (gpt_instance_ctrl_t ));
271
262
err = R_GPT_Open (&(t->ctrl ),&(t->timer_cfg ));
272
263
if ((err != FSP_ERR_ALREADY_OPEN) && (err != FSP_SUCCESS)) {
273
264
SIMPLEFOC_DEBUG (" DRV: open failed" );
274
265
return false ;
275
266
}
276
- #if defined(SIMPLEFOC_RESENSAS_DEBUG)
277
267
if (err == FSP_ERR_ALREADY_OPEN) {
278
268
SimpleFOCDebug::println (" DRV: timer already open" );
269
+ return false ;
279
270
}
280
- # endif
271
+
281
272
err = R_GPT_PeriodSet (&(t->ctrl ), t->timer_cfg .period_counts );
282
273
if (err != FSP_SUCCESS) {
283
274
SIMPLEFOC_DEBUG (" DRV: period set failed" );
0 commit comments