Touch-screen demo.
Dependencies: BSP_DISCO_F413ZH mbed
Revision 2:c2b426147ff0, committed 2017-09-26
- Comitter:
- bcostm
- Date:
- Tue Sep 26 14:09:55 2017 +0000
- Parent:
- 1:f7e5a57cb46f
- Commit message:
- Add mbed library v151
Changed in this revision
diff -r f7e5a57cb46f -r c2b426147ff0 BSP_DISCO_F413ZH.lib --- a/BSP_DISCO_F413ZH.lib Mon May 22 10:34:06 2017 +0200 +++ b/BSP_DISCO_F413ZH.lib Tue Sep 26 14:09:55 2017 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/ST/code/BSP_DISCO_F413ZH/#a3f6b8b5a6bf \ No newline at end of file +https://developer.mbed.org/teams/ST/code/BSP_DISCO_F413ZH/#0f07a9ac06f7
diff -r f7e5a57cb46f -r c2b426147ff0 main.cpp --- a/main.cpp Mon May 22 10:34:06 2017 +0200 +++ b/main.cpp Tue Sep 26 14:09:55 2017 +0000 @@ -2,23 +2,23 @@ #include "stm32f413h_discovery.h" #include "stm32f413h_discovery_ts.h" #include "stm32f413h_discovery_lcd.h" - + TS_StateTypeDef TS_State = {0}; - + int main() { uint16_t x1, y1; - + BSP_LCD_Init(); - + /* Touchscreen initialization */ if (BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize()) == TS_ERROR) { printf("BSP_TS_Init error\n"); } - + /* Clear the LCD */ BSP_LCD_Clear(LCD_COLOR_WHITE); - + /* Set Touchscreen Demo1 description */ BSP_LCD_SetTextColor(LCD_COLOR_GREEN); BSP_LCD_FillRect(0, 0, BSP_LCD_GetXSize(), 40); @@ -26,21 +26,21 @@ BSP_LCD_SetBackColor(LCD_COLOR_GREEN); BSP_LCD_SetFont(&Font16); BSP_LCD_DisplayStringAt(0, 15, (uint8_t *)"Touch the screen", CENTER_MODE); - + while (1) { BSP_TS_GetState(&TS_State); if(TS_State.touchDetected) { /* One or dual touch have been detected */ - + /* Get X and Y position of the first touch post calibrated */ x1 = TS_State.touchX[0]; y1 = TS_State.touchY[0]; printf("Touch Detected x=%d y=%d\n", x1, y1); - + BSP_LCD_SetTextColor(LCD_COLOR_GREEN); BSP_LCD_FillCircle(x1, y1, 20); - + wait_ms(10); } } -} \ No newline at end of file +}
diff -r f7e5a57cb46f -r c2b426147ff0 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Sep 26 14:09:55 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/675da3299148 \ No newline at end of file