-
Notifications
You must be signed in to change notification settings - Fork 221
Description
Currently this library only works on certain boards, what about making it work on other boards too?
Since communication between MCU and NINA-W102 is carried out via a serial interface, I think in principle it is possible.
I think this would be useful when building a custom board connecting an arbitrary MCU to a W102 flashed with arduino/nina-fw.
I don't know details of this library so I apologize if I'm wrong, but for example, how about using a user-defined serial object if none of #if
macros below match?
ArduinoBLE/src/utility/HCIUartTransport.cpp
Lines 24 to 40 in 9263b3a
#if defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_AVR_UNO_WIFI_REV2) | |
#define SerialHCI Serial2 | |
#elif defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_NANO_RP2040_CONNECT) | |
// SerialHCI is already defined in the variant | |
#elif defined(ARDUINO_PORTENTA_H7_M4) | |
// SerialHCI is already defined in the variant | |
#elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION) | |
#define SerialHCI Serial2 | |
#elif defined(ARDUINO_OPTA) | |
#define SerialHCI Serial3 | |
#elif defined(ARDUINO_PORTENTA_C33) | |
#define SerialHCI Serial5 | |
#elif defined(ARDUINO_GIGA) | |
arduino::UART SerialHCI(CYBSP_BT_UART_TX, CYBSP_BT_UART_RX, CYBSP_BT_UART_RTS, CYBSP_BT_UART_CTS); | |
#else | |
#error "Unsupported board selected!" | |
#endif |
Example:
// Line 38~
#elif defined(SerialBLE)
#define SerialHCI SerialBLE
#else
#error "..."
#endif
SerialBLE
is user-defined macro.
Define in sketch file.
// Sketch
#define SerialBLE Serial2
void setup() {}
void loop() {}
Alternatively, you may specify SerialHCI
directly from sketch file without using a user-defined macro.
// Line 38~
#elif defined(SerialHCI)
// Already defined by user.
#else
#error "..."
#endif
// Sketch
# define SerialHCI Serial2
void setup() {}
void loop() {}