therealprof / display-interface

Rust crates providing a generic interface for display drivers and some default implementations (GPIO, SPI and I2C)
Apache License 2.0
73 stars 26 forks source link

Allow use of DataSize of 16 bits #35

Open marco-silva0000 opened 1 year ago

marco-silva0000 commented 1 year ago

I'm trying to use this library for an embeded project with an LCD that uses an SPI with 16 bits of data as DataSize. I can create the SPI correctly width let spi = Spi::<_, _, 16>::new(pac.SPI1); (note the 16 there) but then I get some issues because it doesn't implement write 8 like this library requires.

I don't think there's a way to allow 16 bit datasize currently so this would be an extension, I can play with hacking away at an implementation but I don't think I can do it neatly without a bunch of code duplication.

therealprof commented 1 year ago

The main reason why there's no 16bit interface is that I haven't come across a display which supports 16bit data. Would you mind pointing me to the datasheet for your LCD?

marco-silva0000 commented 1 year ago

I'm using the ILI9488 but the drivers for St7789 also work, I think. I've in the meanwhile found that it may support 8bit also, on page 69, but haven't tested it yet.

I'm using the Mipidsi crate as the driver

therealprof commented 1 year ago

As far as I know those displays exclusively support 8bit (and sometimes 9bit) word size on SPI, hence my question. I checked the data sheet you pointed to but I couldn't find any mentioning of a 16bit word size for SPI. If you look at 4.2.1 in the ILI9488 datasheet you can see that the 3-wire mode uses 9bit word size and the 4-wire mode uses 8bit word size.

tommy-gilligan commented 9 months ago

Much time has passed so I doubt this is helpful @marco-silva0000 :

I didn't realise that I could have been using Mipidsi crate so I ended up making https://github.com/tommy-gilligan/ili9488-rs (based on https://github.com/yuri91/ili9341-rs). I'm not sure if I'm using display-interface correctly but maybe it's a moot point because I'll try to use Mipidsi now. Thank you for the comment for helping me figure out the right thing to be using!