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.
Revision 12:92db8dd90705, committed 2021-02-25
- Comitter:
- SHLIU1@OANBE02333.nuvoton.com
- Date:
- Thu Feb 25 11:05:27 2021 +0800
- Parent:
- 11:21f8b9512e8d
- Commit message:
- Support the both V5.X and V6.X for mbed-os
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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);