Adding ICM-20948

Dependencies:   IMU HighGAccel

Committer:
alouisrogers
Date:
Fri Feb 01 00:27:29 2019 +0000
Revision:
0:e56a9ab74495
IMU

Who changed what in which revision?

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