aboutsummaryrefslogtreecommitdiff
path: root/kernel/rgb.c
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2012-02-23 15:08:01 +0000
committerDimitri Sokolyuk <demon@dim13.org>2012-02-23 15:08:01 +0000
commit26efb8f08eb1c38ce2d09b87fb5465324033b896 (patch)
tree0927ea097af9c13f9ee57f4b60e506aa38380b8e /kernel/rgb.c
parent2acb123fbf5dadf743db122e26fb96da4a58a84c (diff)
back to monotone time
new sleep() function
Diffstat (limited to 'kernel/rgb.c')
-rw-r--r--kernel/rgb.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/kernel/rgb.c b/kernel/rgb.c
index 0f9b482..a98d4b2 100644
--- a/kernel/rgb.c
+++ b/kernel/rgb.c
@@ -42,7 +42,7 @@ rgb(void *arg)
v = *a->v; /* 10bit to 8bit */
sei();
- sleep(MSEC(40));
+ sleep(0, 40000);
}
}
@@ -51,28 +51,25 @@ pwm(void *arg)
{
struct pwmarg *a = (struct pwmarg *)arg;
uint32_t t;
- uint8_t v;
DDRB |= _BV(a->pin);
PORTB &= ~_BV(a->pin);
-#define DIV (UINT8_MAX >> 1)
-
for (;;) {
cli();
- v = *a->value;
+ t = *a->value;
sei();
/* on */
- if ((t = SEC2(v) / DIV)) {
+ if (t) {
PORTB |= _BV(a->pin);
- sleep(t);
+ sleep(0, t * 80);
}
/* off */
- if ((t = SEC2(UINT8_MAX - v) / DIV)) {
+ if ((t = UINT8_MAX - t)) {
PORTB &= ~_BV(a->pin);
- sleep(t);
+ sleep(0, t * 80);
}
}
}