Feng Hong / Mbed OS Nucleo_rtos_basic
Revision:
18:e6ed582f7022
Parent:
17:faa4d4976d22
Child:
19:0356e54240cc
diff -r faa4d4976d22 -r e6ed582f7022 yoda2.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yoda2.h	Sat Jul 20 03:57:26 2019 +0000
@@ -0,0 +1,55 @@
+#define BUTTON1_HOLD_EVENT         0x0001
+#define BUTTON1_PRESSED_EVENT       0x0002
+#define BUTTON2_HOLD_EVENT         0x0004
+#define BUTTON2_PRESSED_EVENT       0x0008
+#define BUTTON3_HOLD_EVENT         0x0010
+#define BUTTON3_PRESSED_EVENT       0x0020
+#define BUTTON4_HOLD_EVENT         0x0040
+#define BUTTON4_PRESSED_EVENT       0x0080
+#define MENU_HOLD_EVENT          BUTTON4_HOLD_EVENT
+#define MENU_PRESSED_EVENT       BUTTON4_PRESSED_EVENT
+#define ENTER_HOLD_EVENT         BUTTON3_HOLD_EVENT
+#define ENTER_PRESSED_EVENT      BUTTON3_PRESSED_EVENT
+#define LEFT_HOLD_EVENT          BUTTON2_HOLD_EVENT
+#define LEFT_PRESSED_EVENT       BUTTON2_PRESSED_EVENT
+#define RIGHT_HOLD_EVENT         BUTTON1_HOLD_EVENT
+#define RIGHT_PRESSED_EVENT      BUTTON1_PRESSED_EVENT
+#define LCD_DISPLAY_HOLD_EVENT      0x0001
+#define LCD_DISPLAY_RELEASE_EVENT   0x0002
+
+#define COMMAND_INIT  0 // all the devices return to the point 0 and return the current possition or current weight
+#define COMMAND_PLUS  1 // for the devices to plus weight return the weight
+#define COMMAND_MINUS 2 // for the devices to minus weight return the weight
+#define COMMAND_MOVE_ABSOLUTE 3 // for the devices to move to the absolute position return the current absolute position
+#define COMMAND_MOVE_RELATIVE 4 // for the devices to move relative distance return the current absolute position
+#define COMMAND_REPORT_WEIGHT 5 // for the devices to report the current weight 
+#define COMMAND_REPORT_POSITION 6 // for the devices to report the current absolute position
+#define COMMAND_CLEAN 7 // for the devices to clean the cups return done or failed
+#define COMMAND_TARE 8  // for the devices to tare the scale return done or failed
+#define COMMAND_SHAKE_CUP 9 // for the device to shake the cups return done or failed
+#define COMMAND_POUR_TEA 10 // for the device to pour the tea return done or failed
+#define COMMAND_FINISH 11   // for everything finished return done or failed
+#define COMMAND_RESET 12    // for the devices return to the point 0 and clean themselvies
+
+
+#define WEIGHT_DIFFERENCE   200   // 10g ADC value minimum difference
+#define CALIBRATION_WEIGHT  2000    // calibration weight
+#define MAXIMUM_CALIBRATION_WEIGHT  5000 
+#define MINIMUM_CALIBRATION_WEIGHT  100 
+
+enum Device_Type_d
+{
+    CupTrack=0,
+    JamTrack=1,
+    TeaTrack=2,
+    Tea=3,
+    Jam=4,
+    Shaker=5
+};
+
+struct ScaleCalibrationData {
+  unsigned int calibrationWeight;  // the weight (g) used for calibration for example 1000g or 10g. The maximum value is 3000. 
+  long offsetValue;       // the value for scale offset
+  float scaleValue;       // the ADC increment for 1g  
+  uint8_t checksum;  
+};
\ No newline at end of file