
fgdfg
Dependencies: BSP_DISCO_F746NG
Revision 0:14a394d21b72, committed 2020-06-07
- Comitter:
- amiradmin
- Date:
- Sun Jun 07 11:47:58 2020 +0000
- Commit message:
- TEst
Changed in this revision
diff -r 000000000000 -r 14a394d21b72 .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Sun Jun 07 11:47:58 2020 +0000 @@ -0,0 +1,2 @@ +BUILD +mbed-os/
diff -r 000000000000 -r 14a394d21b72 BSP_DISCO_F746NG.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BSP_DISCO_F746NG.lib Sun Jun 07 11:47:58 2020 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/teams/ST/code/BSP_DISCO_F746NG/#85dbcff443aa
diff -r 000000000000 -r 14a394d21b72 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Jun 07 11:47:58 2020 +0000 @@ -0,0 +1,74 @@ +#include "mbed.h" +#include "stm32746g_discovery_lcd.h" +#include "stm32746g_discovery_ts.h" + +int main() +{ + TS_StateTypeDef TS_State; + uint16_t x, y; + uint8_t text[30]; + uint8_t status; + uint8_t idx; + uint8_t cleared = 0; + uint8_t prev_nb_touches = 0; + + BSP_LCD_Init(); + BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS); + BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER); + + BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN DEMO", CENTER_MODE); + HAL_Delay(1000); + + status = BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize()); + if (status != TS_OK) { + BSP_LCD_Clear(LCD_COLOR_RED); + BSP_LCD_SetBackColor(LCD_COLOR_RED); + BSP_LCD_SetTextColor(LCD_COLOR_WHITE); + BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT FAIL", CENTER_MODE); + } else { + BSP_LCD_Clear(LCD_COLOR_GREEN); + BSP_LCD_SetBackColor(LCD_COLOR_GREEN); + BSP_LCD_SetTextColor(LCD_COLOR_WHITE); + BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT OK", CENTER_MODE); + } + + HAL_Delay(1000); + BSP_LCD_SetFont(&Font12); + BSP_LCD_SetBackColor(LCD_COLOR_BLUE); + BSP_LCD_SetTextColor(LCD_COLOR_WHITE); + + while(1) { + + BSP_TS_GetState(&TS_State); + if (TS_State.touchDetected) { + // Clear lines corresponding to old touches coordinates + if (TS_State.touchDetected < prev_nb_touches) { + for (idx = (TS_State.touchDetected + 1); idx <= 5; idx++) { + BSP_LCD_ClearStringLine(idx); + } + } + prev_nb_touches = TS_State.touchDetected; + + cleared = 0; + + sprintf((char*)text, "Touches: %d", TS_State.touchDetected); + BSP_LCD_DisplayStringAt(0, LINE(0), (uint8_t *)&text, LEFT_MODE); + + for (idx = 0; idx < TS_State.touchDetected; idx++) { + x = TS_State.touchX[idx]; + y = TS_State.touchY[idx]; + sprintf((char*)text, "Touch %d: x=%d y=%d ", idx+1, x, y); + BSP_LCD_DisplayStringAt(0, LINE(idx+1), (uint8_t *)&text, LEFT_MODE); + } + + BSP_LCD_DrawPixel(TS_State.touchX[0], TS_State.touchY[0], LCD_COLOR_ORANGE); + } else { + if (!cleared) { + BSP_LCD_Clear(LCD_COLOR_BLUE); + sprintf((char*)text, "Touches: 0"); + BSP_LCD_DisplayStringAt(0, LINE(0), (uint8_t *)&text, LEFT_MODE); + cleared = 1; + } + } + } +}
diff -r 000000000000 -r 14a394d21b72 mbed-os.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Sun Jun 07 11:47:58 2020 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#699372421a3b388fe568e9be85b1a985749a438f