Skip to content

Suggestion: Universal board support. #398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dojyorin opened this issue May 12, 2025 · 0 comments
Open

Suggestion: Universal board support. #398

dojyorin opened this issue May 12, 2025 · 0 comments
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@dojyorin
Copy link

dojyorin commented May 12, 2025

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?

#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() {}
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

2 participants