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.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/n/asserv/src/pwm.c b/n/asserv/src/pwm.c
index 4ab8722..a200213 100644
--- a/n/asserv/src/pwm.c
+++ b/n/asserv/src/pwm.c
@@ -44,7 +44,7 @@ static inline void
pwm_init (void);
/** Preprocess a PWM value before sending it to hardware. */
-static inline uint8_t
+static inline uint16_t
pwm_preproc (uint16_t v);
/** Update the hardware PWM values. */
@@ -62,7 +62,7 @@ pwm_init (void)
Fpwm = f_IO / (2 * prescaler * TOP) = 28912 Hz. */
TCCR1A =
regv (COM1A1, COM1A0, COM1B1, COM1B0, COM1C1, COM1C0, WGM11, WGM10,
- 0, 0, 1, 0, 1, 0, 0, 1);
+ 0, 0, 1, 0, 1, 0, 1, 0);
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. */
@@ -70,11 +70,11 @@ pwm_init (void)
}
/** Preprocess a PWM value before sending it to hardware. */
-static inline uint8_t
+static inline uint16_t
pwm_preproc (uint16_t v)
{
- if (v > 255)
- return 255;
+ if (v > 511)
+ return 511;
else
return v;
}