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

impl embedded_hal::digital::Error for linux_embedded_hal::gpio_cdev::Error #112

Open
SpieringsAE opened this issue Feb 9, 2024 · 2 comments

Comments

@SpieringsAE
Copy link

I'm trying to write an initialisation function for a driver, but the fact that the pin initialisation functions don't give me an embedded-hal Error trait is being a bit of a pain in the behind for me.
I can't properly incorperate the errors that arise when setting up gpios in my drivers error enum.

My situation is an SPI device that has two additional gpios, a reset and an interrupt pin.
This is a very hardware specific driver so the pins and spidev are created in the driver::new() function.

The linux_embedded_hal::spi::SPIError does implement embedded_hal::spi::Error so that one is fine I think.

Is this a workable idea?

@reitermarkus
Copy link
Member

Would the implementation in #110 solve your issue as well?

In there, the CdevPin::new method returns a CdevPinError defined in this crate instead of needing to construct the CdevPin from the external type as is currently the case.

@SpieringsAE
Copy link
Author

SpieringsAE commented Feb 10, 2024

I think yes that could very much do that.
I also think my request isn't possible, as the gpio_cdev::Error Is just a re-export so this crate doesn't influence it.
So yeah it seems like there needs to be a linux-embedded-hal way to create a pin without having to deal with gpio-cdev errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants