summaryrefslogtreecommitdiffhomepage
path: root/analog/motor-power-avr
diff options
context:
space:
mode:
Diffstat (limited to 'analog/motor-power-avr')
-rw-r--r--analog/motor-power-avr/src/mp_pwm_LR_.h2
-rw-r--r--analog/motor-power-avr/src/mp_pwm_L_.c13
2 files changed, 4 insertions, 11 deletions
diff --git a/analog/motor-power-avr/src/mp_pwm_LR_.h b/analog/motor-power-avr/src/mp_pwm_LR_.h
index 7156dc8f..32a0f08a 100644
--- a/analog/motor-power-avr/src/mp_pwm_LR_.h
+++ b/analog/motor-power-avr/src/mp_pwm_LR_.h
@@ -102,7 +102,7 @@
// for 57.21kHz : prescaler = 0 : CSx2:0 = 0x01
// for 7.68kHz : prescaler = 8 : CSx2:0 = 0x02
#define TCCR_LR_CFG (regv (FOC0, WGM00, COM01, COM00, WGM01, CS02, CS01, CS00, \
- 0, 0, 0, 0, 0, 0, 1, 0))
+ 0, 1, 0, 0, 1, 0, 1, 0))
// timer interrupts configuration
#define TIMSK_LR_CFG (regv (OCIE2, TOIE2, TICIE1, OCIE1A, OCIE1B, TOIE1, OCIE0, TOIE0, \
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;
}
}