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_F746NG
main.cpp
00001 00002 #include "mbed.h" 00003 #include "stm32746g_discovery_lcd.h" 00004 #include "stm32746g_discovery_ts.h" 00005 #include "GroveGPS.h" 00006 GroveGPS gps; 00007 PwmOut PWM1(PB_4); 00008 PwmOut PWM2(PH_6); 00009 PwmOut PWM3(PI_2); 00010 PwmOut PWM4(PA_15); 00011 PwmOut PWM5(PA_8); 00012 PwmOut PWM6(PB_15); 00013 PwmOut mypwm7(PA_0); 00014 PwmOut mypwm8(PF_9); 00015 PwmOut mypwm9(PF_8); 00016 int main() 00017 { 00018 char buffer[100]; 00019 char buffer2[100]; 00020 char buffer3[100]; 00021 TS_StateTypeDef TS_State; 00022 uint16_t x, y; 00023 uint8_t text[30]; 00024 uint8_t status; 00025 uint8_t idx; 00026 uint8_t cleared = 0; 00027 uint8_t prev_nb_touches = 0; 00028 bool heure; 00029 bool latitude; 00030 bool longitude; 00031 00032 //initialisation LCD 00033 BSP_LCD_Init(); 00034 BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS); 00035 BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER); 00036 00037 BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN DEMO", CENTER_MODE); 00038 HAL_Delay(1000); 00039 00040 status = BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize()); 00041 if (status != TS_OK) { 00042 BSP_LCD_Clear(LCD_COLOR_RED); 00043 BSP_LCD_SetBackColor(LCD_COLOR_RED); 00044 BSP_LCD_SetTextColor(LCD_COLOR_WHITE); 00045 BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT FAIL", CENTER_MODE); 00046 } else { 00047 BSP_LCD_Clear(LCD_COLOR_GREEN); 00048 BSP_LCD_SetBackColor(LCD_COLOR_GREEN); 00049 BSP_LCD_SetTextColor(LCD_COLOR_WHITE); 00050 BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT OK", CENTER_MODE); 00051 } 00052 00053 HAL_Delay(1000); 00054 BSP_LCD_SetFont(&Font12); 00055 BSP_LCD_SetBackColor(LCD_COLOR_BLUE); 00056 BSP_LCD_SetTextColor(LCD_COLOR_WHITE); 00057 00058 while(1) { 00059 /* 00060 BSP_TS_GetState(&TS_State); 00061 if (TS_State.touchDetected) { 00062 // Clear lines corresponding to old touches coordinates 00063 if (TS_State.touchDetected < prev_nb_touches) { 00064 for (idx = (TS_State.touchDetected + 1); idx <= 5; idx++) { 00065 BSP_LCD_ClearStringLine(idx); 00066 } 00067 } 00068 */ 00069 // récupération de l'heure 00070 heure = gps.getTimestamp(buffer); 00071 BSP_LCD_Clear(LCD_COLOR_BLUE); 00072 BSP_LCD_SetTextColor(LCD_COLOR_WHITE); 00073 BSP_LCD_DisplayStringAt(0, LINE(10), (uint8_t *)&buffer, CENTER_MODE); 00074 /* Récupération de la latitude 00075 latitude = gps.getLatitude(buffer2); 00076 BSP_LCD_Clear(LCD_COLOR_BLUE); 00077 BSP_LCD_SetTextColor(LCD_COLOR_WHITE); 00078 BSP_LCD_DisplayStringAt(0, LINE(12), (uint8_t *)&buffer2, CENTER_MODE); 00079 Récupération de la longitude 00080 longitude = gps.getLongitude(buffer3); 00081 BSP_LCD_Clear(LCD_COLOR_BLUE); 00082 BSP_LCD_SetTextColor(LCD_COLOR_WHITE); 00083 BSP_LCD_DisplayStringAt(0, LINE(14), (uint8_t *)&buffer3, CENTER_MODE); 00084 */ 00085 PWM2 = 0; 00086 PWM3 = 0.5; 00087 PWM4 =0; 00088 PWM5 = 0; 00089 PWM6 = 0.5; 00090 PWM3.period_ms(10); 00091 HAL_Delay(500); 00092 } 00093 } 00094
Generated on Tue Jul 26 2022 15:43:48 by
1.7.2