DigitalSignal_Lab
Dependencies: LCD_DISCO_F746NG BSP_DISCO_F746NG Graphics
Diff: main.cpp
- Revision:
- 3:297f513b26fe
- Parent:
- 2:447f54400c21
- Child:
- 4:fae33fe59116
- Child:
- 7:c8ddf2b6aaec
--- a/main.cpp Sun Aug 25 00:45:05 2019 +0700 +++ b/main.cpp Mon Aug 26 22:24:04 2019 +0700 @@ -6,13 +6,16 @@ #include "mbed.h" #include "stats_report.h" #include "Graphics/RK043FN48H.h" +#include "LCD_DISCO_F746NG/LCD_DISCO_F746NG.h" +RK043FN48H graphics; +LCD_DISCO_F746NG lcd; DigitalOut led1(LED1); -RK043FN48H display; -#define SLEEP_TIME 500 // (msec) + +#define SLEEP_TIME 200 // (msec) #define PRINT_AFTER_N_LOOPS 20 // main() runs in its own thread in the OS @@ -20,11 +23,34 @@ { SystemReport sys_state( SLEEP_TIME * PRINT_AFTER_N_LOOPS /* Loop delay time in ms */); + // display.Clear(LCD_COLOR_RED); + + graphics.SetActiveLayer(Background); + graphics.SetBackgroundColor(LCD_COLOR_BLACK); + graphics.SetActiveLayer(Foreground); + + + graphics.SetBackColor(LCD_COLOR_BLACK); + graphics.SetTextColor(LCD_COLOR_LIGHTGRAY); + graphics.DisplayStringAt(10, 10, (unsigned char*)TITLE, CENTER_MODE); + + + + int xrand = 0,yrand = 0; + uint32_t colorshift = LCD_COLOR_WHITE; int count = 0; while (true) { // Blink LED and wait 0.5 seconds led1 = !led1; - wait_ms(SLEEP_TIME); + thread_sleep_for(SLEEP_TIME); + + // xrand = 10 + std::rand()%470; + // yrand = 10 + std::rand()%262; + + // colorshift = colorshift << (rand()%5); + // colorshift = colorshift >> (rand()%3); + // graphics.SetForegroundColor(colorshift); + // graphics.FillCircle(xrand,yrand,5); if ((0 == count) || (PRINT_AFTER_N_LOOPS == count)) { // Following the main thread wait, report on the current system status