aboutsummaryrefslogtreecommitdiff
path: root/kernel/rgb.c
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2011-03-13 23:50:49 +0000
committerDimitri Sokolyuk <demon@dim13.org>2011-03-13 23:50:49 +0000
commit577488e08517172c1e926b6f3fb15a4ca9f6633f (patch)
tree66b3c07488fb3b69d8088b5d9a2856582e5501a5 /kernel/rgb.c
parentb4f72c586c36539fab69a6613ff40858b501a16d (diff)
admux
Diffstat (limited to 'kernel/rgb.c')
-rw-r--r--kernel/rgb.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/kernel/rgb.c b/kernel/rgb.c
index 23e3b9f..06bd694 100644
--- a/kernel/rgb.c
+++ b/kernel/rgb.c
@@ -22,14 +22,6 @@
void hsv(uint8_t *, uint8_t *, uint8_t *, uint16_t, uint8_t, uint8_t);
-/*
-struct pwmarg pwmargs[] = {
- { &red, PB2, 0, 0 },
- { &green, PB3, 0, 0 },
- { &blue, PB4, 0, 0 },
-};
- */
-
void
rgb(void *arg)
{
@@ -57,8 +49,8 @@ cpwm(void *arg)
{
#define SCALE 4
struct pwmarg *a = (struct pwmarg *)arg;
- a->d = deadline();
- a->r = release();
+ uint32_t d = deadline();
+ uint32_t r = release();
DDRB |= _BV(a->pin);
PORTB &= ~_BV(a->pin);
@@ -66,14 +58,14 @@ cpwm(void *arg)
for (;;) {
if (*a->value > 0) {
PORTB |= _BV(a->pin);
- a->r = a->d += USEC(*a->value << SCALE);
- update(a->r, a->d);
+ r = d += USEC(*a->value << SCALE);
+ update(r, d);
}
if (*a->value < 255) {
PORTB &= ~_BV(a->pin);
- a->r = a->d += USEC((255 - *a->value) << SCALE);
- update(a->r, a->d);
+ r = d += USEC((255 - *a->value) << SCALE);
+ update(r, d);
}
}
}