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: LCD_DISCO_F746NG BSP_DISCO_F746NG Graphics
main.cpp@2:447f54400c21, 2019-08-25 (annotated)
- Committer:
- ngtkien95@gmail.com
- Date:
- Sun Aug 25 00:45:05 2019 +0700
- Revision:
- 2:447f54400c21
- Parent:
- 0:612209585c31
- Child:
- 3:297f513b26fe
Add Stats Report and Graphics
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ngtkien95@gmail.com | 2:447f54400c21 | 1 | /* mbed Microcontroller Library |
| ngtkien95@gmail.com | 2:447f54400c21 | 2 | * Copyright (c) 2018 ARM Limited |
| ngtkien95@gmail.com | 2:447f54400c21 | 3 | * SPDX-License-Identifier: Apache-2.0 |
| ngtkien95@gmail.com | 2:447f54400c21 | 4 | */ |
| ngtkien | 0:612209585c31 | 5 | |
| ngtkien95@gmail.com | 2:447f54400c21 | 6 | #include "mbed.h" |
| ngtkien95@gmail.com | 2:447f54400c21 | 7 | #include "stats_report.h" |
| ngtkien95@gmail.com | 2:447f54400c21 | 8 | #include "Graphics/RK043FN48H.h" |
| ngtkien | 0:612209585c31 | 9 | |
| ngtkien | 0:612209585c31 | 10 | |
| ngtkien95@gmail.com | 2:447f54400c21 | 11 | DigitalOut led1(LED1); |
| ngtkien95@gmail.com | 2:447f54400c21 | 12 | RK043FN48H display; |
| ngtkien | 0:612209585c31 | 13 | |
| ngtkien | 0:612209585c31 | 14 | |
| ngtkien95@gmail.com | 2:447f54400c21 | 15 | #define SLEEP_TIME 500 // (msec) |
| ngtkien95@gmail.com | 2:447f54400c21 | 16 | #define PRINT_AFTER_N_LOOPS 20 |
| ngtkien | 0:612209585c31 | 17 | |
| ngtkien95@gmail.com | 2:447f54400c21 | 18 | // main() runs in its own thread in the OS |
| ngtkien | 0:612209585c31 | 19 | int main() |
| ngtkien | 0:612209585c31 | 20 | { |
| ngtkien95@gmail.com | 2:447f54400c21 | 21 | SystemReport sys_state( SLEEP_TIME * PRINT_AFTER_N_LOOPS /* Loop delay time in ms */); |
| ngtkien | 0:612209585c31 | 22 | |
| ngtkien95@gmail.com | 2:447f54400c21 | 23 | int count = 0; |
| ngtkien95@gmail.com | 2:447f54400c21 | 24 | while (true) { |
| ngtkien95@gmail.com | 2:447f54400c21 | 25 | // Blink LED and wait 0.5 seconds |
| ngtkien95@gmail.com | 2:447f54400c21 | 26 | led1 = !led1; |
| ngtkien95@gmail.com | 2:447f54400c21 | 27 | wait_ms(SLEEP_TIME); |
| ngtkien95@gmail.com | 2:447f54400c21 | 28 | |
| ngtkien95@gmail.com | 2:447f54400c21 | 29 | if ((0 == count) || (PRINT_AFTER_N_LOOPS == count)) { |
| ngtkien95@gmail.com | 2:447f54400c21 | 30 | // Following the main thread wait, report on the current system status |
| ngtkien95@gmail.com | 2:447f54400c21 | 31 | sys_state.report_state(); |
| ngtkien95@gmail.com | 2:447f54400c21 | 32 | count = 0; |
| ngtkien95@gmail.com | 2:447f54400c21 | 33 | } |
| ngtkien95@gmail.com | 2:447f54400c21 | 34 | ++count; |
| ngtkien | 0:612209585c31 | 35 | } |
| ngtkien | 0:612209585c31 | 36 | } |