From ba5203613f71699af23d47735ce4a529b0a038e0 Mon Sep 17 00:00:00 2001 From: gemu2015 Date: Thu, 4 Mar 2021 19:05:59 +0100 Subject: [PATCH] rename epaper 42 cmds --- .../Epaper_42-gemu-1.0/epd4in2.cpp | 72 +++++++++--------- lib/lib_display/Epaper_42-gemu-1.0/epd4in2.h | 76 +++++++++---------- 2 files changed, 74 insertions(+), 74 deletions(-) diff --git a/lib/lib_display/Epaper_42-gemu-1.0/epd4in2.cpp b/lib/lib_display/Epaper_42-gemu-1.0/epd4in2.cpp index 85da5848d..bd4b2d8cb 100644 --- a/lib/lib_display/Epaper_42-gemu-1.0/epd4in2.cpp +++ b/lib/lib_display/Epaper_42-gemu-1.0/epd4in2.cpp @@ -115,19 +115,19 @@ int Epd42::Init(void) { height = EPD_HEIGHT42; Reset(); - SendCommand(POWER_SETTING); + SendCommand(EPD_42_POWER_SETTING); SendData(0x03); // VDS_EN, VDG_EN SendData(0x00); // VCOM_HV, VGHL_LV[1], VGHL_LV[0] SendData(0x2b); // VDH SendData(0x2b); // VDL SendData(0xff); // VDHR - SendCommand(BOOSTER_SOFT_START); + SendCommand(EPD_42_BOOSTER_SOFT_START); SendData(0x17); SendData(0x17); SendData(0x17); //07 0f 17 1f 27 2F 37 2f - SendCommand(POWER_ON); + SendCommand(EPD_42_POWER_ON); WaitUntilIdle(); - SendCommand(PANEL_SETTING); + SendCommand(EPD_42_PANEL_SETTING); // SendData(0xbf); // KW-BF KWR-AF BWROTP 0f // SendData(0x0b); // SendData(0x0F); //300x400 Red mode, LUT from OTP @@ -135,7 +135,7 @@ int Epd42::Init(void) { SendData(0x3F); //300x400 B/W mode, LUT set by register // SendData(0x2F); //300x400 Red mode, LUT set by register - SendCommand(PLL_CONTROL); + SendCommand(EPD_42_PLL_CONTROL); SendData(0x3C); // 3A 100Hz 29 150Hz 39 200Hz 31 171Hz 3C 50Hz (default) 0B 10Hz //SendData(0x0B); //0B is 10Hz /* EPD hardware init end */ @@ -184,8 +184,8 @@ void Epd42::Reset(void) { * @brief: transmit partial data to the SRAM. The final parameter chooses between dtm=1 and dtm=2 */ void Epd42::SetPartialWindow(const unsigned char* buffer_black, int x, int y, int w, int l, int dtm) { - SendCommand(PARTIAL_IN); - SendCommand(PARTIAL_WINDOW); + SendCommand(EPD_42_PARTIAL_IN); + SendCommand(EPD_42_PARTIAL_WINDOW); SendData(x >> 8); SendData(x & 0xf8); // x should be the multiple of 8, the last 3 bit will always be ignored SendData(((x & 0xf8) + w - 1) >> 8); @@ -196,7 +196,7 @@ void Epd42::SetPartialWindow(const unsigned char* buffer_black, int x, int y, in SendData((y + l - 1) & 0xff); SendData(0x01); // Gates scan both inside and outside of the partial window. (default) // DelayMs(2); - SendCommand((dtm == 1) ? DATA_START_TRANSMISSION_1 : DATA_START_TRANSMISSION_2); + SendCommand((dtm == 1) ? EPD_42_DATA_START_TRANSMISSION_1 : EPD_42_DATA_START_TRANSMISSION_2); if (buffer_black != NULL) { for(int i = 0; i < w / 8 * l; i++) { SendData(buffer_black[i]^0xff); @@ -207,7 +207,7 @@ void Epd42::SetPartialWindow(const unsigned char* buffer_black, int x, int y, in } } // DelayMs(2); - SendCommand(PARTIAL_OUT); + SendCommand(EPD_42_PARTIAL_OUT); } @@ -217,27 +217,27 @@ void Epd42::SetPartialWindow(const unsigned char* buffer_black, int x, int y, in */ void Epd42::SetLut(void) { unsigned int count; - SendCommand(LUT_FOR_VCOM); //vcom + SendCommand(EPD_42_LUT_FOR_VCOM); //vcom for(count = 0; count < 44; count++) { SendData(pgm_read_byte(&lut_vcom0[count])); } - SendCommand(LUT_WHITE_TO_WHITE); //ww -- + SendCommand(EPD_42_LUT_WHITE_TO_WHITE); //ww -- for(count = 0; count < 42; count++) { SendData(pgm_read_byte(&lut_ww[count])); } - SendCommand(LUT_BLACK_TO_WHITE); //bw r + SendCommand(EPD_42_LUT_BLACK_TO_WHITE); //bw r for(count = 0; count < 42; count++) { SendData(pgm_read_byte(&lut_bw[count])); } - SendCommand(LUT_WHITE_TO_BLACK); //wb w + SendCommand(EPD_42_LUT_WHITE_TO_BLACK); //wb w for(count = 0; count < 42; count++) { SendData(pgm_read_byte(&lut_wb[count])); } - SendCommand(LUT_BLACK_TO_BLACK); //bb b + SendCommand(EPD_42_LUT_BLACK_TO_BLACK); //bb b for(count = 0; count < 42; count++) { SendData(pgm_read_byte(&lut_bb[count])); } @@ -250,27 +250,27 @@ void Epd42::SetLut(void) { void Epd42::SetLutQuick(void) { unsigned int count; - SendCommand(LUT_FOR_VCOM); //vcom + SendCommand(EPD_42_LUT_FOR_VCOM); //vcom for(count = 0; count < 44; count++) { SendData(pgm_read_byte(&lut_vcom0_quick[count])); } - SendCommand(LUT_WHITE_TO_WHITE); //ww -- + SendCommand(EPD_42_LUT_WHITE_TO_WHITE); //ww -- for(count = 0; count < 42; count++) { SendData(pgm_read_byte(&lut_ww_quick[count])); } - SendCommand(LUT_BLACK_TO_WHITE); //bw r + SendCommand(EPD_42_LUT_BLACK_TO_WHITE); //bw r for(count = 0; count < 42; count++) { SendData(pgm_read_byte(&lut_bw_quick[count])); } - SendCommand(LUT_WHITE_TO_BLACK); //wb w + SendCommand(EPD_42_LUT_WHITE_TO_BLACK); //wb w for(count = 0; count < 42; count++) { SendData(pgm_read_byte(&lut_wb_quick[count])); } - SendCommand(LUT_BLACK_TO_BLACK); //bb b + SendCommand(EPD_42_LUT_BLACK_TO_BLACK); //bb b for(count = 0; count < 42; count++) { SendData(pgm_read_byte(&lut_bb_quick[count])); } @@ -281,25 +281,25 @@ void Epd42::SetLutQuick(void) { * @brief: refresh and displays the frame */ void Epd42::DisplayFrame(const unsigned char* frame_buffer) { - SendCommand(RESOLUTION_SETTING); + SendCommand(EPD_42_RESOLUTION_SETTING); SendData(width >> 8); SendData(width & 0xff); SendData(height >> 8); SendData(height & 0xff); - SendCommand(VCM_DC_SETTING); + SendCommand(EPD_42_VCM_DC_SETTING); SendData(0x12); - SendCommand(VCOM_AND_DATA_INTERVAL_SETTING); + SendCommand(EPD_42_VCOM_AND_DATA_INTERVAL_SETTING); SendCommand(0x97); //VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7 if (frame_buffer != NULL) { - SendCommand(DATA_START_TRANSMISSION_1); + SendCommand(EPD_42_DATA_START_TRANSMISSION_1); for(int i = 0; i < width / 8 * height; i++) { SendData(0xFF); // bit set: white, bit reset: black } delay(2); - SendCommand(DATA_START_TRANSMISSION_2); + SendCommand(EPD_42_DATA_START_TRANSMISSION_2); for(int i = 0; i < width / 8 * height; i++) { SendData(pgm_read_byte(&frame_buffer[i])); } @@ -308,7 +308,7 @@ void Epd42::DisplayFrame(const unsigned char* frame_buffer) { SetLut(); - SendCommand(DISPLAY_REFRESH); + SendCommand(EPD_42_DISPLAY_REFRESH); delay(100); WaitUntilIdle(); } @@ -320,19 +320,19 @@ void Epd42::DisplayFrame(const unsigned char* frame_buffer) { * @brief: clear the frame data from the SRAM, this won't refresh the display */ void Epd42::ClearFrame(void) { - SendCommand(RESOLUTION_SETTING); + SendCommand(EPD_42_RESOLUTION_SETTING); SendData(width >> 8); SendData(width & 0xff); SendData(height >> 8); SendData(height & 0xff); - SendCommand(DATA_START_TRANSMISSION_1); + SendCommand(EPD_42_DATA_START_TRANSMISSION_1); delay(2); for(int i = 0; i < width / 8 * height; i++) { SendData(0xFF); } delay(2); - SendCommand(DATA_START_TRANSMISSION_2); + SendCommand(EPD_42_DATA_START_TRANSMISSION_2); delay(2); for(int i = 0; i < width / 8 * height; i++) { SendData(0xFF); @@ -347,14 +347,14 @@ void Epd42::ClearFrame(void) { */ void Epd42::DisplayFrame(void) { SetLut(); - SendCommand(DISPLAY_REFRESH); + SendCommand(EPD_42_DISPLAY_REFRESH); delay(100); WaitUntilIdle(); } void Epd42::DisplayFrameQuick(void) { SetLutQuick(); - SendCommand(DISPLAY_REFRESH); + SendCommand(EPD_42_DISPLAY_REFRESH); // DelayMs(100); // WaitUntilIdle(); } @@ -367,13 +367,13 @@ void Epd42::DisplayFrameQuick(void) { * You can use Epd::Reset() to awaken and use Epd::Init() to initialize. */ void Epd42::Sleep() { - SendCommand(VCOM_AND_DATA_INTERVAL_SETTING); + SendCommand(EPD_42_VCOM_AND_DATA_INTERVAL_SETTING); SendData(0x17); //border floating - SendCommand(VCM_DC_SETTING); //VCOM to 0V - SendCommand(PANEL_SETTING); + SendCommand(EPD_42_VCM_DC_SETTING); //VCOM to 0V + SendCommand(EPD_42_PANEL_SETTING); delay(100); - SendCommand(POWER_SETTING); //VG&VS to 0V fast + SendCommand(EPD_42_POWER_SETTING); //VG&VS to 0V fast SendData(0x00); SendData(0x00); SendData(0x00); @@ -381,9 +381,9 @@ void Epd42::Sleep() { SendData(0x00); delay(100); - SendCommand(POWER_OFF); //power off + SendCommand(EPD_42_POWER_OFF); //power off WaitUntilIdle(); - SendCommand(DEEP_SLEEP); //deep sleep + SendCommand(EPD_42_DEEP_SLEEP); //deep sleep SendData(0xA5); } diff --git a/lib/lib_display/Epaper_42-gemu-1.0/epd4in2.h b/lib/lib_display/Epaper_42-gemu-1.0/epd4in2.h index 1ca993873..a055f38c1 100644 --- a/lib/lib_display/Epaper_42-gemu-1.0/epd4in2.h +++ b/lib/lib_display/Epaper_42-gemu-1.0/epd4in2.h @@ -34,44 +34,44 @@ #define EPD_HEIGHT42 300 // EPD4IN2 commands -#define PANEL_SETTING 0x00 -#define POWER_SETTING 0x01 -#define POWER_OFF 0x02 -#define POWER_OFF_SEQUENCE_SETTING 0x03 -#define POWER_ON 0x04 -#define POWER_ON_MEASURE 0x05 -#define BOOSTER_SOFT_START 0x06 -#define DEEP_SLEEP 0x07 -#define DATA_START_TRANSMISSION_1 0x10 -#define DATA_STOP 0x11 -#define DISPLAY_REFRESH 0x12 -#define DATA_START_TRANSMISSION_2 0x13 -#define LUT_FOR_VCOM 0x20 -#define LUT_WHITE_TO_WHITE 0x21 -#define LUT_BLACK_TO_WHITE 0x22 -#define LUT_WHITE_TO_BLACK 0x23 -#define LUT_BLACK_TO_BLACK 0x24 -#define PLL_CONTROL 0x30 -#define TEMPERATURE_SENSOR_COMMAND 0x40 -#define TEMPERATURE_SENSOR_SELECTION 0x41 -#define TEMPERATURE_SENSOR_WRITE 0x42 -#define TEMPERATURE_SENSOR_READ 0x43 -#define VCOM_AND_DATA_INTERVAL_SETTING 0x50 -#define LOW_POWER_DETECTION 0x51 -#define TCON_SETTING 0x60 -#define RESOLUTION_SETTING 0x61 -#define GSST_SETTING 0x65 -#define GET_STATUS 0x71 -#define AUTO_MEASUREMENT_VCOM 0x80 -#define READ_VCOM_VALUE 0x81 -#define VCM_DC_SETTING 0x82 -#define PARTIAL_WINDOW 0x90 -#define PARTIAL_IN 0x91 -#define PARTIAL_OUT 0x92 -#define PROGRAM_MODE 0xA0 -#define ACTIVE_PROGRAMMING 0xA1 -#define READ_OTP 0xA2 -#define POWER_SAVING 0xE3 +#define EPD_42_PANEL_SETTING 0x00 +#define EPD_42_POWER_SETTING 0x01 +#define EPD_42_POWER_OFF 0x02 +#define EPD_42_POWER_OFF_SEQUENCE_SETTING 0x03 +#define EPD_42_POWER_ON 0x04 +#define EPD_42_POWER_ON_MEASURE 0x05 +#define EPD_42_BOOSTER_SOFT_START 0x06 +#define EPD_42_DEEP_SLEEP 0x07 +#define EPD_42_DATA_START_TRANSMISSION_1 0x10 +#define EPD_42_DATA_STOP 0x11 +#define EPD_42_DISPLAY_REFRESH 0x12 +#define EPD_42_DATA_START_TRANSMISSION_2 0x13 +#define EPD_42_LUT_FOR_VCOM 0x20 +#define EPD_42_LUT_WHITE_TO_WHITE 0x21 +#define EPD_42_LUT_BLACK_TO_WHITE 0x22 +#define EPD_42_LUT_WHITE_TO_BLACK 0x23 +#define EPD_42_LUT_BLACK_TO_BLACK 0x24 +#define EPD_42_PLL_CONTROL 0x30 +#define EPD_42_TEMPERATURE_SENSOR_COMMAND 0x40 +#define EPD_42_TEMPERATURE_SENSOR_SELECTION 0x41 +#define EPD_42_TEMPERATURE_SENSOR_WRITE 0x42 +#define EPD_42_TEMPERATURE_SENSOR_READ 0x43 +#define EPD_42_VCOM_AND_DATA_INTERVAL_SETTING 0x50 +#define EPD_42_LOW_POWER_DETECTION 0x51 +#define EPD_42_TCON_SETTING 0x60 +#define EPD_42_RESOLUTION_SETTING 0x61 +#define EPD_42_GSST_SETTING 0x65 +#define EPD_42_GET_STATUS 0x71 +#define EPD_42_AUTO_MEASUREMENT_VCOM 0x80 +#define EPD_42_READ_VCOM_VALUE 0x81 +#define EPD_42_VCM_DC_SETTING 0x82 +#define EPD_42_PARTIAL_WINDOW 0x90 +#define EPD_42_PARTIAL_IN 0x91 +#define EPD_42_PARTIAL_OUT 0x92 +#define EPD_42_PROGRAM_MODE 0xA0 +#define EPD_42_ACTIVE_PROGRAMMING 0xA1 +#define EPD_42_READ_OTP 0xA2 +#define EPD_42_POWER_SAVING 0xE3 extern const unsigned char lut_vcom0[]; extern const unsigned char lut_ww[];