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 #include "mbed.h" 00002 #include "stm32746g_discovery_lcd.h" 00003 00004 00005 DigitalOut led(LED1); 00006 Thread thread0, thread1, thread2, thread3; 00007 00008 void printText(uint16_t line, uint32_t Color, char text[]) 00009 { 00010 BSP_LCD_SetBackColor(LCD_COLOR_BLUE); 00011 BSP_LCD_SetTextColor(Color); 00012 BSP_LCD_DisplayStringAt(0, LINE(line),(uint8_t *)text, CENTER_MODE); 00013 ThisThread::sleep_for(500); 00014 BSP_LCD_ClearStringLine(line); 00015 ThisThread::sleep_for(500); 00016 } 00017 00018 void led_thread() 00019 { 00020 while (true) { 00021 led = !led; 00022 ThisThread::sleep_for(100); 00023 } 00024 } 00025 00026 void lcd_tread1() 00027 { 00028 uint16_t line = 1; 00029 uint32_t color = LCD_COLOR_WHITE; 00030 char text[] = "Ahoj"; 00031 while (true) { 00032 printText(line, color, text); 00033 } 00034 } 00035 00036 void lcd_tread2() 00037 { 00038 while (true) { 00039 BSP_LCD_SetTextColor(LCD_COLOR_LIGHTRED); 00040 BSP_LCD_FillCircle(100, 200, 36); 00041 ThisThread::sleep_for(400); 00042 BSP_LCD_SetTextColor(LCD_COLOR_BLUE); 00043 BSP_LCD_FillCircle(100, 200, 36); 00044 ThisThread::sleep_for(400); 00045 } 00046 } 00047 00048 void lcd_tread3() 00049 { 00050 while (true) { 00051 BSP_LCD_SetTextColor(LCD_COLOR_LIGHTGREEN); 00052 BSP_LCD_FillRect(250, 166, 70,70); 00053 ThisThread::sleep_for(800); 00054 BSP_LCD_SetTextColor(LCD_COLOR_BLUE); 00055 BSP_LCD_FillRect(250, 166, 70,70); 00056 ThisThread::sleep_for(800); 00057 } 00058 } 00059 00060 int main() 00061 { 00062 BSP_LCD_Init(); 00063 BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS); 00064 BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER); 00065 BSP_LCD_Clear(LCD_COLOR_BLUE); 00066 BSP_LCD_SetFont(&LCD_DEFAULT_FONT); 00067 00068 while (1){ 00069 thread0.start(led_thread); 00070 thread1.start(lcd_tread1); 00071 thread2.start(lcd_tread2); 00072 thread3.start(lcd_tread3); 00073 } 00074 }
Generated on Fri Jul 22 2022 22:15:38 by
1.7.2