-
Notifications
You must be signed in to change notification settings - Fork 19
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
How to use i2c interface with esp-idf-hal? #6
Comments
Thanks for the report! I looked around the Basically we have three options here: The one where I do the work:I2CDriver does have an impl of the I definitely want to make this happen but I won't get to this until in a couple of weeks. (I would of course welcome a PR 😉) The one where the esp crew does the work:You could open an issue over there asking for an implementation of The one where you do the work:You can implement struct I2CWrapper<'a>(I2CDriver<'a>);
impl<'a> pn532::Interface for I2CWrapper<'a> {
...
} You can have a look at https://github.com/WMT-GmbH/pn532/blob/master/src/i2c.rs#L30-L60. I'll be glad to help you out if questions come up. |
Thank you for such a great reply! I'll report it to esp crew and maybe do a PR, as I think that's an error from their side. |
Will be fixed "soon-ish": esp-rs/esp-hal#1505 |
Thanks for your work! |
I'm having some issues doing this fix, struct I2CWrapper<'a>(I2cDriver<'a>);
impl<'a> pn532::Interface for I2CWrapper<'a> {
type Error = ErrorKind;
fn write(&mut self, frame: &[u8]) -> Result<(), Self::Error> {
I2CWrapper::write(self, frame)
}
fn wait_ready(&mut self) -> Poll<Result<(), Self::Error>> {
I2CWrapper::wait_ready(self)
}
fn read(&mut self, buf: &mut [u8]) -> Result<(), Self::Error> {
I2CWrapper::read(self, buf)
}
}
let mut pn532 = Pn532::new(I2CWrapper(i2cdriver), config);
if let Err(e) = pn532.process(&Request::sam_configuration(SAMMode::Normal, false), 0, 50.ms()){ I'm getting, |
Pn532 needs to implement for |
esp-idf-hal is implementation of embedded-hal for esp32. I cannot find any type that implements i2c::Transactional from embedded_hal. Am I missing something?
The text was updated successfully, but these errors were encountered: