
DigitalSignal_Lab
Dependencies: LCD_DISCO_F746NG BSP_DISCO_F746NG Graphics
Revision 3:297f513b26fe, committed 2019-08-26
- Comitter:
- ngtkien95@gmail.com
- Date:
- Mon Aug 26 22:24:04 2019 +0700
- Parent:
- 2:447f54400c21
- Child:
- 4:fae33fe59116
- Child:
- 5:2f699e44beaa
- Commit message:
- add several lib.
Changed in this revision
--- a/.hgignore Sun Aug 25 00:45:05 2019 +0700 +++ b/.hgignore Mon Aug 26 22:24:04 2019 +0700 @@ -1,4 +1,5 @@ BUILD mbed-os BSP_DISCO_F746NG -Graphics \ No newline at end of file +Graphics +LCD_DISCO_F746NG \ No newline at end of file
--- 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
--- a/mbed-os.lib Sun Aug 25 00:45:05 2019 +0700 +++ b/mbed-os.lib Mon Aug 26 22:24:04 2019 +0700 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/mbed-os/#808c45062f940790e1287bd6b8420290c062775c +;;https://github.com/ARMmbed/mbed-os/#b005bf21337e6ffe5393671b92066c3b09c5204b \ No newline at end of file
--- a/stats_report.h Sun Aug 25 00:45:05 2019 +0700 +++ b/stats_report.h Mon Aug 26 22:24:04 2019 +0700 @@ -7,7 +7,6 @@ #define STATS_REPORT #include "mbed.h" - /** * System Reporting library. Provides runtime information on device: * - CPU sleep, idle, and wake times @@ -37,19 +36,19 @@ mbed_stats_sys_get(&sys_stats); printf("=============================== SYSTEM INFO ================================\r\n"); - printf("Mbed OS Version: %ld \r\n", sys_stats.os_version); - printf("CPU ID: 0x%lx \r\n", sys_stats.cpu_id); + printf("Mbed OS Version: %d \r\n", sys_stats.os_version); + printf("CPU ID: 0x%x \r\n", sys_stats.cpu_id); printf("Compiler ID: %d \r\n", sys_stats.compiler_id); - printf("Compiler Version: %ld \r\n", sys_stats.compiler_version); + printf("Compiler Version: %d \r\n", sys_stats.compiler_version); for (int i = 0; i < MBED_MAX_MEM_REGIONS; i++) { if (sys_stats.ram_size[i] != 0) { - printf("RAM%d: Start 0x%lx Size: 0x%lx \r\n", i, sys_stats.ram_start[i], sys_stats.ram_size[i]); + printf("RAM%d: Start 0x%x Size: 0x%x \r\n", i, sys_stats.ram_start[i], sys_stats.ram_size[i]); } } for (int i = 0; i < MBED_MAX_MEM_REGIONS; i++) { if (sys_stats.rom_size[i] != 0) { - printf("ROM%d: Start 0x%lx Size: 0x%lx \r\n", i, sys_stats.rom_start[i], sys_stats.rom_size[i]); + printf("ROM%d: Start 0x%x Size: 0x%x \r\n", i, sys_stats.rom_start[i], sys_stats.rom_size[i]); } } } @@ -104,8 +103,8 @@ // Collect and print heap stats mbed_stats_heap_get(&heap_stats); - printf("Current heap: %lu\r\n", heap_stats.current_size); - printf("Max heap size: %lu\r\n", heap_stats.max_size); + printf("Current heap: %u\r\n", heap_stats.current_size); + printf("Max heap size: %u\r\n", heap_stats.max_size); } /** @@ -119,12 +118,12 @@ int count = mbed_stats_thread_get_each(thread_stats, max_thread_count); for (int i = 0; i < count; i++) { - printf("ID: 0x%lx \r\n", thread_stats[i].id); + printf("ID: 0x%x \r\n", thread_stats[i].id); printf("Name: %s \r\n", thread_stats[i].name); - printf("State: %ld \r\n", thread_stats[i].state); - printf("Priority: %ld \r\n", thread_stats[i].priority); - printf("Stack Size: %ld \r\n", thread_stats[i].stack_size); - printf("Stack Space: %ld \r\n", thread_stats[i].stack_space); + printf("State: %d \r\n", thread_stats[i].state); + printf("Priority: %d \r\n", thread_stats[i].priority); + printf("Stack Size: %d \r\n", thread_stats[i].stack_size); + printf("Stack Space: %d \r\n", thread_stats[i].stack_space); } } };