hfyfyu

Committer:
bogthe
Date:
Sat Jan 12 13:55:39 2019 +0000
Revision:
0:d9dd72246908
uyjg

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogthe 0:d9dd72246908 1 /* mbed Microcontroller Library
bogthe 0:d9dd72246908 2 * Copyright (c) 2018 ARM Limited
bogthe 0:d9dd72246908 3 * SPDX-License-Identifier: Apache-2.0
bogthe 0:d9dd72246908 4 */
bogthe 0:d9dd72246908 5
bogthe 0:d9dd72246908 6 #include "mbed.h"
bogthe 0:d9dd72246908 7 #include "stats_report.h"
bogthe 0:d9dd72246908 8
bogthe 0:d9dd72246908 9 DigitalOut led1(LED1);
bogthe 0:d9dd72246908 10
bogthe 0:d9dd72246908 11 #define SLEEP_TIME 500 // (msec)
bogthe 0:d9dd72246908 12 #define PRINT_AFTER_N_LOOPS 20
bogthe 0:d9dd72246908 13
bogthe 0:d9dd72246908 14 // main() runs in its own thread in the OS
bogthe 0:d9dd72246908 15 int main()
bogthe 0:d9dd72246908 16 {
bogthe 0:d9dd72246908 17 SystemReport sys_state( SLEEP_TIME * PRINT_AFTER_N_LOOPS /* Loop delay time in ms */);
bogthe 0:d9dd72246908 18
bogthe 0:d9dd72246908 19 int count = 0;
bogthe 0:d9dd72246908 20 while (true) {
bogthe 0:d9dd72246908 21 // Blink LED and wait 0.5 seconds
bogthe 0:d9dd72246908 22 led1 = !led1;
bogthe 0:d9dd72246908 23 wait_ms(SLEEP_TIME);
bogthe 0:d9dd72246908 24
bogthe 0:d9dd72246908 25 if ((0 == count) || (PRINT_AFTER_N_LOOPS == count)) {
bogthe 0:d9dd72246908 26 // Following the main thread wait, report on the current system status
bogthe 0:d9dd72246908 27 sys_state.report_state();
bogthe 0:d9dd72246908 28 count = 0;
bogthe 0:d9dd72246908 29 }
bogthe 0:d9dd72246908 30 ++count;
bogthe 0:d9dd72246908 31 }
bogthe 0:d9dd72246908 32 }