#include "btn.h"
#include "rgb.h"
#include "tmr.h"
-#include "adc_random.h"
#include "task.h"
+#include "adc_random.h"
#if 0
#define AUTO_OFF_COUNT 549316UL /* 5 hrs in 32.768 ms units */
{
dbgpin_high();
on = 1;
- rgb_on();
red.value = 0;
grn.value = 0;
blu.value = 0;
wht.value = 0;
+ leds_set(red, grn, blu, wht);
+ rgb_on();
start_fade();
}
leds_set(red, grn, blu, wht);
}
-void auto_onoff_task()
+void auto_offon_task()
{
if (on) {
turnOff();
if (btn_rs() == BTN_RS_RIGHT)
- tmr_start(TMR_AUTO_OFFON, AUTO_OFF_COUNT);
+ tmr_start(TMR_AUTO_OFFON, AUTO_ON_COUNT);
} else /* off */ {
turnOn();
if (btn_rs() == BTN_RS_RIGHT)
- tmr_start(TMR_AUTO_OFFON, AUTO_ON_COUNT);
+ tmr_start(TMR_AUTO_OFFON, AUTO_OFF_COUNT);
}
}
{
task_id_t tid;
- while ((tid = task_get(block))) {
+ while ((tid = task_get(block)) >= 0) {
switch (tid) {
case TASK_BTN_PB: /* pushbutton state change */
pb_task();
start_fade();
break;
case TASK_AUTO_OFFON: /* auto on/off timer has fired */
- auto_onoff_task();
+ auto_offon_task();
break;
}
}
int main(void)
{
+ /* Platform initialization */
pic_init();
unused_init();
btn_init();