MbedOS 5.15.7 example, using Interrupt mode with expansion board onboard sensor. Serial port set to default (9600) baud.
Dependencies: X_NUCLEO_53L1A1_mbed
Revision 4:b3346923eb1e, committed 2021-05-11
- Comitter:
- johnAlexander
- Date:
- Tue May 11 09:37:42 2021 +0000
- Parent:
- 3:e30428692405
- Commit message:
- Add support for MbedOS v6.x.; Override serial port default of 9600 baud, for printfs. Now set at 115200 baud, to match header comment.
Changed in this revision
diff -r e30428692405 -r b3346923eb1e X_NUCLEO_53L1A1_mbed.lib --- a/X_NUCLEO_53L1A1_mbed.lib Tue May 11 09:20:19 2021 +0000 +++ b/X_NUCLEO_53L1A1_mbed.lib Tue May 11 09:37:42 2021 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/teams/ST-Expansion-SW-Team/code/X_NUCLEO_53L1A1_mbed/#24a73ef7469f +https://os.mbed.com/teams/ST-Expansion-SW-Team/code/X_NUCLEO_53L1A1_mbed/#ee29a8ce93d5
diff -r e30428692405 -r b3346923eb1e main.cpp --- a/main.cpp Tue May 11 09:20:19 2021 +0000 +++ b/main.cpp Tue May 11 09:37:42 2021 +0000 @@ -37,7 +37,12 @@ #define VL53L1_I2C_SCL D15 static XNucleo53L1A1 *board=NULL; +#if (MBED_VERSION > 60300) +UnbufferedSerial pc(USBTX, USBRX); +extern "C" void wait_ms(int ms); +#else Serial pc(SERIAL_TX, SERIAL_RX); +#endif /* flags that handle interrupt request for sensor and user blue button*/ volatile bool int_sensor = false; @@ -124,9 +129,18 @@ int main() { #if USER_BUTTON==PC_13 // we are cross compiling for Nucleo-f401 - InterruptIn stop_button(USER_BUTTON); - stop_button.rise(&measuring_stop_irq); +// InterruptIn stop_button(USER_BUTTON); +// stop_button.rise(&measuring_stop_irq); #endif + pc.baud(115200); // baud rate is important as printf statements take a lot of time + vl53L1X_DevI2C *device_i2c = new vl53L1X_DevI2C(VL53L1_I2C_SDA, VL53L1_I2C_SCL); range_measure(device_i2c); // start continuous measures } + +#if (MBED_VERSION > 60300) +extern "C" void wait_ms(int ms) +{ + thread_sleep_for(ms); +} +#endif
diff -r e30428692405 -r b3346923eb1e mbed-os.lib --- a/mbed-os.lib Tue May 11 09:20:19 2021 +0000 +++ b/mbed-os.lib Tue May 11 09:37:42 2021 +0000 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/mbed-os/#0be7685a27f28c02737f42055f4a9c182a7b483c +https://github.com/ARMmbed/mbed-os/#9738b27c7df897c29e9769911d6794ba3e5b3f19