daschl / ssd1327

A Rust display driver for the SSD1327
14 stars 6 forks source link

I2C Support #9

Closed CodedCraft closed 1 year ago

CodedCraft commented 1 year ago

Hey Daschl, I read your blog entry for this driver and in it you mention that it should be straight forward to enable I2C support. Could you point me in the right direction how your library would need to be adapted in order to support I2C? Liebe Grüsse nach Österreich

daschl commented 1 year ago

Hey @philip1987, thanks for your interest!

So in theory the way it should work is that the ssd1327 crate only depends on https://crates.io/crates/display-interface which acts as the abstraction layer. So the driver itself has no clue if it is connected via SPI or I2C in the first place. So instead of using https://crates.io/crates/display-interface-spi you should be able to use https://crates.io/crates/display-interface-i2c instead.

So here is how I have hooked it up via SPI in a real project https://github.com/daschl/rusty-pid/blob/master/controller/src/peripherals/display.rs#L38-L45 and you should be able to do it in a similar way but with the I2C component.

I haven't used it myself though...

CodedCraft commented 1 year ago

Thank you for your quick reply! I will give it a try and will report back. I am just starting out on my dev journey so it might take me a while to figure it out, but that's how you learn the fastest. Embedded Rust seems to be getting fairly viable these days with modular crates such as yours! Thank you again for your contributions and your excellent blog!

daschl commented 1 year ago

@philip1987 good luck on your journey then, let us know how it goes and if you run into any trouble.

daschl commented 1 year ago

I'll close this for now since I2C is done through the interface abstractions and not part of this repo, but feel free to reopen if something comes up.