#include "gdew042t2_epd.h" gd_epd_042_ret_t gd_epd_042_init(gd_epd_042_t *epd) { epd->cb.reset_cb(epd->user_data); uint8_t tx_buf[4] = { 0x06, 0x17, 0x17, 0x17 }; epd->cb.write_cmd_cb(epd->user_data, tx_buf, 0x04); tx_buf[0] = 0x04; epd->cb.write_cmd_cb(epd->user_data, tx_buf, 0x01); epd->cb.poll_busy_cb(epd->user_data); tx_buf[0] = 0x00; tx_buf[1] = 0x1F; tx_buf[2] = 0x0D; epd->cb.write_cmd_cb(epd->user_data, tx_buf, 0x03); return EPD_OK; } gd_epd_042_ret_t gd_epd_042_deepsleep(gd_epd_042_t *epd) { uint8_t tx_buf[3] = { 0x50, 0xF7 }; epd->cb.write_cmd_cb(epd->user_data, tx_buf, 0x02); tx_buf[0] = 0x02; epd->cb.write_cmd_cb(epd->user_data, tx_buf, 0x01); epd->cb.poll_busy_cb(epd->user_data); tx_buf[0] = 0x07; tx_buf[1] = 0xA5; epd->cb.write_cmd_cb(epd->user_data, tx_buf, 0x01); return EPD_OK; } gd_epd_042_ret_t gd_epd_042_load(gd_epd_042_t *epd, uint8_t *old_data, uint8_t *new_data) { uint8_t tx_buf[2] = { 0x10 }; epd->cb.write_cmd_cb(epd->user_data, tx_buf, 0x01); epd->cb.write_data_cb(epd->user_data, old_data, 400 * 300 / 8); tx_buf[0] = 0x13; epd->cb.write_cmd_cb(epd->user_data, tx_buf, 0x01); epd->cb.write_data_cb(epd->user_data, new_data, 400 * 300 / 8); return EPD_OK; } gd_epd_042_ret_t gd_epd_042_update(gd_epd_042_t *epd) { uint8_t tx_buf[2] = { 0x12 }; epd->cb.write_cmd_cb(epd->user_data, tx_buf, 0x01); epd->cb.poll_busy_cb(epd->user_data); return EPD_OK; }