You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So is this a discussion place? After a quick look, I'm not really fancy of the design of ArduinoCore-API, mainly because:
It doesn’t seem to offer some useful new features;
Hardware abstractions like HardwareSerial declare all interfaces as virtual functions;
Many annoying constants are still macros. Although the arduino namespace has been added, it doesn’t seem to address the issue of naming pollution.
IMO, virtual functions are the most flexible yet laziest design approach. They are the old fashion. We already have methods like duck-typing to achieve static polymorphism, so it seems unnecessary to use virtual functions here.
In fact, I think they should just remove interfasces like HardwareSerial and HardwareSPI entirely and leave them to be defined by each hardware platform. If they must standardize the interface, they could use something like a HardwareSerialConcept.
I think they could replace most macros with constexpr and move them into namespace. If there are compatibility issues, they could add a fallback compilation switch.
Thanks a lot for your detailed feedback and insights regarding the ArduinoCore-API design.
The main goal of integrating ArduinoCore-API in our STM32 core is to align with the official Arduino ecosystem and ensure maximum compatibility with existing Arduino sketches, libraries, and tools, just like other popular cores have done. This alignment helps users seamlessly run their code across platforms without major changes, which is a key benefit for the community.
We fully acknowledge that the ArduinoCore-API is not perfect and has some design choices that can be improved. That’s why we created a fork of the API: to experiment, propose enhancements, and push new features upstream where possible.
Regarding the specific issues you raised, such as the heavy reliance on virtual functions and macro pollution : we encourage you to open an issue directly on the official ArduinoCore-API repository. This will help bring more visibility to these concerns and potentially drive improvements at the source.
Activity
marshfolx commentedon Dec 20, 2025
So is this a discussion place? After a quick look, I'm not really fancy of the design of ArduinoCore-API, mainly because:
HardwareSerialdeclare all interfaces as virtual functions;IMO, virtual functions are the most flexible yet laziest design approach. They are the old fashion. We already have methods like duck-typing to achieve static polymorphism, so it seems unnecessary to use virtual functions here.
In fact, I think they should just remove interfasces like HardwareSerial and HardwareSPI entirely and leave them to be defined by each hardware platform. If they must standardize the interface, they could use something like a
HardwareSerialConcept.I think they could replace most macros with
constexprand move them into namespace. If there are compatibility issues, they could add a fallback compilation switch.Aymane-ST commentedon Jan 5, 2026
Hi @marshfolx ,
Thanks a lot for your detailed feedback and insights regarding the ArduinoCore-API design.
The main goal of integrating ArduinoCore-API in our STM32 core is to align with the official Arduino ecosystem and ensure maximum compatibility with existing Arduino sketches, libraries, and tools, just like other popular cores have done. This alignment helps users seamlessly run their code across platforms without major changes, which is a key benefit for the community.
We fully acknowledge that the ArduinoCore-API is not perfect and has some design choices that can be improved. That’s why we created a fork of the API: to experiment, propose enhancements, and push new features upstream where possible.
Regarding the specific issues you raised, such as the heavy reliance on virtual functions and macro pollution : we encourage you to open an issue directly on the official ArduinoCore-API repository. This will help bring more visibility to these concerns and potentially drive improvements at the source.
Thanks