
bla
Dependencies: BSP_DISCO_F769NI
Revision 1:361238d5a1bc, committed 2017-05-28
- Comitter:
- joschaihl
- Date:
- Sun May 28 00:08:54 2017 +0000
- Parent:
- 0:2e946c38e476
- Child:
- 2:6a613cb4b302
- Commit message:
- Test
Changed in this revision
BSP_DISCO_F769NI.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BSP_DISCO_F769NI.lib Sun May 28 00:08:54 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/teams/ST/code/BSP_DISCO_F769NI/#39d2c2c79afa
--- a/main.cpp Sat May 20 11:27:31 2017 +0000 +++ b/main.cpp Sun May 28 00:08:54 2017 +0000 @@ -1,5 +1,9 @@ #include "mbed.h" -#include "rtos.h" +#include "stm32f769i_discovery.h" +#include "stm32f769i_discovery_ts.h" +#include "stm32f769i_discovery_lcd.h" +TS_StateTypeDef TS_State = {0}; + Serial pc(USBTX, USBRX); @@ -20,18 +24,58 @@ } } +void gui_thread() { + uint16_t x1, y1; + BSP_LCD_Init(); + BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS); + + /* 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_BLUE); + BSP_LCD_FillRect(0, 0, BSP_LCD_GetXSize(), 40); + BSP_LCD_SetTextColor(LCD_COLOR_WHITE); + BSP_LCD_SetBackColor(LCD_COLOR_BLUE); + BSP_LCD_SetFont(&Font24); + BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"Touchscreen basic example", 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\r\n", x1, y1); + + BSP_LCD_SetTextColor(LCD_COLOR_BLUE); + BSP_LCD_FillCircle(x1, y1, 20); + + Thread::wait(10); + } + } +} + int main() { pc.baud(115200*2); pc.printf("*** Joscha ***\r\n"); - Thread t1(osPriorityNormal), t2(osPriorityNormal); + Thread printThread(osPriorityNormal), ledThread(osPriorityNormal), guiThread(osPriorityNormal); - t1.start(print_thread); - t2.start(led_thread); - while (true) { - pc.printf("\n\n*** RTOS basic example ***\r\n"); + printThread.start(print_thread); + ledThread.start(led_thread); + guiThread.start(&gui_thread); + + while(1) { + } - Thread::wait(500); - } + }