stm32f0xx-hal
stm32f0xx-hal copied to clipboard
implement FullDuplex for Spi
This is a very simple impl for FullDuplex. The Transfer impl could be removed in favor of the default that is available by the availability of FullDuplex.
Looks like it's not working, will push a correct version later :)
Not 100% sure it's the best way to implement, but as far as I could test, it works (tested with ws2812-spi and a 10 leds chain). If you think some refactoring can be done, do not hesitate, happy to learn and implement :)
I've tried to implement the check_errors
. I'm not 100% sure my usage of nb::Result
/ Result
is the best (or at least the more idiomatic). I've made it return a Result
as it's not dealing with blocking anymore, but maybe that was not a good idea. Let me know if you think I should do it differently !
Thanks for the help !
Also, I've left the Transfer
impl as relying on the FullDuplex
would cause set_bidi
to be called for every byte in a mult-byte transfer... Not sure if this overhead is a problem or not, so I left the custom Transfer
impl as-is.
Has anyone had a chance to test those changes in real life yet?
I guess I could hookup a nRF24L01, capture some exchanges with analyzer to provide some better test if nobody can test this with an easier setup ? I don't have anything else (except for the ws2812 I'm using that motivated this change)
Sorry, I forgot to think this through. I don't have anything to test besides this ws2812 setup as all my F0 are soldered on my keyboards, so there's no way I can monitor sck and miso pins...
If you design a test scenario, I have a lot of hardware to test on.
Sorry, I forgot to think this through. I don't have anything to test besides this ws2812 setup as all my F0 are soldered on my keyboards, so there's no way I can monitor sck and miso pins...
If you design a test scenario, I have a lot of hardware to test on.
back on this... I was hoping I could find some f0, but found none :/. I can try to write a small program so you only need to wire something, compile and load ? Do you have some nrf24lo1 ? I could execute the program on another mcu to check it works and let you see if it's works similarly on f0?
Sure, no problem. I believe that I have the NRF so there should be no problems.
I believe that the peripheral on F4 is similar, so that you can debug on it and then send it to me to try out on the F0.
even better, I have some brand new f4 here!
Hi. What is the status on this? Can I help in any way?
@easybe Seems dormant to me. If you can test it, we can certainly get it merged.
OK, I should be able to do that.
Sorry, still haven't anything to test, but am using the code daily in a keyboard without any issue, so should be OK. Thanks Ezra if you can help with the testing.