Skip to content

Commit 7499e30

Browse files
author
Richard Unger
committed
renesas driver improvements
1 parent a373714 commit 7499e30

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/drivers/hardware_specific/renesas/renesas.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ bool configureTimerPin(RenesasHardwareDriverParams* params, uint8_t index, bool
144144
uint8_t timer_channel = GET_CHANNEL(pinCfgs[0]);
145145
// check its not used
146146
if (channel_used[timer_channel]) {
147-
SIMPLEFOC_DEBUG("DRV: channel in use");
147+
SIMPLEFOC_DEBUG("DRV: channel in use: ", timer_channel);
148148
return false;
149149
}
150150

@@ -258,26 +258,17 @@ bool configureTimerPin(RenesasHardwareDriverParams* params, uint8_t index, bool
258258
t->ext_cfg.gtior_setting.gtior_b.gtiob = 0x03 | (active_high ? 0x00 : 0x10);
259259
t->ext_cfg.gtior_setting.gtior_b.obdflt = active_high ? 0x00 : 0x01;
260260
}
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-
270261
memset(&(t->ctrl), 0, sizeof(gpt_instance_ctrl_t));
271262
err = R_GPT_Open(&(t->ctrl),&(t->timer_cfg));
272263
if ((err != FSP_ERR_ALREADY_OPEN) && (err != FSP_SUCCESS)) {
273264
SIMPLEFOC_DEBUG("DRV: open failed");
274265
return false;
275266
}
276-
#if defined(SIMPLEFOC_RESENSAS_DEBUG)
277267
if (err == FSP_ERR_ALREADY_OPEN) {
278268
SimpleFOCDebug::println("DRV: timer already open");
269+
return false;
279270
}
280-
#endif
271+
281272
err = R_GPT_PeriodSet(&(t->ctrl), t->timer_cfg.period_counts);
282273
if (err != FSP_SUCCESS) {
283274
SIMPLEFOC_DEBUG("DRV: period set failed");

0 commit comments

Comments
 (0)