-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add transactional SPI #35
Add transactional SPI #35
Conversation
r? @nastevens (rust_highfive has picked a reviewer for you, use r? to override) |
04cd071
to
35ff43e
Compare
Requires embedded-hal patch with feature/spi-transactions branch and transactional-spi feature
35ff43e
to
4acac31
Compare
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 <ryankurte@gmail.com> Co-authored-by: ryan <ryan@kurte.nz>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me! An update to e-h
alpha.4
would be necessary, though.
44: Implement transactional I2C interface and add example r=ryankurte a=eldruin I implemented the transactional I2C interface from rust-embedded/embedded-hal#223 and added an example with a driver which does a combined Write/Read transaction. This is based on previous work from #33 by @ryankurte, rust-embedded/rust-i2cdev#51 and is similar to #35. Co-authored-by: Diego Barrios Romero <eldruin@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me, thanks!
@posborne are you able to check this plz? |
44: Implement transactional I2C interface and add example r=ryankurte a=eldruin I implemented the transactional I2C interface from rust-embedded/embedded-hal#223 and added an example with a driver which does a combined Write/Read transaction. This is based on previous work from #33 by @ryankurte, rust-embedded/rust-i2cdev#51 and is similar to #35. Co-authored-by: Diego Barrios Romero <eldruin@gmail.com>
Ach, the build broke after the merge. Only trivial problems, though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me, transactional thanks!
I believe this is ready to go, but I'll let you confirm and give bors a kick @ryankurte |
great, thanks! bors r+ |
Build succeeded: |
Implementation of transactional SPI
Added transactional SPI interface embedded-hal#191Updated logic around sysfs/cdev pin selection #34Important: remove patch and bump hal version before merging