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 support for GDEH0154D67 (aka epd1in54_v2) #106

Merged
merged 6 commits into from
Apr 13, 2022
Merged

Conversation

jcard0na
Copy link
Contributor

@jcard0na jcard0na commented Apr 6, 2022

The main changes from the previous version of the display, are the
lookup tables and the initialization procedures. Also, partial vs. full
updates have a slightly different logic.

The changes were mostly ported from the vendor driver (EPAPER.c) as well
as Waveshare example driver (EPD_1in54_V2.cpp). Both drivers are
released under public "use at will" license.

This was tested as:

use epd_waveshare::{epd1in54_v2::*, prelude::*};

let mut epd = Epd1in54::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;

epd.set_lut(&mut spi, Some(RefreshLut::Full))?;
epd.clear_frame(&mut spi, &mut delay)?;
epd.display_frame(&mut spi, &mut delay)?;

// display cleared, yay!

let mut display = Display1in54::default();

let bmp: Bmp<BinaryColor> = Bmp::from_slice(light_data)?;
let image = Image::new(&bmp, Point::zero());
image.draw(&mut display)?;

epd.set_lut(&mut spi, Some(RefreshLut::Quick))?;
epd.update_frame(&mut spi, &display.buffer(), &mut delay)?;
epd.display_frame(&mut spi, &mut delay)?;

// display shows image

#102 #79

The main changes from the previous version of the display, are the
lookup tables and the initialization procedures.  Also, partial vs. full
updates have a slightly different logic.

The changes were mostly ported from the vendor driver (EPAPER.c) as well
as Waveshare example driver (EPD_1in54_V2.cpp).  Both drivers are
released under public "use at will" license.

This was tested as:

```
use epd_waveshare::{epd1in54_v2::*, prelude::*};

let mut epd = Epd1in54::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;

epd.set_lut(&mut spi, Some(RefreshLut::Full))?;
epd.clear_frame(&mut spi, &mut delay)?;
epd.display_frame(&mut spi, &mut delay)?;

// display cleared, yay!

let mut display = Display1in54::default();

let bmp: Bmp<BinaryColor> = Bmp::from_slice(light_data)?;
let image = Image::new(&bmp, Point::zero());
image.draw(&mut display)?;

epd.set_lut(&mut spi, Some(RefreshLut::Quick))?;
epd.update_frame(&mut spi, &display.buffer(), &mut delay)?;
epd.display_frame(&mut spi, &mut delay)?;

// display shows image
```
@auto-assign auto-assign bot requested a review from caemor April 6, 2022 10:32
@jcard0na
Copy link
Contributor Author

jcard0na commented Apr 6, 2022

Question to the maintainer regarding this patch:

The file graphics.rs in this PR is an unmodified copy of the one in epd1in54. I would be inclined to just link to that one instead, to avoid code duplication and ensure that future fixes and additions are applied to both displays. What do you think?

@caemor
Copy link
Owner

caemor commented Apr 10, 2022

Question to the maintainer regarding this patch:

The file graphics.rs in this PR is an unmodified copy of the one in epd1in54. I would be inclined to just link to that one instead, to avoid code duplication and ensure that future fixes and additions are applied to both displays. What do you think?

Yes this sounds good, if they behave the same way.

src/type_a/constants.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/epd1in54_v2/graphics.rs Outdated Show resolved Hide resolved
Copy link
Owner

@caemor caemor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.
It nearly looks ready to merge besides the move of the graphics file and the LUTs.

Avoid code duplication and ensure that future fixes and additions to
the Display implementation are applied to both displays.
These tables are specific to that display, so no need to expose them to
others.
@jcard0na
Copy link
Contributor Author

I believe I addressed all the change requests. Let me know if there's anything else that should be addressed before merging.

@caemor
Copy link
Owner

caemor commented Apr 11, 2022

I think the new constants/LUTs file might be missing

@jcard0na
Copy link
Contributor Author

Duh! Sorry about that. Just added it.

@caemor
Copy link
Owner

caemor commented Apr 12, 2022

Duh! Sorry about that. Just added it.

Thanks. Now I believe it just needs the cargo fmt once more.

@jcard0na jcard0na requested a review from caemor April 13, 2022 14:49
@caemor
Copy link
Owner

caemor commented Apr 13, 2022

Thanks for your work 🥳

@caemor caemor merged commit b99a07c into caemor:main Apr 13, 2022
@lf94
Copy link

lf94 commented Apr 13, 2022

:o!!! Awesome work! Thank you!

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.

3 participants