JohnDoneth / hd44780-driver

Implementation of the embedded-hal traits for the HD44780.
MIT License
37 stars 40 forks source link

Add an I2CBus to the available buses #13

Closed nils-van-zuijlen closed 4 years ago

nils-van-zuijlen commented 4 years ago

It handles I2C backpacks as described in #12

nils-van-zuijlen commented 4 years ago

I tested it with the example on my Nucleo-F303RE with the LCD and backpack available on https://shop.mchobby.be/fr/afficheur-lcd-tft-oled/881-lcd-20x4-backpack-i2c-blanc-sur-bleu-3232100008816.html and it worked successfully.

nils-van-zuijlen commented 4 years ago

You may need to update examples/stm32f30x-i2c/.cargo/config and examples/stm32f30x-i2c/memory.x for your particular MCU.

JohnDoneth commented 4 years ago

Thanks for the PR! This is really cool! It didn't occur to me that we could implement the Databus trait for I2C. I bet we could implement SPI in the future as well... :thinking:. Anyway, is this ready to merge? I'll keep a note to update those configs on the stm example.

nils-van-zuijlen commented 4 years ago

It is ready to merge, unless you know a way to share an I2C peripheral between two structures, because you could want to connect two different screens to the same I2C bus.

nils-van-zuijlen commented 4 years ago

LGTM

JohnDoneth commented 4 years ago

Thanks for this! 👍