-
Notifications
You must be signed in to change notification settings - Fork 863
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
Lora phy spidevice #2110
Lora phy spidevice #2110
Conversation
embassy-lora/src/stm32wl.rs
Outdated
Operation::Transfer(read, write) => self.bus.transfer(read, write).await?, | ||
Operation::TransferInPlace(buf) => self.bus.transfer_in_place(buf).await?, | ||
#[cfg(not(feature = "time"))] | ||
Operation::DelayUs(_) => return Err(SpiDeviceError::DelayUsNotSupported), |
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.
try blocks catch ?
but not return
. so this will return without deasserting NSS.
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.
I thought that might be an issue, but I stole that chunk directly from the embassy-embedded-hal SpiDevice. So we should fix it there as well.
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.
oh, oops. yes please! :D
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.
I took a stab at this, it works but I feel like there should be a less verbose/cleaner way of doing it.
Tested on wio-e5 module (stm32wle). Join sent to network so it should be good to go. |
be856a2
to
a9c8b0e
Compare
Operation::Write(buf) => bus.write(buf).await?, | ||
Operation::Transfer(read, write) => bus.transfer(read, write).await?, | ||
Operation::TransferInPlace(buf) => bus.transfer_in_place(buf).await?, | ||
Operation::Read(buf) => bus.read(buf).await.map_err(|e| SpiDeviceError::Spi(e))?, |
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.
you can do t.map_err(SpiDeviceError::Spi)
which is slightly shorter.
0ed58e5
to
674a373
Compare
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.
Nice work, looks good to me. Would it make sense to move it to embassy-stm32 eventually when this and the bits have landed?
yes! there was some discussion in the lora matrix about this. I think the best would be to split the trait to a separate And then remove embassy-lora, and perhaps move the lora examples to the lora repo. |
stm32wl SpiDevice support Remove return from try block in shared_bus and stm32wl
674a373
to
34bbc45
Compare
This depends on the breaking change in embassy-rs/lora-phy#35, thus the patch sections and draft status.
I suspect that the generics and error handling can be done better in the new SubGhzSpiDevice, but I want to get something up, as I don't have the hardware to test this.