esp-rs / esp-hal

no_std Hardware Abstraction Layers for ESP32 microcontrollers
https://docs.esp-rs.org/esp-hal/
Apache License 2.0
674 stars 190 forks source link

Expose SPI sio() setting #1826

Open ElDonad opened 1 month ago

ElDonad commented 1 month ago

Hello, I was trying to setup three wires SPI for my application using an ESP32-S3, and it appears that the esp-hal API doesn't expose this setting. Would it be possible to expose this functionality ? I don't think it would be very hard, there could be a helper function akin to Spi::with_sio() that would resemble something like

fun with_sio(self) -> Self{
    let reg_block = self.register_block();
    reg_block.user().modify(|_,w| unsafe {
        w.sio().set_bit();
    }
    self
}

I'm fairly new to ESP and Rust dev and I don't have the means to thoroughly test this PoC currently, so I hope it's not too far from correct...

bjoernQ commented 1 month ago

That would be a useful addition

ElDonad commented 1 month ago

By the way there is not much information about it in the technical manual, but I assume this should only be available for the Half Duplex mode, it wouldn't make sense otherwise. I'll try to get it to work on a ESP32S3 I have, maybe then I can issue a PR...