a demo of GUI on DISCOF7 consisting of a few buttons and feeders
Dependencies: ADXL345 BSP_DISCO_F746NG LCD_DISCO_F746NG TS_DISCO_F746NG
Revision 4:8c94c3ee8a3a, committed 2016-08-06
- Comitter:
- habiburrahman
- Date:
- Sat Aug 06 02:58:22 2016 +0000
- Parent:
- 3:afd2bb1331a4
- Child:
- 5:bb525217a976
- Commit message:
- few cleanup
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Aug 06 02:48:56 2016 +0000
+++ b/main.cpp Sat Aug 06 02:58:22 2016 +0000
@@ -112,34 +112,37 @@
int b1cnt=0, b2cnt=0,b3cnt=0;
+
+//below are the callback functions for the buttons and feeders
+
+//callback when button1 is pressed
void button1_callback(){
- b1cnt++;
+ b1cnt++;//keeps count of number of presses
button1.update_flag = 0;
}
+//callback when button2 is pressed
void button2_callback(){
- b2cnt++;
+ b2cnt++;//keeps count of number of presses
button2.update_flag = 0;
}
+//callback when button3 is pressed
void button3_callback(){
- b3cnt++;
+ b3cnt++;//keeps count of number of presses
button3.update_flag = 0;
}
+//callback on feeder1 update
void hFeeder1_callback(){
- //lcd.SetTextColor(LCD_COLOR_RED);
- //lcd.FillRect(hFeed1pos.x, hFeed1pos.y, hFeed1pos.width, hFeed1pos.height);
- //lcd.SetTextColor(LCD_COLOR_GREEN);
- //lcd.FillRect(hFeed1pos.x, hFeed1pos.y, hFeed1.value, hFeed1pos.height);
+
hFeed1.update_flag = 0;
}
+//callback on feeder2 update
void hFeeder2_callback(){
- //lcd.SetTextColor(LCD_COLOR_RED);
- //lcd.FillRect(hFeed2pos.x, hFeed2pos.y, hFeed2pos.width, hFeed2pos.height);
- //lcd.SetTextColor(LCD_COLOR_GREEN);
- //lcd.FillRect(hFeed2pos.x, hFeed2pos.y, hFeed2.value, hFeed2pos.height);
+
+
hFeed2.update_flag = 0;
}
@@ -148,13 +151,9 @@
int main(){
-
-
-
-
uint8_t status;
- lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN DEMO", CENTER_MODE);
+ lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"WOLLONGONG UNIVERSITY", CENTER_MODE);
wait(1);
status = ts.Init(lcd.GetXSize(), lcd.GetYSize());
@@ -207,7 +206,7 @@
if(button2.update_flag) button2_callback();
if(button3.update_flag) button3_callback();
- printf("feeder values are %d,%d,%d %d,%d\r\n", b1cnt, b2cnt,b3cnt,hFeed1.value, hFeed2.value);
+ printf("GUI values are \t\t%d,%d,%d\t%d,%d\t(%d,%d)\r\n", b1cnt, b2cnt,b3cnt,hFeed1.value, hFeed2.value,TS_State.touchX[0],TS_State.touchY[0]);
//printf("feeder values are (%d,%d) %f,%f,%f %d,%d\r\n", TS_State.touchX[0],TS_State.touchY[0],button1.depressTime.read(), button2.depressTime.read(),button3.depressTime.read(),hFeed1.value, hFeed2.value);
}