Skip to content
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

Should we get rid of nb::Result for inherent functions? #2807

Open
Tracked by #2494
bjoernQ opened this issue Dec 13, 2024 · 2 comments · May be fixed by #2882
Open
Tracked by #2494

Should we get rid of nb::Result for inherent functions? #2807

bjoernQ opened this issue Dec 13, 2024 · 2 comments · May be fixed by #2882
Assignees
Labels
Milestone

Comments

@bjoernQ
Copy link
Contributor

bjoernQ commented Dec 13, 2024

Should be a general decision - not just for SPI.
If we don't want that - what about embedded-hal-nb?

@bjoernQ bjoernQ added the peripheral:spi SPI peripheral label Dec 13, 2024
@MabezDev MabezDev added this to the 1.0.0-beta.0 milestone Dec 17, 2024
@jessebraham
Copy link
Member

I think probably it's reasonable to return an Option from read_byte based on whether or not we're able to read, then we can just converted this into the appropriate return type in the embedded_hal_nb implementation (e.g. Some -> Ok, None -> Err).

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Dec 18, 2024

Had another look and while for something like read_byte returning Option even feels more natural there are other places where it's not that easy.

e.g. write_byte,flush_tx, some functions in the crypto-accelerator drivers (some are questionable - e.g. Hmac::configure never returns WouldBlock), there are usages in SPI and TWAI, in PeriodicTimer::wait and ADC

@SergioGasquez SergioGasquez self-assigned this Jan 2, 2025
@SergioGasquez SergioGasquez linked a pull request Jan 7, 2025 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

4 participants