eupn / stm32wb-hal

[WIP] embedded-hal for the STM32WB family of microcontrollers
20 stars 10 forks source link

SPI1/SPI2 master mode #2

Open rubdos opened 3 years ago

rubdos commented 3 years ago

Based on the STM32L0 code.

Currently untested and WIP

rubdos commented 3 years ago

I've pushed an I2C commit too, because I'm refactoring something that's currently on I2C to SPI. I'll split up the PR when it works, just having spi as a "me-branch" for a second :-)

-> Moved to #3, will rebase when that gets merged.

rubdos commented 3 years ago

@eupn Apparently my slave device talks in MSB-first u16 mode. I don't think the MSB-first mode is a documented thing in embedded_hal, shall I make our own marker structs for that? Or contribute them to embedded_hal, what do you think?

eupn commented 3 years ago

@rubdos similar thing has been asked here recently. I think this should be included in the HAL as it's a pretty common setting. But before that, you could inverse the bit order of words before sending them and after receiving them or configure the SPI separately (outside your device driver crate).