summaryrefslogtreecommitdiff
path: root/n/asserv/src/pwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'n/asserv/src/pwm.c')
-rw-r--r--n/asserv/src/pwm.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/n/asserv/src/pwm.c b/n/asserv/src/pwm.c
index 7979842..883201f 100644
--- a/n/asserv/src/pwm.c
+++ b/n/asserv/src/pwm.c
@@ -46,14 +46,14 @@ pwm_update (void);
static inline void
pwm_init (void)
{
- /* No timer/counter interrupt. */
- //TIMSK = 0;
- //ETIMSK = 0;
/* Phase correct PWM, TOP = 0xff, OC1B & OC1C with positive logic.
f_IO without prescaler.
Fpwm = f_IO / (2 * prescaler * TOP) = 28912 Hz. */
- TCCR1A = _BV (COM1B1) | _BV (COM1C1) | _BV (WGM10);
- TCCR1B = _BV (CS10);
+ TCCR1A =
+ regv (COM1A1, COM1A0, COM1B1, COM1B0, COM1C1, COM1C0, WGM11, WGM10,
+ 0, 0, 1, 0, 1, 0, 0, 1);
+ TCCR1B = regv (ICNC1, ICES1, 5, WGM13, WGM12, CS12, CS11, CS10,
+ 0, 0, 0, 0, 0, 0, 0, 1);
/* Enable pwm and direction outputs in DDRB. */
DDRB |= _BV (7) | _BV (6) | _BV (3) | _BV (2);
}
@@ -62,7 +62,8 @@ pwm_init (void)
static inline uint8_t
pwm_preproc (uint16_t v)
{
- v += 0x10;
+ // This is a try to correct the optocoupler problem...
+ //v += 0x10;
if (v > 255)
return 255;
else