Skip to content
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

WeActStudio display support #201

Open
avsaase opened this issue May 29, 2024 · 1 comment
Open

WeActStudio display support #201

avsaase opened this issue May 29, 2024 · 1 comment
Labels
discussion An open discussion for new displays, boards.

Comments

@avsaase
Copy link

avsaase commented May 29, 2024

Hi, I was wondering if anyone has had success with using this driver with WeActStudio displays sold on AliExpress. They are solde in 1.54, 2.13 and 2.9 inch sizes in B/W and B/W/R versions and are quite cheap. According to the product description the B/W versions support partial refreshes.

I have a 2.9 inch B/W version and I'm able to drive it using the epd2in9_v2 driver but I'm encountering a few problems. I'm able to draw basic lines on the screen but the background color is fixed to black and there's a white border around the screen. During a refresh the border flashes in the inverted color of the center of the display. It doesn't look like I'm able to draw within the white border.

Here's my test code for the RP2040 using the embassy-rp hal:

#![no_std]
#![no_main]

use defmt_rtt as _;
use embassy_executor::Spawner;
use embassy_rp::{
    gpio::{Input, Level, Output, Pull},
    spi::{Config, Spi},
};
use embassy_time::Delay;
use embedded_graphics::Drawable;
use embedded_graphics::{
    geometry::Point,
    primitives::{Line, Primitive, PrimitiveStyle},
};
use embedded_hal_bus::spi::ExclusiveDevice;
use epd_waveshare::{
    color::Color,
    epd2in9_v2::{Display2in9, Epd2in9},
    prelude::WaveshareDisplay,
};
use panic_probe as _;

#[embassy_executor::main]
async fn main(_spawner: Spawner) {
    let p = embassy_rp::init(Default::default());

    let busy = Input::new(p.PIN_16, Pull::Up);
    let res = Output::new(p.PIN_20, Level::Low);
    let dc = Output::new(p.PIN_21, Level::Low);
    let cs = Output::new(p.PIN_22, Level::High);
    let scl = p.PIN_18;
    let sda = p.PIN_19;
    let mut delay = Delay;

    let spi_bus = Spi::new_blocking_txonly(p.SPI0, scl, sda, Config::default());
    let mut spi_device = ExclusiveDevice::new(spi_bus, cs, Delay);

    let mut epd = Epd2in9::new(&mut spi_device, busy, dc, res, &mut delay, None).unwrap();

    epd.set_background_color(Color::White); // Changing this doesn't do anything
    epd.clear_frame(&mut spi_device, &mut delay).unwrap();
    epd.display_frame(&mut spi_device, &mut delay).unwrap();

    let mut display = Display2in9::default();

    let _ = Line::new(Point::new(64, 0), Point::new(64, 296))
        .into_styled(PrimitiveStyle::with_stroke(Color::Black, 5)) // When I change the color to white I get a white line
        .draw(&mut display);

    epd.update_and_display_frame(&mut spi_device, &display.buffer(), &mut delay)
        .unwrap();
}

IMG20240529232239

Clearly the driver is similar but not exactly compatible. I haven dug into the details yet, I wanted to post here first in case someone else already looked into it.

More info about the displays can be found in https://github.com/WeActStudio/WeActStudio.EpaperModule.

@avsaase
Copy link
Author

avsaase commented May 29, 2024

I see now that some other displays have a function to set a border color so most likely this display has a single color border as well.

@caemor caemor removed their assignment Oct 28, 2024
@caemor caemor added the discussion An open discussion for new displays, boards. label Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion An open discussion for new displays, boards.
Projects
None yet
Development

No branches or pull requests

2 participants