Nuvoton
/
NuMaker-mbed-NuBrick-example
NuMaker Brick I2C slave devices
Diff: main.cpp
- Revision:
- 12:92db8dd90705
- Parent:
- 8:b60e846cae6a
diff -r 21f8b9512e8d -r 92db8dd90705 main.cpp --- a/main.cpp Mon Nov 04 14:30:13 2019 +0800 +++ b/main.cpp Thu Feb 25 11:05:27 2021 +0800 @@ -25,11 +25,11 @@ do { \ printf("\r\n\r\n"); \ if (! MASTER.connect()) { \ - printf("Connect to NuBrick:\t\t"NAME" failed\r\n\r\n"); \ + printf("Connect to NuBrick:\t\t\"NAME\" failed\r\n\r\n"); \ return; \ } \ else { \ - printf("Connect to NuBrick:\t\t"NAME" OK\r\n\r\n"); \ + printf("Connect to NuBrick:\t\t\"NAME\" OK\r\n\r\n"); \ MASTER.print_device_desc(); \ } \ } while (0); @@ -57,7 +57,9 @@ void test_nubrick_keys(void); int main() { - +#ifdef MBED_MAJOR_VERSION + printf("Mbed OS version %d.%d.%d\r\n\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION); +#endif // Test all supported NuBrick slave devices test_nubrick_buzzer(); test_nubrick_led(); @@ -87,7 +89,11 @@ master_buzzer.push_feature_report(); // The NuBrick I2C device may not respond in time. Add delay here. +#if MBED_MAJOR_VERSION >= 6 + ThisThread::sleep_for(50); +#else wait_ms(50); +#endif // Start sounding the buzzer master_buzzer["output.start_flag"].set_value(1); @@ -111,7 +117,14 @@ master_led.push_feature_report(); // The NuBrick I2C device may not respond in time. Add delay here. +#if MBED_MAJOR_VERSION >= 6 + ThisThread::sleep_for(50); +#else wait_ms(50); +#endif + + + // Start blinking the LED master_led["output.start_flag"].set_value(1);