
Projet interfaçage
Dependencies: mbed BSP_DISCO_F746NG
Diff: main.cpp
- Revision:
- 1:eb044e6a9033
- Parent:
- 0:1c6757f4b61c
--- a/main.cpp Mon Jun 21 08:21:33 2021 +0000 +++ b/main.cpp Tue Jun 22 12:04:16 2021 +0000 @@ -1,10 +1,13 @@ #include "mbed.h" #include "MPU6050.h" #include "stm32746g_discovery_lcd.h" // include les bibliothèques +#include "stm32746g_discovery_ts.h" #include <math.h> - +TS_StateTypeDef TS_State; //touchscreen +uint8_t status; +int TouchScreen=1; Serial pc(USBTX, USBRX); I2C i2c(I2C_SDA, I2C_SCL); //Déclaration de SDA et SCL ainsi que I2C MPU6050 mpu(i2c); @@ -23,7 +26,8 @@ Ticker flipper; double t1, t2; - + + void servo_ctrl() { @@ -44,6 +48,7 @@ } } + int main() { @@ -51,6 +56,21 @@ BSP_LCD_Init(); BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS); BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER); + + BSP_LCD_SetBackColor(LCD_COLOR_BLACK); + BSP_LCD_SetTextColor(LCD_COLOR_WHITE); + BSP_LCD_DisplayStringAt(0,LINE(5), (uint8_t *)"Start commencement?", CENTER_MODE); + status = BSP_TS_Init(BSP_LCD_GetXSize() , BSP_LCD_GetYSize()); //déclaration ecran pour le touchscreen + + while(TouchScreen) { + + BSP_TS_GetState(&TS_State); + if (TS_State.touchDetected){ //rien ne se passe tant qu'il n'y a aucun appui sur l'ecran + TouchScreen =0; + } + } + + BSP_LCD_Clear(LCD_COLOR_BLACK); BSP_LCD_SetFont(&LCD_DEFAULT_FONT); @@ -83,9 +103,9 @@ servo1.period_ms(20); // déclaration de la période des servo-moteurs servo2.period_ms(20); flipper.attach(&servo_ctrl, 1.0); // nous demandons toute les secondes si il y a une action - while(1) { + - + while (1){ BSP_LCD_Clear(LCD_COLOR_BLACK); BSP_LCD_FillCircle(xPos,yPos,4);