User interface library for databed on HEL medical exo.

Fork of UI by Michael Ling

Files at this revision

API Documentation at this revision

Comitter:
nathanhonka
Date:
Wed Mar 25 03:27:37 2015 +0000
Parent:
1:7795fb7ee3f3
Commit message:
1) Add UI command type-checking.; 2) Create common.h, a common location for shared defintions between; Motion-Control and Data-Management projects (including recently defined; UI command type & members).

Changed in this revision

UserInterface.cpp Show annotated file Show diff for this revision Revisions of this file
UserInterface.h Show annotated file Show diff for this revision Revisions of this file
diff -r 7795fb7ee3f3 -r e4bd0fd5befb UserInterface.cpp
--- 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
diff -r 7795fb7ee3f3 -r e4bd0fd5befb UserInterface.h
--- a/UserInterface.h	Sat Feb 14 00:36:19 2015 +0000
+++ b/UserInterface.h	Wed Mar 25 03:27:37 2015 +0000
@@ -13,7 +13,9 @@
 #include "mbed.h"
 #include "MODSERIAL.h"
 #include "initDatabed.h"
-extern int UI;
+#include "common.h"
+
+extern UI_t UI;
 class UserInterface
 {
 public: