Default timer to off in setup
This commit is contained in:
@@ -37,7 +37,7 @@ void TIMER1_IRQHandler(void) {
|
||||
timer_interrupt_flag_clear(TIMER1, TIMER_INT_UP);
|
||||
// rollover turn on output if required
|
||||
if (PWMSafetyTimer && pendingPWM) {
|
||||
timer_channel_output_pulse_value_config(TIMER2, TIMER_CH_0, 80);
|
||||
timer_channel_output_pulse_value_config(TIMER2, TIMER_CH_0, 50);
|
||||
}
|
||||
if (PWMSafetyTimer) {
|
||||
PWMSafetyTimer--;
|
||||
@@ -45,7 +45,8 @@ void TIMER1_IRQHandler(void) {
|
||||
}
|
||||
if (timer_interrupt_flag_get(TIMER1, TIMER_INT_CH1) == SET) {
|
||||
timer_interrupt_flag_clear(TIMER1, TIMER_INT_CH1);
|
||||
//This is triggered on pwm setpoint trigger; we want to copy the pending PWM value into the output control reg
|
||||
// This is triggered on pwm setpoint trigger; we want to copy the pending
|
||||
// PWM value into the output control reg
|
||||
|
||||
timer_channel_output_pulse_value_config(TIMER2, TIMER_CH_0, 0);
|
||||
if (pendingPWM) {
|
||||
@@ -55,7 +56,8 @@ void TIMER1_IRQHandler(void) {
|
||||
}
|
||||
|
||||
void setTipPWM(uint8_t pulse) {
|
||||
PWMSafetyTimer = 10; // This is decremented in the handler for PWM so that the tip pwm is
|
||||
PWMSafetyTimer =
|
||||
10; // This is decremented in the handler for PWM so that the tip pwm is
|
||||
// disabled if the PID task is not scheduled often enough.
|
||||
pendingPWM = pulse;
|
||||
}
|
||||
@@ -72,7 +74,6 @@ static void switchToFastPWM(void) {
|
||||
TIMER_PSC(TIMER1) = 12000;
|
||||
/* generate an update event */
|
||||
TIMER_SWEVG(TIMER1) |= (uint32_t)TIMER_SWEVG_UPG;
|
||||
|
||||
}
|
||||
|
||||
static void switchToSlowPWM(void) {
|
||||
@@ -85,7 +86,6 @@ static void switchToSlowPWM(void) {
|
||||
TIMER_PSC(TIMER1) = 24000;
|
||||
/* generate an update event */
|
||||
TIMER_SWEVG(TIMER1) |= (uint32_t)TIMER_SWEVG_UPG;
|
||||
|
||||
}
|
||||
|
||||
bool tryBetterPWM(uint8_t pwm) {
|
||||
@@ -116,10 +116,6 @@ void EXTI5_9_IRQHandler(void) {
|
||||
}
|
||||
|
||||
// These are unused for now
|
||||
void I2C0_EV_IRQHandler(void) {
|
||||
void I2C0_EV_IRQHandler(void) {}
|
||||
|
||||
}
|
||||
|
||||
void I2C0_ER_IRQHandler(void) {
|
||||
|
||||
}
|
||||
void I2C0_ER_IRQHandler(void) {}
|
||||
|
||||
@@ -273,7 +273,7 @@ void setup_timers() {
|
||||
timer_ocintpara.ocidlestate = TIMER_OC_IDLE_STATE_LOW;
|
||||
timer_ocintpara.ocnidlestate = TIMER_OCN_IDLE_STATE_LOW;
|
||||
timer_channel_output_config(TIMER2, TIMER_CH_0, &timer_ocintpara);
|
||||
timer_channel_output_pulse_value_config(TIMER2, TIMER_CH_0, 50);
|
||||
timer_channel_output_pulse_value_config(TIMER2, TIMER_CH_0, 0);
|
||||
timer_channel_output_mode_config(TIMER2, TIMER_CH_0, TIMER_OC_MODE_PWM0);
|
||||
timer_channel_output_shadow_config(TIMER2, TIMER_CH_0,
|
||||
TIMER_OC_SHADOW_DISABLE);
|
||||
|
||||
Reference in New Issue
Block a user