]> oss.titaniummirror.com Git - rgblamp.git/blobdiff - btn.c
These changes save 685 code words
[rgblamp.git] / btn.c
diff --git a/btn.c b/btn.c
index 7b3c75e70ff4593627c05b6179340c4affe29f44..2fefcbe0c42c2b6c20619e08f5a4f11c775b330f 100644 (file)
--- a/btn.c
+++ b/btn.c
@@ -25,26 +25,59 @@ void btn_init()
   GIE = 1;             /* enable global interrupts */
 }
 
+void btn_pben()
+{
+  ndi();
+  IOCBP0 = 1; IOCBN0 = 1; IOCBF0 = 0;
+  nei();
+}
+
+/* Disable the pushbutton from user code */
+void btn_pbdis()
+{
+  ndi();
+  IOCBP0 = 0; IOCBN0 = 0; IOCBF0 = 0;
+  nei();
+}
+
+/* Enable the rocker switch from user code */
+void btn_rsen()
+{
+  ndi();
+  IOCBP4 = 1; IOCBN4 = 1; IOCBF4 = 0;
+  IOCBP5 = 1; IOCBN5 = 1; IOCBF5 = 0;
+  nei();
+}
+
+/* Disable the rocker switch from user code */
+void btn_rsdis()
+{
+  ndi();
+  IOCBP4 = 0; IOCBN4 = 0; IOCBF4 = 0;
+  IOCBP5 = 0; IOCBN5 = 0; IOCBF5 = 0;
+  nei();
+}
+
 void btn_isr()
 {
   if (IOCIF) {
     if (IOCBF0) {
-      _btn_pbdis();
-      tmr_start(TMR_BTN_PB, 1);
+      btn_pbdis();
+      tmr_start(TMR_BTN_PB, 2);
     }
     if (IOCBF4) {
-      _btn_rsdis();
-      tmr_start(TMR_BTN_RS, 1);
+      btn_rsdis();
+      tmr_start(TMR_BTN_RS, 2);
     }
     if (IOCBF5) {
-      _btn_rsdis();
-      tmr_start(TMR_BTN_RS, 1);
+      btn_rsdis();
+      tmr_start(TMR_BTN_RS, 2);
     }
   }
 
   if (tmr_fired(TMR_BTN_PB))
-    _task_post(TASK_BTN_PB);
+    task_post(TASK_BTN_PB);
   if (tmr_fired(TMR_BTN_RS))
-    _task_post(TASK_BTN_RS);
+    task_post(TASK_BTN_RS);
 }