Skip to content

Commit 3aca6fd

Browse files
authored
Merge pull request #2899 from TomoYamanaka/master
Fix bugs of PWM driver.
2 parents 76fb1f8 + 762d47e commit 3aca6fd

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

targets/TARGET_RENESAS/TARGET_RZ_A1H/pwmout_api.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,6 @@ void pwmout_period_us(pwmout_t* obj, int us) {
401401
if (obj->pwm >= MTU2_PWM_OFFSET) {
402402
/* PWM by MTU2 */
403403
int tmp_pwm;
404-
uint16_t tmp_tgra;
405-
uint16_t tmp_tgrc;
406404
uint8_t tmp_tcr_up;
407405
uint8_t tmp_tstr_sp;
408406
uint8_t tmp_tstr_st;
@@ -459,12 +457,10 @@ void pwmout_period_us(pwmout_t* obj, int us) {
459457
*MTU2_PWM_MATCH[tmp_pwm][MTU2_PERIOD] = (uint16_t)wk_cycle; // Set period
460458

461459
// Set duty again(TGRA)
462-
tmp_tgra = *TGRA_MATCH[obj->ch];
463-
set_mtu2_duty_again(&tmp_tgra, wk_last_cycle, wk_cycle);
460+
set_mtu2_duty_again(TGRA_MATCH[obj->ch], wk_last_cycle, wk_cycle);
464461
if ((obj->ch == 0) || (obj->ch == 3) || (obj->ch == 4)) {
465462
// Set duty again(TGRC)
466-
tmp_tgrc = *TGRC_MATCH[obj->ch];
467-
set_mtu2_duty_again(&tmp_tgrc, wk_last_cycle, wk_cycle);
463+
set_mtu2_duty_again(TGRC_MATCH[obj->ch], wk_last_cycle, wk_cycle);
468464
}
469465
*TMDR_MATCH[obj->ch] = 0x02; // PWM mode 1
470466

@@ -558,7 +554,6 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
558554
value = (float)us / (float)period_ch1;
559555
}
560556
}
561-
562-
pwmout_write(obj, value);
563557
}
558+
pwmout_write(obj, value);
564559
}

targets/TARGET_RENESAS/TARGET_VK_RZ_A1H/pwmout_api.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,6 @@ void pwmout_period_us(pwmout_t* obj, int us) {
542542
if (pwm_mode == MODE_MTU2) {
543543
/* PWM by MTU2 */
544544
int tmp_pwm;
545-
uint16_t tmp_tgra;
546-
uint16_t tmp_tgrc;
547545
uint8_t tmp_tcr_up;
548546
uint8_t tmp_tstr_sp;
549547
uint8_t tmp_tstr_st;
@@ -600,12 +598,10 @@ void pwmout_period_us(pwmout_t* obj, int us) {
600598
*MTU2_PWM_MATCH[tmp_pwm][MTU2_PERIOD] = (uint16_t)wk_cycle; // Set period
601599

602600
// Set duty again(TGRA)
603-
tmp_tgra = *TGRA_MATCH[obj->ch];
604-
set_mtu2_duty_again(&tmp_tgra, wk_last_cycle, wk_cycle);
601+
set_mtu2_duty_again(TGRA_MATCH[obj->ch], wk_last_cycle, wk_cycle);
605602
if ((obj->ch == 0) || (obj->ch == 3) || (obj->ch == 4)) {
606603
// Set duty again(TGRC)
607-
tmp_tgrc = *TGRC_MATCH[obj->ch];
608-
set_mtu2_duty_again(&tmp_tgrc, wk_last_cycle, wk_cycle);
604+
set_mtu2_duty_again(TGRC_MATCH[obj->ch], wk_last_cycle, wk_cycle);
609605
}
610606
*TMDR_MATCH[obj->ch] = 0x02; // PWM mode 1
611607

@@ -699,7 +695,6 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
699695
value = (float)us / (float)period_ch1;
700696
}
701697
}
702-
703-
pwmout_write(obj, value);
704698
}
699+
pwmout_write(obj, value);
705700
}

0 commit comments

Comments
 (0)