Embedded-Hal PR - incoorparate e-hal master changes in spi / i2c / gpio / delay - #224
Conversation
| bus.transfer_in_place(words) | ||
| } | ||
| }?; | ||
| for op in operations { |
There was a problem hiding this comment.
This still needs work. Should just convert the 0.2 Operation to 1.0 Operation, otherwise it will not do it in one transaction.
| T: Borrow<SpiDriver<'d>> + 'd, | ||
| { | ||
| type Bus = SpiBusDriver<()>; | ||
| fn read_transaction(&mut self, operations: &mut [&mut [u8]]) -> Result<(), Self::Error> { |
There was a problem hiding this comment.
Its a lot of duplication here from transaction. The problem is the transaction takes an &mut [Operation<'_, u8>] but this read_transaction is &mut [&mut [u8]]. We would need something that converts the &mut [u8] in an Operation::Read
| where | ||
| T: Borrow<SpiDriver<'d>> + 'd, | ||
| { | ||
| fn write_transaction(&mut self, operations: &[&[u8]]) -> Result<(), Self::Error> { |
There was a problem hiding this comment.
same as read_transaction
|
keep track with e-hal master -> i2c iter fn trait imps where removed rust-embedded/embedded-hal#440 |
| GpioError::other(err) | ||
| } | ||
|
|
||
| impl<'d, T: Pin, MODE> embedded_hal::digital::ErrorType for PinDriver<'d, T, MODE> { |
There was a problem hiding this comment.
this is kinda hacky... the embedded_hal_error! doesnt work for the ulp_processor .... so a lot of feature flags. Ideas how to do that better welcome.
There was a problem hiding this comment.
Maybe try to make embedded_hal_error compatible with the ulp mini-HAL? EspError does exist when the mini-HAL is enabled, so perhaps you can conditionalize the macro body itself, rather than conditionalizing all places where it is used?
There was a problem hiding this comment.
did it in fe4875c though i have a follow up question, it builds and seem to work, but i thought that one should use absolute path, inside a macro, though it works if i use the cfg feature like that outside the macro. What is your opinion on that? This way the macro is cleaner to read but i am not sure if this is correct.
There was a problem hiding this comment.
i duplicate the macro now if used in ulp context d877faa to circumvent possible macro errors
| break; | ||
| } | ||
| } | ||
| let mut bus = SpiBusDriver { |
There was a problem hiding this comment.
if unstable chunked_iter would be available this could be all gone.
|
ci fails duo to rust-lang/crates.io#6306 |
This PR is in preparation of this PR
It will also resolve issue rust-lang/cargo#99 and will supersede PR rust-lang/cargo#223 & PR rust-lang/cargo#138
The linked embedded-hal PR also already implements changes from current master embedded-hal::delay & embedded-hal::digital, therefore this PR made also changes to gpio.rs and mod.rs to make it work.
Edit1: also incorporate the i2c ehal master changes merged rust-embedded/embedded-hal#440
Edit2: also impl pwm traits inside ledc.rs