Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BSP_DISCO_F769NI
main.cpp
- Committer:
- Jerome Coutant
- Date:
- 2019-11-15
- Revision:
- 2:2becc6f12303
- Parent:
- 0:cc2802bc7c1b
- Child:
- 3:3a1eea2b8d4d
File content as of revision 2:2becc6f12303:
#include "mbed.h"
#include "stm32f769i_discovery.h"
#include "stm32f769i_discovery_ts.h"
#include "stm32f769i_discovery_lcd.h"
TS_StateTypeDef TS_State = {0};
int main()
{
uint16_t x1, y1;
printf("\n\n TOUCHSCREEN EXAMPLE FOR DISCO-F769NI START:\n");
BSP_LCD_Init();
BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS);
BSP_LCD_SelectLayer(0);
/* 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\n", x1, y1);
BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
BSP_LCD_FillCircle(x1, y1, 20);
HAL_Delay(100);
}
}
}