Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
191: Added transactional SPI interface r=therealprof a=ryankurte This PR adds a transactional interface for SPI devices (#94), compatible with linux spidev. Split from #178 as I believe this is complete and useful, but that there is more experimentation required before (if?) the I2C component is landed, check there for previous reviews / discussion. **Demonstrated in:** - Linux embedded hal: rust-embedded/linux-embedded-hal#35 - STM32F4xx-hal: stm32-rs/stm32f4xx-hal#167 - embedded-spi driver abstraction (previously provided a polyfill for equivalent transactional functionality) https://github.com/ryankurte/rust-embedded-spi/pull/4/files#diff-74eea42f4e5e15399ac9184c8f2727a9R344 - sx128x radio driver: rust-iot/rust-radio-sx128x#5 **Notes:** - `Operation::Transfer` uses one buffer to allow polyfill using the existing `Transfer` trait (with the convenient side effect of reducing memory requirements) - `W` has a static bound as it _should_ only ever be a type with static lifetime (u8, u16 etc., not a reference), and to differentiate this from `'a` which is the lifetime of the data in the object and only bound to the function - `exec(.., &mut [Operation])` is chosen over `exec<O: AsMut<[Operation]>(..)` as the latter imposes limits on generic types using this trait (which i ran into, see [E0038](https://doc.rust-lang.org/error-index.html#E0038)) cc. @rust-embedded/hal folks, @eldruin, @RandomInsano, @Rahix, @austinglaser for opinions / review Co-authored-by: Ryan Kurte <[email protected]> Co-authored-by: ryan <[email protected]>
- Loading branch information