static void rpp_hdr_reset()
{
#if rppCONFIG_DRV == 1
- hbr_set_en(LOW);
- hbr_pwm_set_duty(0);
- hbr_pwm_stop();
- hbr_set_dir(LOW);
+ drv_hbr_set_en(LOW);
+ drv_hbr_pwm_set_duty(0);
+ drv_hbr_pwm_stop();
+ drv_hbr_set_dir(LOW);
#endif
}
}
#if rppCONFIG_DRV == 1
- hbr_pwm_set_signal(period, 0);
+ // Configure H-Bridge
+ drv_hbr_pwm_set_signal(period, 0);
rpp_hdr_reset();
- // FIXME enable watchdog task
+ // Start watchdog
+ if(drv_hbr_wdg_start() != SUCCESS) {
+ return FAILURE;
+ }
#endif
enabled = TRUE;
/// Enabled, configure
// Set direction
if(scaled < 0) {
- hbr_set_dir(LOW);
+ drv_hbr_set_dir(LOW);
} else {
- hbr_set_dir(HIGH);
+ drv_hbr_set_dir(HIGH);
}
// Set PWM duty cycle
- hbr_pwm_set_duty(abs(scaled));
- hbr_pwm_start();
+ drv_hbr_pwm_set_duty(abs(scaled));
+ drv_hbr_pwm_start();
// Enable H-Bridge
- hbr_set_en(HIGH);
+ drv_hbr_set_en(HIGH);
#endif
return SUCCESS;
return FAILURE;
}
+ #if rppCONFIG_DRV == 1
+ // We ignore is watchdog could not be stopped, because is harmless.
+ // It would be worse if we just could not stop the H-Bridge just because
+ // the watchdog could not be stopped.
+ drv_hbr_wdg_stop();
+ #endif
+
rpp_hdr_reset();
enabled = FALSE;