almindor / mipidsi

MIPI Display Serial Interface unified driver
MIT License
108 stars 46 forks source link

Colors are reversed on st7735s tft display #49

Closed togisoft closed 1 year ago

togisoft commented 1 year ago

I tried a lot, but I couldn't find a solution about the colors.

Rgb565::WHITE -> Outputs black Rgb565::BLACK -> Outputs white

My code:

    let spi = spi::Spi::new(
        peripherals.SPI2,
        io.pins.gpio4,   
        io.pins.gpio5,   
        io.pins.gpio25,   
        io.pins.gpio13,   
        100u32.kHz(),
        SpiMode::Mode0, 
        &mut system.peripheral_clock_control,
        &clocks,
    );

    let reset = io.pins.gpio26.into_push_pull_output();
    let di = SPIInterfaceNoCS::new(spi, io.pins.gpio15.into_push_pull_output());

    let mut display = mipidsi::Builder::st7735s(di)
        .with_display_size(128,160)
        .with_color_order(ColorOrder::Rgb) // Even if I did BGR the problem didn't go away
        .init(&mut delay, Some(reset))
        .unwrap();
    display.clear(Rgb565::BLACK).unwrap();
rfuest commented 1 year ago

I tried a lot, but I couldn't find a solution about the colors.

Did you already try to add with_invert_colors(true) to the builder calls?

togisoft commented 1 year ago

Method not found

  .with_invert_colors(true)
   |          ^^^^^^^^^^^^^^^^^^ method not found in `Builder<SPIInterfaceNoCS<Spi<esp32_hal::esp32::SPI2>, GpioPin<Output<PushPull>, Bank0GpioRegisterAccess, InputOutputAnalogPinType, 15>>, ST7735s>`
rfuest commented 1 year ago

OK, sorry I did forget that this method wasn't included in the latest released version. You could try to use the GIT version until the next version is released.

togisoft commented 1 year ago
        .with_invert_colors(false)

run when false. thank you

almindor commented 1 year ago

I believe this is outdated/fixed now, please re-open if this is still a problem.