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_powerdown for lilygo #179

Merged
merged 10 commits into from
May 10, 2022
22 changes: 22 additions & 0 deletions src/epd_driver/config_reg_v2.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,28 @@ static void cfg_poweron(epd_config_register_t *cfg) {
// END POWERON
}

#if defined(CONFIG_EPD_BOARD_REVISION_LILYGO_T5_47)
static void cfg_powerdown(epd_config_register_t *cfg) {
// This was re-purposed as power enable however it also disables the touch.
// this workaround may still leave power on to epd and as such may cause other
// problems such as grey screen.
cfg->pos_power_enable = false;
push_cfg(cfg);
busy_delay(10 * 240);

cfg->neg_power_enable = false;
cfg->pos_power_enable = false;
push_cfg(cfg);
busy_delay(100 * 240);

cfg->ep_stv = false;
cfg->ep_output_enable = false;
cfg->ep_mode = false;
cfg->power_disable = true;
push_cfg(cfg);
}
#endif

static void cfg_poweroff(epd_config_register_t *cfg) {
// POWEROFF
cfg->pos_power_enable = false;
Expand Down
7 changes: 7 additions & 0 deletions src/epd_driver/display_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ void epd_poweron() {
cfg_poweron(&config_reg);
}

#if defined(CONFIG_EPD_BOARD_REVISION_LILYGO_T5_47)
void epd_powerdown() {
cfg_powerdown(&config_reg);
i2s_gpio_detach();
}
#endif

void epd_poweroff() {
cfg_poweroff(&config_reg);
i2s_gpio_detach();
Expand Down
11 changes: 11 additions & 0 deletions src/epd_driver/include/epd_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,17 @@ void epd_deinit();
/** Enable display power supply. */
void epd_poweron();

#if defined(CONFIG_EPD_BOARD_REVISION_LILYGO_T5_47)
/** On lilygo disable display power but not touch screen.
* The epd power flag was re-purposed as power enable
* however it also disables the touch.
* this workaround may still leave power on to epd
* and as such may cause other problems such as grey screen.
* please also use poweroff when you sleep the system
* wake on touch will still work just not the I2C interface.
*/
void epd_powerdown();
#endif
/** Disable display power supply. */
void epd_poweroff();

Expand Down