embedded-hal icon indicating copy to clipboard operation
embedded-hal copied to clipboard

SpiDevice implementations in embedded-hal-bus don't provide a way to use active-high chip select

Open sky-dragn opened this issue 1 year ago • 1 comments

I am using a SPI display which requires active-high chip select, but all of the SpiDevice implementations don't mention the polarity of their CS pin anywhere. Looking at the implementation, these implementations are all hard-coded to use active-low CS, which won't work for this display. Adding a way of specifying the chip select polarity would make this usable for this case.

sky-dragn avatar Mar 28 '24 19:03 sky-dragn

pub struct ExclusiveDevice<BUS, CS, D, const CSHIGH = false> {

???

burrbull avatar Mar 28 '24 19:03 burrbull

Couldn't you just create an InvertedPin struct that implements the OutputPin trait and does the inversion?

This seems like a non issue to me.

Dominaezzz avatar May 15 '24 21:05 Dominaezzz

As a matter of fact, I wrote an inverted-pin crate that does exactly that. In my experience, active-low CS is the overwhelming majority so I think using an inverting wrapper should be enough and there is no pressing need to support this in a dedicated way. Closing. Feel free to reopen if you think otherwise.

eldruin avatar May 24 '24 15:05 eldruin