User interface library for databed on HEL medical exo.

Fork of UI by Michael Ling

Revision:
6:e4bd0fd5befb
Parent:
1:7795fb7ee3f3
--- a/UserInterface.cpp	Sat Feb 14 00:36:19 2015 +0000
+++ b/UserInterface.cpp	Wed Mar 25 03:27:37 2015 +0000
@@ -2,6 +2,7 @@
 #include "MODSERIAL.h"
 #include "initDatabed.h"
 #include "UserInterface.h"
+#include "common.h"
 
 // UI button variables
 //int buttonA = 1; // state of remote button
@@ -23,7 +24,7 @@
 //int buttonB_prev = 1;
 //char __xbeeBuffer[250];
 //int _dataCnt=0;
-int UI = 0;
+UI_t UI = BUTTON_NONE;
 
 //float _time_sinceA, _time_sinceB; //time since the button was first pressed
 
@@ -158,9 +159,9 @@
 
         if((_time_pressA-_time_sinceA) >= _tRelease) { //button was released
             if(_time_pressA-_tRelease >= _tHold) { //if the button was held before released
-                UI = 3; //UI command is a held A button
+                UI = BUTTON_A_HOLD; //UI command is a held A button
             } else {
-                UI = 1; //UI command is a pressed A button
+                UI = BUTTON_A_PRESS; //UI command is a pressed A button
             }
             _buttonA = 1; //button A is released
             _time_pressA.stop(); //reset the button A timer
@@ -168,9 +169,9 @@
         }
         if(_time_pressB-_time_sinceB >= _tRelease) { //button was released
             if(_time_pressB-_tRelease >= _tHold) { //if the button was held before released
-                UI = 4; //UI command is a held B button
+                UI = BUTTON_B_HOLD; //UI command is a held B button
             } else {
-                UI = 2; //UI command is a pressed B button
+                UI = BUTTON_B_PRESS; //UI command is a pressed B button
             }
             _buttonB = 1; //button B is released
             _time_pressB.stop(); //reset the button B timer
@@ -222,9 +223,9 @@
     }
     if((time_pressA-_time_sinceA)>=tRelease) { //button was released
         if(time_pressA-tRelease>=tHold) { //if the button was held before released
-            UI=3; //UI command is a held A button
+            UI=BUTTON_A_HOLD; //UI command is a held A button
         } else {
-            UI=1; //UI command is a pressed A button
+            UI=BUTTON_A_PRESS; //UI command is a pressed A button
         }
         buttonA=1; //button A is released
         time_pressA.stop(); //reset the button A timer
@@ -232,9 +233,9 @@
     }
     if(time_pressB-_time_sinceB>=tRelease) { //button was released
         if(time_pressB-tRelease>=tHold) { //if the button was held before released
-            UI=4; //UI command is a held B button
+            UI=BUTTON_B_HOLD; //UI command is a held B button
         } else {
-            UI=2; //UI command is a pressed B button
+            UI=BUTTON_B_PRESS; //UI command is a pressed B button
         }
         buttonB=1; //button B is released
         time_pressB.stop(); //reset the button B timer