From f7fae2bd36a4187bc5b0954253466844c2f4ee2b Mon Sep 17 00:00:00 2001 From: "R. Steve McKown" Date: Fri, 9 Mar 2012 15:13:10 -0700 Subject: [PATCH] Update comments --- isr.c | 3 +++ lfsr.c | 8 +------- main.c | 24 ++++++++++++------------ task.c | 4 +--- task_defs.h | 16 ++++++++-------- tmr_defs.h | 17 +++++++++++------ 6 files changed, 36 insertions(+), 36 deletions(-) diff --git a/isr.c b/isr.c index 42bed02..e388947 100644 --- a/isr.c +++ b/isr.c @@ -58,6 +58,9 @@ void nei() ei(); } +/* Application specific interrupt handler. List the isr functions for all + * modules used, plus any additional application specific ISR processing. + */ void interrupt isr() { tmr_isr(); diff --git a/lfsr.c b/lfsr.c index 492f3c6..df1fe31 100644 --- a/lfsr.c +++ b/lfsr.c @@ -37,13 +37,7 @@ * This is a small, fast and efficient software implementation of a 16-bit * Linear Feedback Shift Register (LFSR). It uses the Galois method to perform * the exclusive OR operations in parallel for improved performance over the - * standard, or Fibonacci, method. The algorithm also skips the exlusive or - * operations if it doesn't need to do them, though on this uC the branch may - * not generate a net performance increase over doing the exclusive or - * operations every time. - * - * After rng returns, RNGLO and RNGHI contain the updated 16-bit random number. - * RNGLO will contain a value $01-$FF, RNGHI will contain $00-$FF. + * standard, or Fibonacci, method. * * @author R. Steve McKown */ diff --git a/main.c b/main.c index 0ca9cdc..6eaf3d7 100644 --- a/main.c +++ b/main.c @@ -109,8 +109,8 @@ enum { BRIGHT_BOTTOM = -5, /* ... then down to bottom */ BRIGHT_MAX = 85, /* Bright values are constrained for computations */ BRIGHT_MIN = 1, /* ... by min and max. */ - BRIGHT_INIT = 42, /* later, get from eeprom */ - CBRIGHT_VARIANCE = 20, /* brightness range for candle flicker */ + BRIGHT_INIT = 42, /* Initial value is replaced by value from eeprom */ + CBRIGHT_VARIANCE = 20, /* Brightness range for candle flicker */ STD_FADE = 16, /* Fade time in 32.768 ms units */ STD_INCOLOR = 29491, /* Time in color when MODE_CYCLE, in 32.768 ms units */ PARTY_MIN = 8, /* Min party fade and incolor units */ @@ -272,9 +272,9 @@ void turnOn() btn_pben(); } +/* Event on to off, either by switch or auto-off timer */ void turnOff() { - /* Event on to off, either by switch or auto-off timer */ tmr_stop(TMR_CFG); tmr_stop(TMR_CANDLE); tmr_stop(TMR_INCOLOR); @@ -304,9 +304,9 @@ void pb_clicked() } } +/* The button is being held. Change the color magnitude. */ void pb_held() { - /* The button has been held. Change the color magnitude. */ if (bright_up) { if (bright == BRIGHT_TOP) bright_up = 0; @@ -444,28 +444,28 @@ void user_tasks(unsigned char block) while ((tid = task_get(block)) >= 0) { switch (tid) { - case TASK_BTN_PB: /* pushbutton state change */ + case TASK_BTN_PB: pb_task(); break; - case TASK_BTN_RS: /* rocker switch state change */ + case TASK_BTN_RS: rs_task(); break; - case TASK_BTN_PB_HELD: /* pushbutton is being held down */ + case TASK_BTN_PB_HELD: pb_held_task(); break; - case TASK_FADE: /* fade timer has fired */ + case TASK_FADE: fade_task(); break; - case TASK_INCOLOR: /* in-color timer has fired */ + case TASK_INCOLOR: start_fade(); break; - case TASK_CANDLE: /* periodic adjustment for candle flicker */ + case TASK_CANDLE: candle_task(); break; - case TASK_TMR32: /* auto on/off event */ + case TASK_TMR32: auto_offon_task(); break; - case TASK_CFG: /* Save config to EEPROM event */ + case TASK_CFG: cfg_write(); break; } diff --git a/task.c b/task.c index ee4ed5b..eb11d8c 100644 --- a/task.c +++ b/task.c @@ -30,9 +30,7 @@ /* * File: task.c * - * Generic timer module. Currently uses Timer0 to generate ticks every - * 32 ms. Later will use Timer1, a crystal, and optionally a compare - * module to be able to generate ticks and wake up from sleep. + * Generic task module. */ diff --git a/task_defs.h b/task_defs.h index 8de6f9b..9d7e59c 100644 --- a/task_defs.h +++ b/task_defs.h @@ -46,14 +46,14 @@ * _task_ids variable in task.c. */ enum { - TASK_BTN_PB = 0, - TASK_BTN_RS, - TASK_BTN_PB_HELD, - TASK_FADE, - TASK_INCOLOR, - TASK_TMR32, - TASK_CANDLE, - TASK_CFG, + TASK_BTN_PB = 0, /* Pushbutton state change */ + TASK_BTN_RS, /* Rocker switch state change */ + TASK_BTN_PB_HELD, /* Pushbutton is being held down */ + TASK_FADE, /* Fade timer has fired */ + TASK_INCOLOR, /* In-color timer has fired */ + TASK_TMR32, /* Auto on/off event */ + TASK_CANDLE, /* Periodic adjustment for candle flicker */ + TASK_CFG, /* Save config to EEPROM event */ TASK_COUNT }; diff --git a/tmr_defs.h b/tmr_defs.h index 8c9be33..ba0b64b 100644 --- a/tmr_defs.h +++ b/tmr_defs.h @@ -43,12 +43,17 @@ * accordingly. */ enum { - TMR_BTN_PB = 0, - TMR_BTN_RS, - TMR_BTN_PB_HELD, - TMR_FADE, - TMR_INCOLOR, - TMR_CANDLE, + TMR_BTN_PB = 0, /* Pushbutton debounce */ + TMR_BTN_RS, /* Rocker switch debounce */ + TMR_BTN_PB_HELD, /* Time elapsed determines clicked vs held */ + TMR_FADE, /* Time between fade iterations */ + TMR_INCOLOR, /* Time a given color remains active (no fade) */ + TMR_CANDLE, /* Time between candle variations */ + + /* Time expired before a changed configuration is written. In this way, + * several changes to the configuration within TMR_CFG time generate a + * single EEPROM write. + */ TMR_CFG, TMR_COUNT -- 2.39.2