Porting Arduino libraries to stm32Cube

I’m kinda at the starting point of a project, and am unsure whether to use a Teensy board with the Arduino Framework or a stm32 board with the Cube framework.

I feel like I will learn a lot more about embedded development going with the stm32 chip (which is my goal) as well as have more flexibility down the road, but one thing I am concerned about is the external library support for all the various I2C / SPI ICs out there that are currently written for the Arduino framework.

For example, I use this library right here quite frequently for my Arduino based projects.

What would the process look like for porting this to be usable within an stm32Cube project?

Why not use the stm32 with the Arduino framework? The two are not mutually exclusive… just as using an Atmel/Microchip AVR processor does not necessitate that you use the Arduino framework.

I am just trying to avoid the Arduino framework all together. I am still learning though, so perhaps I will answer my own question soon enough.

1 Like

Generally use HAL_I2C_Master_Transmit() and a previous setup of the I2C interface (can be autogenerated by STM32CubeMX) for the I2C sending / transmitting part. Refer to the STM32 HAL reference of your “stm32 board” (which you did not give any further details on, so I can’t link you to the F0/F1/F3/F4/L0/L1/L4 reference directly.).

Or directly search for a MCP23017 library for the STM32 HAL.