
Thread_lcd
Dependencies: BSP_DISCO_F746NG
main.cpp
- Committer:
- iliatumash
- Date:
- 2020-10-13
- Revision:
- 0:0ae76e57b20e
File content as of revision 0:0ae76e57b20e:
#include "mbed.h" #include "stm32746g_discovery_lcd.h" DigitalOut led(LED1); Thread thread0, thread1, thread2, thread3; void printText(uint16_t line, uint32_t Color, char text[]) { BSP_LCD_SetBackColor(LCD_COLOR_BLUE); BSP_LCD_SetTextColor(Color); BSP_LCD_DisplayStringAt(0, LINE(line),(uint8_t *)text, CENTER_MODE); ThisThread::sleep_for(500); BSP_LCD_ClearStringLine(line); ThisThread::sleep_for(500); } void led_thread() { while (true) { led = !led; ThisThread::sleep_for(100); } } void lcd_tread1() { uint16_t line = 1; uint32_t color = LCD_COLOR_WHITE; char text[] = "Ahoj"; while (true) { printText(line, color, text); } } void lcd_tread2() { while (true) { BSP_LCD_SetTextColor(LCD_COLOR_LIGHTRED); BSP_LCD_FillCircle(100, 200, 36); ThisThread::sleep_for(400); BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_FillCircle(100, 200, 36); ThisThread::sleep_for(400); } } void lcd_tread3() { while (true) { BSP_LCD_SetTextColor(LCD_COLOR_LIGHTGREEN); BSP_LCD_FillRect(250, 166, 70,70); ThisThread::sleep_for(800); BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_FillRect(250, 166, 70,70); ThisThread::sleep_for(800); } } int main() { BSP_LCD_Init(); BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS); BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER); BSP_LCD_Clear(LCD_COLOR_BLUE); BSP_LCD_SetFont(&LCD_DEFAULT_FONT); while (1){ thread0.start(led_thread); thread1.start(lcd_tread1); thread2.start(lcd_tread2); thread3.start(lcd_tread3); } }