modm-io / modm

modm: a C++23 library generator for AVR and ARM Cortex-M devices
https://modm.io
Mozilla Public License 2.0
733 stars 131 forks source link

Using SPI on Linux/Darwin target #1094

Closed botoxparty closed 7 months ago

botoxparty commented 10 months ago

Hey,

I have some USB SPI devices, see https://spidriver.com/ or https://www.amazon.de/-/en/DSD-TECH-SH-U05A-UART-Converter/dp/B0BM9JQZB7/

How would I go about using these SPI interfaces with modm? I'm a bit lost.

Would appreciate any help.

rleh commented 10 months ago

Hi, I'm not sure if I understand correctly what you want to do, but I assume you want to use these USB-SPI adapters to have a SPI master on hosted-linux/hosted-darwin to use (existing) modm drivers to control SPI peripherals (like sensors/displays)?

Therefor you would need to implement the SpiMaster interface in a SPI platform driver for the hosted-linux/hosted-darwin target (simlar to e.g. this one for STM32). Looking at their C driver this should be possible.

I might be helpful to have a look at the modm:platform:canusb driver, that does something similar but for a USB-CAN adapter for hosted-linux target.

botoxparty commented 10 months ago

Yeah you are understanding me perfectly :)

Sounds like a challenge, I'll see how far i can get with it.

botoxparty commented 10 months ago

So I tried but I unfortunately don't have the in-depth knowledge of developing linux drivers to be able to refactor the existing linux driver to be compatible with the project.

If anyone would support me with developing this I would love to work together.