-
Notifications
You must be signed in to change notification settings - Fork 516
Add support for STM32 MCU based boards #378
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
Conversation
Boards.h
Outdated
#define IS_PIN_I2C(p) (IS_PIN_DIGITAL(p) && digitalPinHasI2C(p)) | ||
#define IS_PIN_SPI(p) (IS_PIN_DIGITAL(p) && digitalPinHasSPI(p)) | ||
#define IS_PIN_INTERRUPT(p) (IS_PIN_DIGITAL(p) && (digitalPinToInterrupt(p) > NOT_AN_INTERRUPT))) | ||
#define IS_PIN_SERIAL(p) (digitalPinHasSerial(p)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If any UART pins share the main USB/UART programming connection, please exclude those pins here (whatever maps to Serial
instead of Serial1
, Serial2
, etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean something like that?
#define IS_PIN_SERIAL(p) (digitalPinHasSerial(p) && !pinIsSerial(p) )
because pin could support Serial and not used by the programming connection?
But you're right in this case, IS_PIN_SERIAL is true for the Serial used to communicate with firmata fw. So adding !pinIsSerial(p) seems required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that is correct as defined here.
Also is seems strange that there are Firmata-specific macros defined in Arduino_Core_STM32
. It's convenient for sure, but ideally board cores shouldn't need to know anything specific about Firmata. What is really missing is a well defined HAL that exposes board capabilities across the entire Arduino ecosystem. This is one area that Arduino only loosely defined so you see a lot of variance in macros defined across all of the various boards defined for the Arduino ecosystem. If such a system were in place and properly maintained, there would be no need for the Firmata Boards.h file. Some day perhaps (wishful thinking).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed with you.
In fact the core know anything about Firmata. It only give a macro that Firmata could use for STM32 arch and define the PIN_SERIAL_RX && PIN_SERIAL_TX which are different for each STM32 based board.
Note about this line: Due to the pin mapping implementation and allow the most possibilities for each pins/boards some pins are duplicated to handle Analog input.
So this one is used to ensure to not break the Serial link btw Firmata client and Firmware.
About a well defined HAL that exposes board capabilities... Sounds great but seems hard to align all the Arduino ecosystem.
That's why I tried to use proper macro definition/name to avoid any further change request in Firmata/arduino.
Can you squash these 2 commits? Then this will be ready to merge. |
Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
Done. Thanks in advance. |
Hi Jeff, |
There are a couple of changes I want to make to StandardFirmataEthernet before I push the next release. Sometime this weekend would be the earliest, but it could end up being another week or two. |
Hi,
This PR add the support of STM32 MCU based board.
More information here: STM32 cores enabled in Arduino IDE
Latest release of the Arduino_Core_STM32 is functional with Firmata. The modified lib with ARDUINO_ARCH_STM32 is currently released with the core and could be removed when this PR will be merged.
Core is provided as a package thanks the Arduino Boards manager, see the wiki
Thanks in advance