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

Add EPD 4in2bc support #144

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add EPD 4in2bc support #144

wants to merge 1 commit into from

Conversation

yurinnick
Copy link

@yurinnick yurinnick commented Jan 26, 2023

So... Does it work? Well, mostly. Display works fine as far as I can tell, however color coding is broken. For some reason 4in2bc uses a completely different scheme than anything implemented.

// 4in2bc
// White bw - 0xFF c - 0xFF
// Black bw - 0 c - 0xFF
// Red bw - 0 c - 0

// bwrbit = true
// White: bw - 0xFF c - 0
// Black: bw - 0 c - 0
// Red: bw - 0 c - 0xFF

// bwrbit = false
// White: bw - 0xFF c - 0
// Black: bw - 0 c - 0
// Red: bw - 0xFF c - 0xFF

@caemor could you help with extending TriColor implementation to match these requirements? I am willing to do it myself, let's just agree on the best way to approach it. Thanks!

@yurinnick
Copy link
Author

yurinnick commented Jan 31, 2023

After this modification colors render correctly. I need to look how to integrate it with current implementation.

impl ColorType for TriColor {
    const BITS_PER_PIXEL_PER_BUFFER: usize = 1;
    const BUFFER_COUNT: usize = 2;

    fn bitmask(&self, bwrbit: bool, pos: u32) -> (u8, u16) {
        let bit = 0x80 >> (pos % 8);
        let mask = match self {
            TriColor::Black => (bit as u16) << 8,
            TriColor::White => (bit as u16) << 8 | bit as u16,
            TriColor::Chromatic => 0u16,
        };
        (!bit, mask)
    }
}

@yurinnick
Copy link
Author

Also, update_partial_frame() doesn't work for whatever reason.

@yurinnick yurinnick changed the title [WIP] Add EPD 4in2bc support Add EPD 4in2bc support Feb 10, 2023
@simon0356
Copy link

Hello Yurinnick,
I was working on an implementation on the same screen and got the same issue about the chromatic buffer which is inverted.
I have tested your implementation and can confirm it is working on EPD4IN2bc screen
As a reference i use the EPD_4in2b_V2 example code from Waveshare here : https://github.com/waveshare/e-Paper

Thanks for your work,
Simon

@struckoff
Copy link

Sup guys, any plans on releasing this one?

@yurinnick
Copy link
Author

@caemor could you provide feedback please?

@caemor caemor mentioned this pull request Oct 30, 2024
@piedoom
Copy link

piedoom commented Nov 18, 2024

Is there any additional work that needs to be done for this to be merged in, or any help needed? I would love to use this on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants