From 85c7e5bfab12e1c5a5e9cc2b5a2cac1f3acf0814 Mon Sep 17 00:00:00 2001 From: Guillaume Chevillot Date: Mon, 10 Mar 2008 21:15:02 +0100 Subject: Use of "Fast PWM" mode rather than "normal" mode for PWM timers --- analog/motor-power-avr/src/mp_pwm_L_.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'analog/motor-power-avr/src/mp_pwm_L_.c') diff --git a/analog/motor-power-avr/src/mp_pwm_L_.c b/analog/motor-power-avr/src/mp_pwm_L_.c index 31d1235e..2ad3e329 100644 --- a/analog/motor-power-avr/src/mp_pwm_L_.c +++ b/analog/motor-power-avr/src/mp_pwm_L_.c @@ -10,7 +10,6 @@ // static variables static uint8_t state_L_; static uint8_t state_L_cmd; -static uint8_t pwm_L_; // Le PC, afin de faire le saut calculé //#define PC PC_REG @@ -18,7 +17,7 @@ static uint8_t pwm_L_; // init void init_pwm_L_ (void) { state_L_cmd = CMD_STATE_HIGH_Z; - pwm_L_ = 0x00; + OCR_L_ = 0x00; // Set outputs to 0 (ie HIGH_Z) _L_AL_0; @@ -39,11 +38,6 @@ ISR(OVF_L_vect) { // programs the state which is ordered by the core code state_L_ = state_L_cmd; - // the falling of the other side may have delayed a few our IT - OCR_L_ = pwm_L_; - - //PC = PC + state_L_; // j'aurais bien aimé faire un calculated jump - switch (state_L_) { case CMD_STATE_DIR_0: @@ -112,7 +106,6 @@ ISR(OVF_L_vect) { // PWM falling edge on timer compare IT ISR(COMP_L_vect) { - // PC = PC + state_L_; TODO :saut calculé ? switch (state_L_) { @@ -185,7 +178,7 @@ void start_motor_L_ (uint8_t pwmspeed, uint8_t direction) { if (pwmspeed == 0) {// brake state_L_cmd = CMD_STATE_BRAKE; - pwm_L_ = 0; + OCR_L_ = 0; } else { @@ -196,7 +189,7 @@ void start_motor_L_ (uint8_t pwmspeed, uint8_t direction) { UTILS_BOUND(pwmspeed, PWM_MIN_LR_, PWM_MAX_LR_); // Apply the value - pwm_L_ = pwmspeed; + OCR_L_ = pwmspeed; } } -- cgit v1.2.3