summaryrefslogtreecommitdiffhomepage
path: root/analog/motor-power-avr/src/mp_pwm_LR_.h
diff options
context:
space:
mode:
authorPierre Prot2008-02-09 16:44:52 +0100
committerPierre Prot2008-02-09 16:44:52 +0100
commitcd847e2f5a58d43df13c434ce7571be5488082ed (patch)
tree014e2098758c31148791f3d0697d5fff195c289f /analog/motor-power-avr/src/mp_pwm_LR_.h
parent792161793c7ebed6e8ba46e0c080b495289bb272 (diff)
Param├ętrage des timers
- PWM - Gestion du Vref pour la limitation de courant
Diffstat (limited to 'analog/motor-power-avr/src/mp_pwm_LR_.h')
-rw-r--r--analog/motor-power-avr/src/mp_pwm_LR_.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/analog/motor-power-avr/src/mp_pwm_LR_.h b/analog/motor-power-avr/src/mp_pwm_LR_.h
index 62ffdc28..e7018918 100644
--- a/analog/motor-power-avr/src/mp_pwm_LR_.h
+++ b/analog/motor-power-avr/src/mp_pwm_LR_.h
@@ -71,17 +71,23 @@
// timer configuration
// for 57.21kHz : prescaler = 0 : CSx2:0 = 0x01
// for 7.68kHz : prescaler = 8 : CSx2:0 = 0x02
-#define TCCR_CFG (regv (FOC0, WGM00, COM01, COM00, WGM01, CS02, CS01, CS00, \
- 0, 0, 0, 0, 0, 0, 1, 0))
+#define TCCR_LR_CFG (regv (FOC0, WGM00, COM01, COM00, WGM01, CS02, CS01, CS00, \
+ 0, 0, 0, 0, 0, 0, 1, 0))
// timer interrupts configuration
-#define TIMSK (regv (OCIE2
+#define TIMSK_LR_CFG (regv (OCIE2, TOIE2, TICIE1, OCIE1A, OCIE1B, OCIE0, TOIE0,\
+ 1, 1, 0, 0, 0, 1, 1))
// PWM max, min, and offset values
#define PWM_MIN_LR_ 0x10
#define PWM_MAX_LR_ 0xF0
#define PWM_OFFSET_LR_ 0x00
+// Current limitation
+#define CURLIM_MAX 0x80
+#define OCR_CurLim_L_ OCR1A
+#define OCR_CurLim_R_ OCR1B
+
// functions
void init_timer_LR_(void);
void init_curLim (void);