diff --git a/README.md b/README.md index 86f9dd0..7cc933f 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Receivers with one iBUS pin typically send servo commands over the iBUS line, bu To install this library use the **Clone or download > Download ZIP** button on the repository home page and then install the library in your Arduino environment using **Sketch > Include Library > Add .ZIP Library...** -This library supports AVR based Arduino boards (Arduino MEGA, UNO, Nano, Micro, etc.), ESP32 based boards (ESP32, NodeMCU, etc.) and STM32 boards (STM32F103, etc.) +This library supports AVR based Arduino boards (Arduino MEGA, UNO, Nano, Micro, etc.), ESP32 based boards (ESP32, NodeMCU, etc.), STM32 boards (STM32F103, etc.) and MBED (such as the Arduino NANO 33 BLE). ### Prerequisites @@ -306,4 +306,5 @@ Example sketches: - **Ibus_multimonitor**: monitor/debugger for receivers with a two separate iBUS pins (one for servo data and one for sensor data, such as the TGY-IA6B). Prints out servo channels to the standard serial output (PC debug window) and simulates 2 sensors with random values sent back to transmitter. Requires Arduino board with 3 or more hardware serial ports (such as MEGA 2560) - **IBus_sensor**: simulate two telemetry sensors and send values back over the iBUS to the receiver to be shown in the display of your transmitter - **Ibus_diy_servo_STM32**: example for (large) diy DC servo's, like windshield wiper motors. Change the P I D settings for servo response and tuning +- **Ibus2PWM_mbed**: example translate iBUS signal to servo for MBED (Arduino Nano 33 BLE) - **Robotcar**: Example remote controlled car using the VNH3SP30 motor driver diff --git a/examples/Ibus2PWM_mbed/Ibus2PWM_mbed.ino b/examples/Ibus2PWM_mbed/Ibus2PWM_mbed.ino index 2cbd347..f1e0281 100644 --- a/examples/Ibus2PWM_mbed/Ibus2PWM_mbed.ino +++ b/examples/Ibus2PWM_mbed/Ibus2PWM_mbed.ino @@ -3,7 +3,7 @@ /* - Translate iBUS signal to servo + Translate iBUS signal to servo for MBED architecture (such as Arduino Nano 33 BLE) Supports any Arduino board where serial0 is available. diff --git a/src/IBusBM.cpp b/src/IBusBM.cpp index 2bcc732..c6fcd5f 100644 --- a/src/IBusBM.cpp +++ b/src/IBusBM.cpp @@ -18,7 +18,8 @@ * * Created 12 March 2019 Bart Mellink * Updated 4 April 2019 to support ESP32 - * Updated 21 Jul 2020 to support MBED (David Peverley) + * updated 13 jun 2019 to support STM32 (pauluzs) + * Updated 21 Jul 2020 to support MBED (David Peverley) */ #include @@ -47,19 +48,14 @@ void onTimer() { #if defined(ARDUINO_ARCH_MBED) - -extern "C" -{ -void TIMER4_IRQHandler_v() -{ - if (NRF_TIMER4->EVENTS_COMPARE[0] == 1) - { - onTimer(); - NRF_TIMER4->EVENTS_COMPARE[0] = 0; +extern "C" { + void TIMER4_IRQHandler_v() { + if (NRF_TIMER4->EVENTS_COMPARE[0] == 1) { + onTimer(); + NRF_TIMER4->EVENTS_COMPARE[0] = 0; + } } } -} - #endif diff --git a/src/IBusBM.h b/src/IBusBM.h index 2701a3b..c998eb2 100644 --- a/src/IBusBM.h +++ b/src/IBusBM.h @@ -65,7 +65,7 @@ class IBusBM { static const uint8_t SENSORMAX = 10; // Max number of sensors uint8_t state; // state machine state for iBUS protocol - Stream * stream; // serial port + HardwareSerial *stream; // serial port uint32_t last; // milis() of prior message uint8_t buffer[PROTOCOL_LENGTH]; // message buffer uint8_t ptr; // pointer in buffer