ryankurte / embedded-hal-compat

Rust embedded-hal inter-version compatibility layer
MIT License
15 stars 11 forks source link

`SpiBus::read()` implementation for `Forward<T>` not working #27

Closed natrow closed 1 year ago

natrow commented 1 year ago

So I'm finally testing this crate on some hardware and I've run into an issue. I've done some digging and I've found two problems:

1) Converting from nb::Result<> makes the processor hang, I suspect calling .into() is causing infinite recursion. It's happening here: https://github.com/ryankurte/embedded-hal-compat/blob/main/src/forward.rs#L190 2) Implementation of SpiBus::read() calls non-blocking code, potentially returning nb::Error::WouldBlock, then triggering problem 1. Happening here: https://github.com/ryankurte/embedded-hal-compat/blob/main/src/forward.rs#L212

I'm running this on an STM32L476-RG with stm32l4xx_hal but I'm sure its possible to derive a minimal test scenario for this.