]> oss.titaniummirror.com Git - rgblamp.git/commitdiff
Update comments
authorR. Steve McKown <rsmckown@gmail.com>
Fri, 9 Mar 2012 22:13:10 +0000 (15:13 -0700)
committerR. Steve McKown <rsmckown@gmail.com>
Sat, 10 Mar 2012 02:45:27 +0000 (19:45 -0700)
isr.c
lfsr.c
main.c
task.c
task_defs.h
tmr_defs.h

diff --git a/isr.c b/isr.c
index 42bed029e515605bbb56497dd1f1773572d24f8a..e38894769068eb16b68e69be0399e4a83051e45d 100644 (file)
--- 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 492f3c6404ee768536ef8ab4d6084e05f054c142..df1fe31e796fd05f44fde1e1466fdef89a841f34 100644 (file)
--- a/lfsr.c
+++ b/lfsr.c
  * 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 <rsmckown@gmail.com>
  */
diff --git a/main.c b/main.c
index 0ca9cdc69c1983806c766eecfb6a3293f75b5d6c..6eaf3d77159fdcfe566e85dbf2f7b2ec06a77aa1 100644 (file)
--- 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 ee4ed5b14cad380005a7cbf656d3859715b643c8..eb11d8c2eb3644c26ee7af79d5a7782e444531d2 100644 (file)
--- 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.
  */
 
 
index 8de6f9b7cf21a6edb33d36f385872bd8c9e31a8c..9d7e59c927c6876d7b886a57059be2eeb42a8002 100644 (file)
  * _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
 };
index 8c9be339ed022e7f59d2e8aafddef61d19f8d253..ba0b64bccbf892914e2a7893016317bbffe82a6a 100644 (file)
  * 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