diff --git a/Example/EpaperModuleTest_APM32F103/Epaper/epaper.c b/Example/EpaperModuleTest_APM32F103/Epaper/epaper.c
index 0514bfd..5120719 100644
--- a/Example/EpaperModuleTest_APM32F103/Epaper/epaper.c
+++ b/Example/EpaperModuleTest_APM32F103/Epaper/epaper.c
@@ -219,6 +219,7 @@ uint8_t epd_init(void)
if (epd_wait_busy())
return 1;
+ #if defined(EPD_29) || defined(EPD_213) || defined(EPD_154)
epd_write_reg(0x01); // Driver output control
#if defined(EPD_29) || defined(EPD_213)
epd_write_data(0x27);
@@ -262,6 +263,21 @@ uint8_t epd_init(void)
epd_write_reg(0x21); // Display update control
epd_write_data(0x00);
epd_write_data(0x80);
+ #endif
+
+ #elif defined(EPD_42)
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x40);
+ epd_write_data(0x00);
+ epd_write_reg(0x01); // Set MUX as 300
+ epd_write_data(0x2B);
+ epd_write_data(0x01);
+ epd_write_data(0x00);
+ epd_write_reg(0x3C); //BorderWavefrom
+ epd_write_data(0x01);
+ epd_write_reg(0x11); // data entry mode
+ epd_write_data(0x03); // X-mode
+ epd_address_set(0,0,EPD_W-1,EPD_H-1);
#endif
epd_write_reg(0x18); // Read built-in temperature sensor
@@ -289,6 +305,12 @@ uint8_t epd_init_partial(void)
}
_epd_write_data_over();
epd_cs_set();
+ #elif defined(EPD_42)
+ epd_write_reg(0x3C); //BorderWavefrom
+ epd_write_data(0x80);
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x00); // RED normal
+ epd_write_data(0x00); // single chip application
#endif
return 0;
@@ -304,8 +326,13 @@ void epd_enter_deepsleepmode(uint8_t mode)
uint8_t epd_power_on(void)
{
+ #if defined EPD_42
+ epd_write_reg(0x22); // Display Update Control
+ epd_write_data(0xe0);
+ #else
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xf8);
+ #endif
epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy();
@@ -327,15 +354,20 @@ void epd_init_internalTempSensor(void)
epd_write_reg(0x1A);
epd_write_data(0x7F);
- epd_write_data(0xF0);
+// epd_write_data(0xF0);
}
void epd_update(void)
{
+
+ #ifdef EPD_154
epd_write_reg(0x22); // Display Update Control
-#ifdef EPD_154
epd_write_data(0xF4);
+ #elif defined EPD_42
+ epd_write_reg(0x22); // Display Update Control
+ epd_write_data(0xF7);
#else
+ epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF7);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
@@ -345,10 +377,14 @@ void epd_update(void)
void epd_update_partial(void)
{
+ #ifdef EPD_154
epd_write_reg(0x22); // Display Update Control
-#ifdef EPD_154
epd_write_data(0xFC);
+ #elif defined EPD_42
+ epd_write_reg(0x22); // Display Update Control
+ epd_write_data(0xFF);
#else
+ epd_write_reg(0x22); // Display Update Control
epd_write_data(0xCC);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
@@ -356,6 +392,19 @@ void epd_update_partial(void)
epd_wait_busy();
}
+void epd_address_set(uint16_t x_start,uint16_t y_start,uint16_t x_end,uint16_t y_end)
+{
+ epd_write_reg(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
+ epd_write_data((x_start>>3) & 0xFF);
+ epd_write_data((x_end>>3) & 0xFF);
+
+ epd_write_reg(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
+ epd_write_data(y_start & 0xFF);
+ epd_write_data((y_start >> 8) & 0xFF);
+ epd_write_data(y_end & 0xFF);
+ epd_write_data((y_end >> 8) & 0xFF);
+}
+
void epd_setpos(uint16_t x, uint16_t y)
{
uint8_t _x;
@@ -365,8 +414,10 @@ void epd_setpos(uint16_t x, uint16_t y)
#ifdef EPD_154
_y = 199 - y;
- #else
+ #elif defined(EPD_29) || defined(EPD_213)
_y = 295 - y;
+ #elif defined(EPD_42)
+ _y = y;
#endif
epd_write_reg(0x4E); // set RAM x address count to 0;
@@ -387,6 +438,17 @@ void epd_writedata(uint8_t *Image1, uint32_t length)
epd_cs_set();
}
+void epd_writedata2(uint8_t data, uint32_t length)
+{
+ epd_cs_reset();
+ for (uint32_t j = 0; j < length; j++)
+ {
+ _epd_write_data(data);
+ }
+ _epd_write_data_over();
+ epd_cs_set();
+}
+
void epd_display(uint8_t *Image1, uint8_t *Image2)
{
uint32_t Width, Height, i, j;
@@ -415,6 +477,12 @@ void epd_display(uint8_t *Image1, uint8_t *Image2)
_epd_write_data_over();
epd_cs_set();
+ #if defined EPD_42
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x00); // RED normal
+ epd_write_data(0x00); // single chip application
+ #endif
+
epd_update();
}
@@ -466,6 +534,11 @@ void epd_displayRED(uint8_t *Image)
epd_write_reg(0x26);
epd_writedata(Image, Width * Height);
+ #if defined EPD_42
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x00); // RED normal
+ epd_write_data(0x00); // single chip application
+ #endif
epd_update();
}
diff --git a/Example/EpaperModuleTest_APM32F103/Epaper/epaper.h b/Example/EpaperModuleTest_APM32F103/Epaper/epaper.h
index ed4aa89..f51fd3a 100644
--- a/Example/EpaperModuleTest_APM32F103/Epaper/epaper.h
+++ b/Example/EpaperModuleTest_APM32F103/Epaper/epaper.h
@@ -8,11 +8,12 @@ extern "C"
#include "apm32f10x.h"
+//#define EPD_42
//#define EPD_29
//#define EPD_213
//#define EPD_154
-#if (!defined EPD_29) && (!defined EPD_213) && (!defined EPD_154)
+#if (!defined EPD_29) && (!defined EPD_213) && (!defined EPD_154) && (!defined EPD_42)
#error EPD Type Undefine
#endif
@@ -31,6 +32,10 @@ extern "C"
#define EPD_H 200
#endif
+#ifdef EPD_42
+#define EPD_W 400
+#define EPD_H 300
+#endif
#define EPD_OK 0
#define EPD_ERROR 1
@@ -76,6 +81,7 @@ extern "C"
void epd_init_internalTempSensor(void);
void epd_update(void);
void epd_update_partial(void);
+ void epd_address_set(uint16_t x_start,uint16_t y_start,uint16_t x_end,uint16_t y_end);
void epd_setpos(uint16_t x, uint16_t y);
void epd_display(uint8_t *Image1, uint8_t *Image2);
void epd_displayBW(uint8_t *Image);
diff --git a/Example/EpaperModuleTest_APM32F103/Src/main.c b/Example/EpaperModuleTest_APM32F103/Src/main.c
index 27aad2d..f971a78 100644
--- a/Example/EpaperModuleTest_APM32F103/Src/main.c
+++ b/Example/EpaperModuleTest_APM32F103/Src/main.c
@@ -52,16 +52,25 @@ int main(void)
epd_init();
#ifdef EPD_BWR
+ #ifdef EPD_42
+ epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
+ epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
+ #else
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
-
epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
+ #endif
epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE);
epd_paint_selectimage(image_red);
epd_paint_clear(EPD_COLOR_WHITE);
+
+ #ifdef EPD_42
+ epd_paint_showPicture((EPD_W - 250) / 2, (EPD_H - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #else
epd_paint_showPicture((EPD_H - 250) / 2, (EPD_W - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #endif
epd_display(image_bw, image_red);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@@ -79,6 +88,10 @@ int main(void)
#ifdef EPD_29
epd_paint_showString(10, 0, (uint8_t *)&"2.9 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 50, (uint8_t *)&"with 296 x 128 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
+#endif
+#ifdef EPD_42
+ epd_paint_showString(10, 0, (uint8_t *)&"4.2 Inch Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
+ epd_paint_showString(10, 50, (uint8_t *)&"with 400 x 300 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
@@ -95,8 +108,13 @@ int main(void)
#endif
epd_display(image_bw, image_red);
+
#else
+ #ifdef EPD_42
+ epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
+ #else
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
+ #endif
epd_paint_selectimage(image_bw);
@@ -105,8 +123,12 @@ int main(void)
epd_paint_showPicture((EPD_H - 200) / 2,(EPD_W - 64) / 2,200,64,gImage_5,EPD_COLOR_WHITE);
#else
epd_paint_clear(EPD_COLOR_WHITE);
+ #ifdef EPD_42
+ epd_paint_showPicture((EPD_W - 250) / 2, (EPD_H - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #else
epd_paint_showPicture((EPD_H - 250) / 2, (EPD_W - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
-#endif
+ #endif
+ #endif
epd_displayBW(image_bw);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@@ -134,11 +156,15 @@ int main(void)
epd_paint_showString(10, 50, (uint8_t *)&"with 296 x 128 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
-
+#ifdef EPD_42
+ epd_paint_showString(10, 0, (uint8_t *)&"4.2 Inch Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
+ epd_paint_showString(10, 50, (uint8_t *)&"with 400 x 300 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
+ epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
+#endif
#if 1
epd_paint_showString(10,100,(uint8_t *)&"APM32F103CBT6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK);
#else
- epd_paint_drawRectangle(10, 103, EPD_H - 10, 116, EPD_COLOR_BLACK, 1);
+ epd_paint_drawRectangle(10, EPD_W-20, EPD_H - 10, EPD_W-6, EPD_COLOR_BLACK, 1);
#endif
sprintf((char *)&text, ">> Partial Mode");
diff --git a/Example/EpaperModuleTest_AT32F403A/Epaper/epaper.c b/Example/EpaperModuleTest_AT32F403A/Epaper/epaper.c
index cc59656..3565bd2 100644
--- a/Example/EpaperModuleTest_AT32F403A/Epaper/epaper.c
+++ b/Example/EpaperModuleTest_AT32F403A/Epaper/epaper.c
@@ -234,54 +234,70 @@ uint8_t epd_init(void)
if (epd_wait_busy())
return 1;
- epd_write_reg(0x01); // Driver output control
- #if defined(EPD_29) || defined(EPD_213)
- epd_write_data(0x27);
- epd_write_data(0x01);
- epd_write_data(0x01);
- #else
- epd_write_data(0xC7);
- epd_write_data(0x00);
- epd_write_data(0x01);
+ #if defined(EPD_29) || defined(EPD_213) || defined(EPD_154)
+ epd_write_reg(0x01); // Driver output control
+ #if defined(EPD_29) || defined(EPD_213)
+ epd_write_data(0x27);
+ epd_write_data(0x01);
+ epd_write_data(0x01);
+ #else
+ epd_write_data(0xC7);
+ epd_write_data(0x00);
+ epd_write_data(0x01);
+ #endif
+
+ epd_write_reg(0x11); // data entry mode
+ epd_write_data(0x01);
+
+ #ifdef EPD_154
+ epd_write_reg(0x44); // set Ram-X address start/end position
+ epd_write_data(0x00);
+ epd_write_data(0x18);
+
+ epd_write_reg(0x45); // set Ram-Y address start/end position
+ epd_write_data(0xC7);
+ epd_write_data(0x00);
+ epd_write_data(0x00);
+ epd_write_data(0x00);
+ #else
+ epd_write_reg(0x44); // set Ram-X address start/end position
+ epd_write_data(0x00);
+ epd_write_data(0x0F); // 0x0F-->(15+1)*8=128
+
+ epd_write_reg(0x45); // set Ram-Y address start/end position
+ epd_write_data(0x27); // 0x127-->(295+1)=296
+ epd_write_data(0x01);
+ epd_write_data(0x00);
+ epd_write_data(0x00);
+ #endif
+
+ epd_write_reg(0x3C); // BorderWavefrom
+ epd_write_data(0x05);
+
+ #if defined(EPD_29) || defined(EPD_213)
+ epd_write_reg(0x21); // Display update control
+ epd_write_data(0x00);
+ epd_write_data(0x80);
+ #endif
+
+ #elif defined(EPD_42)
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x40);
+ epd_write_data(0x00);
+ epd_write_reg(0x01); // Set MUX as 300
+ epd_write_data(0x2B);
+ epd_write_data(0x01);
+ epd_write_data(0x00);
+ epd_write_reg(0x3C); //BorderWavefrom
+ epd_write_data(0x01);
+ epd_write_reg(0x11); // data entry mode
+ epd_write_data(0x03); // X-mode
+ epd_address_set(0,0,EPD_W-1,EPD_H-1);
#endif
- epd_write_reg(0x11); // data entry mode
- epd_write_data(0x01);
-
- #ifdef EPD_154
- epd_write_reg(0x44); // set Ram-X address start/end position
- epd_write_data(0x00);
- epd_write_data(0x18);
-
- epd_write_reg(0x45); // set Ram-Y address start/end position
- epd_write_data(0xC7);
- epd_write_data(0x00);
- epd_write_data(0x00);
- epd_write_data(0x00);
- #else
- epd_write_reg(0x44); // set Ram-X address start/end position
- epd_write_data(0x00);
- epd_write_data(0x0F); // 0x0F-->(15+1)*8=128
-
- epd_write_reg(0x45); // set Ram-Y address start/end position
- epd_write_data(0x27); // 0x127-->(295+1)=296
- epd_write_data(0x01);
- epd_write_data(0x00);
- epd_write_data(0x00);
- #endif
-
- epd_write_reg(0x3C); // BorderWavefrom
- epd_write_data(0x05);
-
- #if defined(EPD_29) || defined(EPD_213)
- epd_write_reg(0x21); // Display update control
- epd_write_data(0x00);
- epd_write_data(0x80);
- #endif
-
- epd_write_reg(0x18); // Read built-in temperature sensor
- epd_write_data(0x80);
-
+ epd_write_reg(0x18); // Read built-in temperature sensor
+ epd_write_data(0x80);
+
epd_setpos(0,0);
if (epd_power_on())
@@ -304,6 +320,12 @@ uint8_t epd_init_partial(void)
}
_epd_write_data_over();
epd_cs_set();
+ #elif defined(EPD_42)
+ epd_write_reg(0x3C); //BorderWavefrom
+ epd_write_data(0x80);
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x00); // RED normal
+ epd_write_data(0x00); // single chip application
#endif
return 0;
@@ -319,8 +341,13 @@ void epd_enter_deepsleepmode(uint8_t mode)
uint8_t epd_power_on(void)
{
+ #if defined EPD_42
+ epd_write_reg(0x22); // Display Update Control
+ epd_write_data(0xe0);
+ #else
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xf8);
+ #endif
epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy();
@@ -342,15 +369,20 @@ void epd_init_internalTempSensor(void)
epd_write_reg(0x1A);
epd_write_data(0x7F);
- epd_write_data(0xF0);
+// epd_write_data(0xF0);
}
void epd_update(void)
{
- epd_write_reg(0x22); // Display Update Control
+
#ifdef EPD_154
+ epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF4);
+ #elif defined EPD_42
+ epd_write_reg(0x22); // Display Update Control
+ epd_write_data(0xF7);
#else
+ epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF7);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
@@ -360,10 +392,14 @@ void epd_update(void)
void epd_update_partial(void)
{
- epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
+ epd_write_reg(0x22); // Display Update Control
epd_write_data(0xFC);
+ #elif defined EPD_42
+ epd_write_reg(0x22); // Display Update Control
+ epd_write_data(0xFF);
#else
+ epd_write_reg(0x22); // Display Update Control
epd_write_data(0xCC);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
@@ -371,6 +407,19 @@ void epd_update_partial(void)
epd_wait_busy();
}
+void epd_address_set(uint16_t x_start,uint16_t y_start,uint16_t x_end,uint16_t y_end)
+{
+ epd_write_reg(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
+ epd_write_data((x_start>>3) & 0xFF);
+ epd_write_data((x_end>>3) & 0xFF);
+
+ epd_write_reg(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
+ epd_write_data(y_start & 0xFF);
+ epd_write_data((y_start >> 8) & 0xFF);
+ epd_write_data(y_end & 0xFF);
+ epd_write_data((y_end >> 8) & 0xFF);
+}
+
void epd_setpos(uint16_t x, uint16_t y)
{
uint8_t _x;
@@ -380,8 +429,10 @@ void epd_setpos(uint16_t x, uint16_t y)
#ifdef EPD_154
_y = 199 - y;
- #else
+ #elif defined(EPD_29) || defined(EPD_213)
_y = 295 - y;
+ #elif defined(EPD_42)
+ _y = y;
#endif
epd_write_reg(0x4E); // set RAM x address count to 0;
@@ -402,6 +453,17 @@ void epd_writedata(uint8_t *Image1, uint32_t length)
epd_cs_set();
}
+void epd_writedata2(uint8_t data, uint32_t length)
+{
+ epd_cs_reset();
+ for (uint32_t j = 0; j < length; j++)
+ {
+ _epd_write_data(data);
+ }
+ _epd_write_data_over();
+ epd_cs_set();
+}
+
void epd_display(uint8_t *Image1, uint8_t *Image2)
{
uint32_t Width, Height, i, j;
@@ -430,6 +492,12 @@ void epd_display(uint8_t *Image1, uint8_t *Image2)
_epd_write_data_over();
epd_cs_set();
+ #if defined EPD_42
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x00); // RED normal
+ epd_write_data(0x00); // single chip application
+ #endif
+
epd_update();
}
@@ -481,6 +549,11 @@ void epd_displayRED(uint8_t *Image)
epd_write_reg(0x26);
epd_writedata(Image, Width * Height);
+ #if defined EPD_42
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x00); // RED normal
+ epd_write_data(0x00); // single chip application
+ #endif
epd_update();
}
diff --git a/Example/EpaperModuleTest_AT32F403A/Epaper/epaper.h b/Example/EpaperModuleTest_AT32F403A/Epaper/epaper.h
index 0a5be53..4e87135 100644
--- a/Example/EpaperModuleTest_AT32F403A/Epaper/epaper.h
+++ b/Example/EpaperModuleTest_AT32F403A/Epaper/epaper.h
@@ -8,11 +8,12 @@ extern "C"
#include "at32f403a_407.h"
+//#define EPD_42
//#define EPD_29
//#define EPD_213
//#define EPD_154
-#if (!defined EPD_29) && (!defined EPD_213) && (!defined EPD_154)
+#if (!defined EPD_29) && (!defined EPD_213) && (!defined EPD_154) && (!defined EPD_42)
#error EPD Type Undefine
#endif
@@ -31,6 +32,10 @@ extern "C"
#define EPD_H 200
#endif
+#ifdef EPD_42
+#define EPD_W 400
+#define EPD_H 300
+#endif
#define EPD_OK 0
#define EPD_ERROR 1
@@ -76,6 +81,7 @@ extern "C"
void epd_init_internalTempSensor(void);
void epd_update(void);
void epd_update_partial(void);
+ void epd_address_set(uint16_t x_start,uint16_t y_start,uint16_t x_end,uint16_t y_end);
void epd_setpos(uint16_t x, uint16_t y);
void epd_display(uint8_t *Image1, uint8_t *Image2);
void epd_displayBW(uint8_t *Image);
diff --git a/Example/EpaperModuleTest_AT32F403A/MDK-ARM/EpaperModuleTest_AT32F403A.uvprojx b/Example/EpaperModuleTest_AT32F403A/MDK-ARM/EpaperModuleTest_AT32F403A.uvprojx
index 208f5b1..0608784 100644
--- a/Example/EpaperModuleTest_AT32F403A/MDK-ARM/EpaperModuleTest_AT32F403A.uvprojx
+++ b/Example/EpaperModuleTest_AT32F403A/MDK-ARM/EpaperModuleTest_AT32F403A.uvprojx
@@ -10,7 +10,7 @@
Target 1
0x4
ARM-ADS
- 6190000::V6.19::ARMCLANG
+ 6210000::V6.21::ARMCLANG
1
diff --git a/Example/EpaperModuleTest_AT32F403A/MDK-ARM/Objects/EpaperModuleTest_AT32F403A.axf b/Example/EpaperModuleTest_AT32F403A/MDK-ARM/Objects/EpaperModuleTest_AT32F403A.axf
index bf5c4bf..bf4bbe7 100644
Binary files a/Example/EpaperModuleTest_AT32F403A/MDK-ARM/Objects/EpaperModuleTest_AT32F403A.axf and b/Example/EpaperModuleTest_AT32F403A/MDK-ARM/Objects/EpaperModuleTest_AT32F403A.axf differ
diff --git a/Example/EpaperModuleTest_AT32F403A/MDK-ARM/Objects/EpaperModuleTest_AT32F403A.hex b/Example/EpaperModuleTest_AT32F403A/MDK-ARM/Objects/EpaperModuleTest_AT32F403A.hex
index 7ff37f9..ce22728 100644
Binary files a/Example/EpaperModuleTest_AT32F403A/MDK-ARM/Objects/EpaperModuleTest_AT32F403A.hex and b/Example/EpaperModuleTest_AT32F403A/MDK-ARM/Objects/EpaperModuleTest_AT32F403A.hex differ
diff --git a/Example/EpaperModuleTest_AT32F403A/Src/main.c b/Example/EpaperModuleTest_AT32F403A/Src/main.c
index 90e036e..aa44f27 100644
--- a/Example/EpaperModuleTest_AT32F403A/Src/main.c
+++ b/Example/EpaperModuleTest_AT32F403A/Src/main.c
@@ -49,16 +49,25 @@ int main(void)
epd_init();
#ifdef EPD_BWR
+ #ifdef EPD_42
+ epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
+ epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
+ #else
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
-
epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
+ #endif
epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE);
epd_paint_selectimage(image_red);
epd_paint_clear(EPD_COLOR_WHITE);
- epd_paint_showPicture((EPD_H - 250) / 2, (EPD_W - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+
+ #ifdef EPD_42
+ epd_paint_showPicture((EPD_W - 250) / 2, (EPD_H - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #else
+ epd_paint_showPicture((EPD_H - 250) / 2, (EPD_W - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #endif
epd_display(image_bw, image_red);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@@ -76,6 +85,10 @@ int main(void)
#ifdef EPD_29
epd_paint_showString(10, 0, (uint8_t *)&"2.9 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 50, (uint8_t *)&"with 296 x 128 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
+#endif
+#ifdef EPD_42
+ epd_paint_showString(10, 0, (uint8_t *)&"4.2 Inch Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
+ epd_paint_showString(10, 50, (uint8_t *)&"with 400 x 300 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
@@ -85,15 +98,20 @@ int main(void)
sprintf((char *)&text, ">> Hello World.");
epd_paint_showString(10, 71, text, EPD_FONT_SIZE24x12, EPD_COLOR_RED);
-#if 0
+#if 1
epd_paint_showString(10,100,(uint8_t *)&"AT32F403ACGU7 Example",EPD_FONT_SIZE16x8,EPD_COLOR_RED);
#else
epd_paint_drawRectangle(10, 103, EPD_H - 10, 116, EPD_COLOR_RED, 1);
#endif
epd_display(image_bw, image_red);
+
#else
- epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
+ #ifdef EPD_42
+ epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
+ #else
+ epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
+ #endif
epd_paint_selectimage(image_bw);
@@ -102,7 +120,11 @@ int main(void)
epd_paint_showPicture((EPD_H - 200) / 2,(EPD_W - 64) / 2,200,64,gImage_5,EPD_COLOR_WHITE);
#else
epd_paint_clear(EPD_COLOR_WHITE);
- epd_paint_showPicture((EPD_H - 250) / 2, (EPD_W - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #ifdef EPD_42
+ epd_paint_showPicture((EPD_W - 250) / 2, (EPD_H - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #else
+ epd_paint_showPicture((EPD_H - 250) / 2, (EPD_W - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #endif
#endif
epd_displayBW(image_bw);
@@ -131,7 +153,11 @@ int main(void)
epd_paint_showString(10, 50, (uint8_t *)&"with 296 x 128 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
-
+#ifdef EPD_42
+ epd_paint_showString(10, 0, (uint8_t *)&"4.2 Inch Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
+ epd_paint_showString(10, 50, (uint8_t *)&"with 400 x 300 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
+ epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
+#endif
#if 1
epd_paint_showString(10,100,(uint8_t *)&"AT32F403ACGU7 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK);
#else
diff --git a/Example/EpaperModuleTest_Arduino_ESP32/EpaperModuleTest_Arduino_ESP32.ino b/Example/EpaperModuleTest_Arduino_ESP32/EpaperModuleTest_Arduino_ESP32.ino
index 0c2b308..e73cd8d 100644
--- a/Example/EpaperModuleTest_Arduino_ESP32/EpaperModuleTest_Arduino_ESP32.ino
+++ b/Example/EpaperModuleTest_Arduino_ESP32/EpaperModuleTest_Arduino_ESP32.ino
@@ -20,6 +20,9 @@ GxEPD2_BW display(GxEPD2_213_BN(/*CS=5*/ 5
//GxEPD2_BW display(GxEPD2_290_BS(/*CS=5*/ 5, /*DC=*/ 0, /*RES=*/ 2, /*BUSY=*/ 15)); // DEPG0290BS 128x296, SSD1680
//GxEPD2_3C display(GxEPD2_290_C90c(/*CS=5*/ 5, /*DC=*/ 0, /*RES=*/ 2, /*BUSY=*/ 15)); // GDEM029C90 128x296, SSD1680
+// 4.2'' EPD Module
+//GxEPD2_BW display(GxEPD2_420_GDEY042T81(/*CS=5*/ 5, /*DC=*/ 0, /*RES=*/ 2, /*BUSY=*/ 15)); // 400x300, SSD1683
+
void setup()
{
display.init(115200,true,50,false);
diff --git a/Example/EpaperModuleTest_Arduino_ESP32C3/EpaperModuleTest_Arduino_ESP32C3.ino b/Example/EpaperModuleTest_Arduino_ESP32C3/EpaperModuleTest_Arduino_ESP32C3.ino
index 0da05e1..6a1db2a 100644
--- a/Example/EpaperModuleTest_Arduino_ESP32C3/EpaperModuleTest_Arduino_ESP32C3.ino
+++ b/Example/EpaperModuleTest_Arduino_ESP32C3/EpaperModuleTest_Arduino_ESP32C3.ino
@@ -20,6 +20,9 @@ GxEPD2_BW display(GxEPD2_213_BN(/*CS=5*/ S
//GxEPD2_BW display(GxEPD2_290_BS(/*CS=5*/ SS, /*DC=*/ 1, /*RES=*/ 2, /*BUSY=*/ 3)); // DEPG0290BS 128x296, SSD1680
//GxEPD2_3C display(GxEPD2_290_C90c(/*CS=5*/ SS, /*DC=*/ 1, /*RES=*/ 2, /*BUSY=*/ 3)); // GDEM029C90 128x296, SSD1680
+// 4.2'' EPD Module
+//GxEPD2_BW display(GxEPD2_420_GDEY042T81(/*CS=5*/ SS, /*DC=*/ 1, /*RES=*/ 2, /*BUSY=*/ 3)); // 400x300, SSD1683
+
void setup()
{
pinMode(8, OUTPUT);
diff --git a/Example/EpaperModuleTest_Arduino_ESP8266/EpaperModuleTest_Arduino_ESP8266.ino b/Example/EpaperModuleTest_Arduino_ESP8266/EpaperModuleTest_Arduino_ESP8266.ino
index c8cb04d..4b4ba36 100644
--- a/Example/EpaperModuleTest_Arduino_ESP8266/EpaperModuleTest_Arduino_ESP8266.ino
+++ b/Example/EpaperModuleTest_Arduino_ESP8266/EpaperModuleTest_Arduino_ESP8266.ino
@@ -20,6 +20,9 @@ GxEPD2_BW display(GxEPD2_213_BN(/*CS=5*/ 1
//GxEPD2_BW display(GxEPD2_290_BS(/*CS=5*/ 15, /*DC=*/ 4, /*RES=*/ 5, /*BUSY=*/ 16)); // DEPG0290BS 128x296, SSD1680
//GxEPD2_3C display(GxEPD2_290_C90c(/*CS=5*/ 15, /*DC=*/ 4, /*RES=*/ 5, /*BUSY=*/ 16)); // GDEM029C90 128x296, SSD1680
+// 4.2'' EPD Module
+//GxEPD2_BW display(GxEPD2_420_GDEY042T81(/*CS=5*/ 15, /*DC=*/ 4, /*RES=*/ 5, /*BUSY=*/ 16)); // 400x300, SSD1683
+
void setup()
{
display.init(115200,true,50,false);
diff --git a/Example/EpaperModuleTest_CH32F103/Epaper/epaper.c b/Example/EpaperModuleTest_CH32F103/Epaper/epaper.c
index 7c8a477..abb4ef7 100644
--- a/Example/EpaperModuleTest_CH32F103/Epaper/epaper.c
+++ b/Example/EpaperModuleTest_CH32F103/Epaper/epaper.c
@@ -218,6 +218,7 @@ uint8_t epd_init(void)
if (epd_wait_busy())
return 1;
+ #if defined(EPD_29) || defined(EPD_213) || defined(EPD_154)
epd_write_reg(0x01); // Driver output control
#if defined(EPD_29) || defined(EPD_213)
epd_write_data(0x27);
@@ -261,6 +262,21 @@ uint8_t epd_init(void)
epd_write_reg(0x21); // Display update control
epd_write_data(0x00);
epd_write_data(0x80);
+ #endif
+
+ #elif defined(EPD_42)
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x40);
+ epd_write_data(0x00);
+ epd_write_reg(0x01); // Set MUX as 300
+ epd_write_data(0x2B);
+ epd_write_data(0x01);
+ epd_write_data(0x00);
+ epd_write_reg(0x3C); //BorderWavefrom
+ epd_write_data(0x01);
+ epd_write_reg(0x11); // data entry mode
+ epd_write_data(0x03); // X-mode
+ epd_address_set(0,0,EPD_W-1,EPD_H-1);
#endif
epd_write_reg(0x18); // Read built-in temperature sensor
@@ -288,6 +304,12 @@ uint8_t epd_init_partial(void)
}
_epd_write_data_over();
epd_cs_set();
+ #elif defined(EPD_42)
+ epd_write_reg(0x3C); //BorderWavefrom
+ epd_write_data(0x80);
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x00); // RED normal
+ epd_write_data(0x00); // single chip application
#endif
return 0;
@@ -303,8 +325,13 @@ void epd_enter_deepsleepmode(uint8_t mode)
uint8_t epd_power_on(void)
{
+ #if defined EPD_42
+ epd_write_reg(0x22); // Display Update Control
+ epd_write_data(0xe0);
+ #else
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xf8);
+ #endif
epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy();
@@ -326,15 +353,20 @@ void epd_init_internalTempSensor(void)
epd_write_reg(0x1A);
epd_write_data(0x7F);
- epd_write_data(0xF0);
+// epd_write_data(0xF0);
}
void epd_update(void)
{
+
+ #ifdef EPD_154
epd_write_reg(0x22); // Display Update Control
-#ifdef EPD_154
epd_write_data(0xF4);
+ #elif defined EPD_42
+ epd_write_reg(0x22); // Display Update Control
+ epd_write_data(0xF7);
#else
+ epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF7);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
@@ -344,10 +376,14 @@ void epd_update(void)
void epd_update_partial(void)
{
+ #ifdef EPD_154
epd_write_reg(0x22); // Display Update Control
-#ifdef EPD_154
epd_write_data(0xFC);
+ #elif defined EPD_42
+ epd_write_reg(0x22); // Display Update Control
+ epd_write_data(0xFF);
#else
+ epd_write_reg(0x22); // Display Update Control
epd_write_data(0xCC);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
@@ -355,6 +391,19 @@ void epd_update_partial(void)
epd_wait_busy();
}
+void epd_address_set(uint16_t x_start,uint16_t y_start,uint16_t x_end,uint16_t y_end)
+{
+ epd_write_reg(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
+ epd_write_data((x_start>>3) & 0xFF);
+ epd_write_data((x_end>>3) & 0xFF);
+
+ epd_write_reg(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
+ epd_write_data(y_start & 0xFF);
+ epd_write_data((y_start >> 8) & 0xFF);
+ epd_write_data(y_end & 0xFF);
+ epd_write_data((y_end >> 8) & 0xFF);
+}
+
void epd_setpos(uint16_t x, uint16_t y)
{
uint8_t _x;
@@ -364,8 +413,10 @@ void epd_setpos(uint16_t x, uint16_t y)
#ifdef EPD_154
_y = 199 - y;
- #else
+ #elif defined(EPD_29) || defined(EPD_213)
_y = 295 - y;
+ #elif defined(EPD_42)
+ _y = y;
#endif
epd_write_reg(0x4E); // set RAM x address count to 0;
@@ -386,6 +437,17 @@ void epd_writedata(uint8_t *Image1, uint32_t length)
epd_cs_set();
}
+void epd_writedata2(uint8_t data, uint32_t length)
+{
+ epd_cs_reset();
+ for (uint32_t j = 0; j < length; j++)
+ {
+ _epd_write_data(data);
+ }
+ _epd_write_data_over();
+ epd_cs_set();
+}
+
void epd_display(uint8_t *Image1, uint8_t *Image2)
{
uint32_t Width, Height, i, j;
@@ -414,6 +476,12 @@ void epd_display(uint8_t *Image1, uint8_t *Image2)
_epd_write_data_over();
epd_cs_set();
+ #if defined EPD_42
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x00); // RED normal
+ epd_write_data(0x00); // single chip application
+ #endif
+
epd_update();
}
@@ -465,6 +533,11 @@ void epd_displayRED(uint8_t *Image)
epd_write_reg(0x26);
epd_writedata(Image, Width * Height);
+ #if defined EPD_42
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x00); // RED normal
+ epd_write_data(0x00); // single chip application
+ #endif
epd_update();
}
diff --git a/Example/EpaperModuleTest_CH32F103/Epaper/epaper.h b/Example/EpaperModuleTest_CH32F103/Epaper/epaper.h
index 4cc7786..a1395a1 100644
--- a/Example/EpaperModuleTest_CH32F103/Epaper/epaper.h
+++ b/Example/EpaperModuleTest_CH32F103/Epaper/epaper.h
@@ -8,11 +8,12 @@ extern "C"
#include "ch32f10x.h"
+//#define EPD_42
//#define EPD_29
//#define EPD_213
//#define EPD_154
-#if (!defined EPD_29) && (!defined EPD_213) && (!defined EPD_154)
+#if (!defined EPD_29) && (!defined EPD_213) && (!defined EPD_154) && (!defined EPD_42)
#error EPD Type Undefine
#endif
@@ -31,6 +32,10 @@ extern "C"
#define EPD_H 200
#endif
+#ifdef EPD_42
+#define EPD_W 400
+#define EPD_H 300
+#endif
#define EPD_OK 0
#define EPD_ERROR 1
@@ -76,6 +81,7 @@ extern "C"
void epd_init_internalTempSensor(void);
void epd_update(void);
void epd_update_partial(void);
+ void epd_address_set(uint16_t x_start,uint16_t y_start,uint16_t x_end,uint16_t y_end);
void epd_setpos(uint16_t x, uint16_t y);
void epd_display(uint8_t *Image1, uint8_t *Image2);
void epd_displayBW(uint8_t *Image);
diff --git a/Example/EpaperModuleTest_CH32F103/Src/main.c b/Example/EpaperModuleTest_CH32F103/Src/main.c
index 12203da..09c9fdf 100644
--- a/Example/EpaperModuleTest_CH32F103/Src/main.c
+++ b/Example/EpaperModuleTest_CH32F103/Src/main.c
@@ -15,7 +15,7 @@
#include "bmp.h"
// define for White Black Red Epaper Module
-#define EPD_BWR
+//#define EPD_BWR
uint8_t image_bw[EPD_W_BUFF_SIZE * EPD_H];
#ifdef EPD_BWR
@@ -56,16 +56,25 @@ int main(void)
epd_init();
#ifdef EPD_BWR
+ #ifdef EPD_42
+ epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
+ epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
+ #else
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
-
epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
+ #endif
epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE);
epd_paint_selectimage(image_red);
epd_paint_clear(EPD_COLOR_WHITE);
+
+ #ifdef EPD_42
+ epd_paint_showPicture((EPD_W - 250) / 2, (EPD_H - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #else
epd_paint_showPicture((EPD_H - 250) / 2, (EPD_W - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #endif
epd_display(image_bw, image_red);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@@ -83,6 +92,10 @@ int main(void)
#ifdef EPD_29
epd_paint_showString(10, 0, (uint8_t *)&"2.9 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 50, (uint8_t *)&"with 296 x 128 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
+#endif
+#ifdef EPD_42
+ epd_paint_showString(10, 0, (uint8_t *)&"4.2 Inch Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
+ epd_paint_showString(10, 50, (uint8_t *)&"with 400 x 300 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
@@ -99,8 +112,13 @@ int main(void)
#endif
epd_display(image_bw, image_red);
+
+#else
+ #ifdef EPD_42
+ epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
#else
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
+ #endif
epd_paint_selectimage(image_bw);
@@ -109,8 +127,12 @@ int main(void)
epd_paint_showPicture((EPD_H - 200) / 2,(EPD_W - 64) / 2,200,64,gImage_5,EPD_COLOR_WHITE);
#else
epd_paint_clear(EPD_COLOR_WHITE);
+ #ifdef EPD_42
+ epd_paint_showPicture((EPD_W - 250) / 2, (EPD_H - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #else
epd_paint_showPicture((EPD_H - 250) / 2, (EPD_W - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
#endif
+ #endif
epd_displayBW(image_bw);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@@ -138,11 +160,15 @@ int main(void)
epd_paint_showString(10, 50, (uint8_t *)&"with 296 x 128 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
-
+#ifdef EPD_42
+ epd_paint_showString(10, 0, (uint8_t *)&"4.2 Inch Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
+ epd_paint_showString(10, 50, (uint8_t *)&"with 400 x 300 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
+ epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
+#endif
#if 1
epd_paint_showString(10,100,(uint8_t *)&"CH32F103C8T6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK);
#else
- epd_paint_drawRectangle(10, 103, EPD_H - 10, 116, EPD_COLOR_BLACK, 1);
+ epd_paint_drawRectangle(10, EPD_W-20, EPD_H - 10, EPD_W-6, EPD_COLOR_BLACK, 1);
#endif
sprintf((char *)&text, ">> Partial Mode");
diff --git a/Example/EpaperModuleTest_CH32V103/User/Epaper/epaper.c b/Example/EpaperModuleTest_CH32V103/User/Epaper/epaper.c
index cc5012c..c4496a5 100644
--- a/Example/EpaperModuleTest_CH32V103/User/Epaper/epaper.c
+++ b/Example/EpaperModuleTest_CH32V103/User/Epaper/epaper.c
@@ -218,6 +218,7 @@ uint8_t epd_init(void)
if (epd_wait_busy())
return 1;
+ #if defined(EPD_29) || defined(EPD_213) || defined(EPD_154)
epd_write_reg(0x01); // Driver output control
#if defined(EPD_29) || defined(EPD_213)
epd_write_data(0x27);
@@ -261,6 +262,21 @@ uint8_t epd_init(void)
epd_write_reg(0x21); // Display update control
epd_write_data(0x00);
epd_write_data(0x80);
+ #endif
+
+ #elif defined(EPD_42)
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x40);
+ epd_write_data(0x00);
+ epd_write_reg(0x01); // Set MUX as 300
+ epd_write_data(0x2B);
+ epd_write_data(0x01);
+ epd_write_data(0x00);
+ epd_write_reg(0x3C); //BorderWavefrom
+ epd_write_data(0x01);
+ epd_write_reg(0x11); // data entry mode
+ epd_write_data(0x03); // X-mode
+ epd_address_set(0,0,EPD_W-1,EPD_H-1);
#endif
epd_write_reg(0x18); // Read built-in temperature sensor
@@ -288,6 +304,12 @@ uint8_t epd_init_partial(void)
}
_epd_write_data_over();
epd_cs_set();
+ #elif defined(EPD_42)
+ epd_write_reg(0x3C); //BorderWavefrom
+ epd_write_data(0x80);
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x00); // RED normal
+ epd_write_data(0x00); // single chip application
#endif
return 0;
@@ -303,8 +325,13 @@ void epd_enter_deepsleepmode(uint8_t mode)
uint8_t epd_power_on(void)
{
+ #if defined EPD_42
+ epd_write_reg(0x22); // Display Update Control
+ epd_write_data(0xe0);
+ #else
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xf8);
+ #endif
epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy();
@@ -326,15 +353,20 @@ void epd_init_internalTempSensor(void)
epd_write_reg(0x1A);
epd_write_data(0x7F);
- epd_write_data(0xF0);
+// epd_write_data(0xF0);
}
void epd_update(void)
{
+
+ #ifdef EPD_154
epd_write_reg(0x22); // Display Update Control
-#ifdef EPD_154
epd_write_data(0xF4);
+ #elif defined EPD_42
+ epd_write_reg(0x22); // Display Update Control
+ epd_write_data(0xF7);
#else
+ epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF7);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
@@ -344,10 +376,14 @@ void epd_update(void)
void epd_update_partial(void)
{
+ #ifdef EPD_154
epd_write_reg(0x22); // Display Update Control
-#ifdef EPD_154
epd_write_data(0xFC);
+ #elif defined EPD_42
+ epd_write_reg(0x22); // Display Update Control
+ epd_write_data(0xFF);
#else
+ epd_write_reg(0x22); // Display Update Control
epd_write_data(0xCC);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
@@ -355,6 +391,19 @@ void epd_update_partial(void)
epd_wait_busy();
}
+void epd_address_set(uint16_t x_start,uint16_t y_start,uint16_t x_end,uint16_t y_end)
+{
+ epd_write_reg(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
+ epd_write_data((x_start>>3) & 0xFF);
+ epd_write_data((x_end>>3) & 0xFF);
+
+ epd_write_reg(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
+ epd_write_data(y_start & 0xFF);
+ epd_write_data((y_start >> 8) & 0xFF);
+ epd_write_data(y_end & 0xFF);
+ epd_write_data((y_end >> 8) & 0xFF);
+}
+
void epd_setpos(uint16_t x, uint16_t y)
{
uint8_t _x;
@@ -364,8 +413,10 @@ void epd_setpos(uint16_t x, uint16_t y)
#ifdef EPD_154
_y = 199 - y;
- #else
+ #elif defined(EPD_29) || defined(EPD_213)
_y = 295 - y;
+ #elif defined(EPD_42)
+ _y = y;
#endif
epd_write_reg(0x4E); // set RAM x address count to 0;
@@ -386,6 +437,17 @@ void epd_writedata(uint8_t *Image1, uint32_t length)
epd_cs_set();
}
+void epd_writedata2(uint8_t data, uint32_t length)
+{
+ epd_cs_reset();
+ for (uint32_t j = 0; j < length; j++)
+ {
+ _epd_write_data(data);
+ }
+ _epd_write_data_over();
+ epd_cs_set();
+}
+
void epd_display(uint8_t *Image1, uint8_t *Image2)
{
uint32_t Width, Height, i, j;
@@ -414,6 +476,12 @@ void epd_display(uint8_t *Image1, uint8_t *Image2)
_epd_write_data_over();
epd_cs_set();
+ #if defined EPD_42
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x00); // RED normal
+ epd_write_data(0x00); // single chip application
+ #endif
+
epd_update();
}
@@ -465,6 +533,11 @@ void epd_displayRED(uint8_t *Image)
epd_write_reg(0x26);
epd_writedata(Image, Width * Height);
+ #if defined EPD_42
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x00); // RED normal
+ epd_write_data(0x00); // single chip application
+ #endif
epd_update();
}
diff --git a/Example/EpaperModuleTest_CH32V103/User/Epaper/epaper.h b/Example/EpaperModuleTest_CH32V103/User/Epaper/epaper.h
index be64e0f..769d9e8 100644
--- a/Example/EpaperModuleTest_CH32V103/User/Epaper/epaper.h
+++ b/Example/EpaperModuleTest_CH32V103/User/Epaper/epaper.h
@@ -8,11 +8,12 @@ extern "C"
#include "ch32v10x.h"
+//#define EPD_42
//#define EPD_29
//#define EPD_213
//#define EPD_154
-#if (!defined EPD_29) && (!defined EPD_213) && (!defined EPD_154)
+#if (!defined EPD_29) && (!defined EPD_213) && (!defined EPD_154) && (!defined EPD_42)
#error EPD Type Undefine
#endif
@@ -31,6 +32,10 @@ extern "C"
#define EPD_H 200
#endif
+#ifdef EPD_42
+#define EPD_W 400
+#define EPD_H 300
+#endif
#define EPD_OK 0
#define EPD_ERROR 1
@@ -76,6 +81,7 @@ extern "C"
void epd_init_internalTempSensor(void);
void epd_update(void);
void epd_update_partial(void);
+ void epd_address_set(uint16_t x_start,uint16_t y_start,uint16_t x_end,uint16_t y_end);
void epd_setpos(uint16_t x, uint16_t y);
void epd_display(uint8_t *Image1, uint8_t *Image2);
void epd_displayBW(uint8_t *Image);
diff --git a/Example/EpaperModuleTest_CH32V103/User/main.c b/Example/EpaperModuleTest_CH32V103/User/main.c
index 39f8ad1..03a87aa 100644
--- a/Example/EpaperModuleTest_CH32V103/User/main.c
+++ b/Example/EpaperModuleTest_CH32V103/User/main.c
@@ -15,7 +15,7 @@
#include "bmp.h"
// define for White Black Red Epaper Module
-#define EPD_BWR
+//#define EPD_BWR
uint8_t image_bw[EPD_W_BUFF_SIZE * EPD_H];
#ifdef EPD_BWR
@@ -56,16 +56,25 @@ int main(void)
epd_init();
#ifdef EPD_BWR
+ #ifdef EPD_42
+ epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
+ epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
+ #else
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
-
epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
+ #endif
epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE);
epd_paint_selectimage(image_red);
epd_paint_clear(EPD_COLOR_WHITE);
+
+ #ifdef EPD_42
+ epd_paint_showPicture((EPD_W - 250) / 2, (EPD_H - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #else
epd_paint_showPicture((EPD_H - 250) / 2, (EPD_W - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #endif
epd_display(image_bw, image_red);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@@ -83,6 +92,10 @@ int main(void)
#ifdef EPD_29
epd_paint_showString(10, 0, (uint8_t *)&"2.9 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 50, (uint8_t *)&"with 296 x 128 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
+#endif
+#ifdef EPD_42
+ epd_paint_showString(10, 0, (uint8_t *)&"4.2 Inch Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
+ epd_paint_showString(10, 50, (uint8_t *)&"with 400 x 300 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
@@ -99,8 +112,13 @@ int main(void)
#endif
epd_display(image_bw, image_red);
+
+#else
+ #ifdef EPD_42
+ epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
#else
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
+ #endif
epd_paint_selectimage(image_bw);
@@ -109,8 +127,12 @@ int main(void)
epd_paint_showPicture((EPD_H - 200) / 2,(EPD_W - 64) / 2,200,64,gImage_5,EPD_COLOR_WHITE);
#else
epd_paint_clear(EPD_COLOR_WHITE);
+ #ifdef EPD_42
+ epd_paint_showPicture((EPD_W - 250) / 2, (EPD_H - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #else
epd_paint_showPicture((EPD_H - 250) / 2, (EPD_W - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
#endif
+ #endif
epd_displayBW(image_bw);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@@ -138,11 +160,15 @@ epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SI
epd_paint_showString(10, 50, (uint8_t *)&"with 296 x 128 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
-
+#ifdef EPD_42
+ epd_paint_showString(10, 0, (uint8_t *)&"4.2 Inch Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
+ epd_paint_showString(10, 50, (uint8_t *)&"with 400 x 300 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
+ epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
+#endif
#if 1
epd_paint_showString(10,100,(uint8_t *)&"CH32V103C8T6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK);
#else
- epd_paint_drawRectangle(10, 103, EPD_H - 10, 116, EPD_COLOR_BLACK, 1);
+ epd_paint_drawRectangle(10, EPD_W-20, EPD_H - 10, EPD_W-6, EPD_COLOR_BLACK, 1);
#endif
sprintf((char *)&text, ">> Partial Mode");
diff --git a/Example/EpaperModuleTest_GD32F103/Epaper/epaper.c b/Example/EpaperModuleTest_GD32F103/Epaper/epaper.c
index 13c5f17..6e4cb34 100644
--- a/Example/EpaperModuleTest_GD32F103/Epaper/epaper.c
+++ b/Example/EpaperModuleTest_GD32F103/Epaper/epaper.c
@@ -208,6 +208,7 @@ uint8_t epd_init(void)
if (epd_wait_busy())
return 1;
+ #if defined(EPD_29) || defined(EPD_213) || defined(EPD_154)
epd_write_reg(0x01); // Driver output control
#if defined(EPD_29) || defined(EPD_213)
epd_write_data(0x27);
@@ -251,6 +252,21 @@ uint8_t epd_init(void)
epd_write_reg(0x21); // Display update control
epd_write_data(0x00);
epd_write_data(0x80);
+ #endif
+
+ #elif defined(EPD_42)
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x40);
+ epd_write_data(0x00);
+ epd_write_reg(0x01); // Set MUX as 300
+ epd_write_data(0x2B);
+ epd_write_data(0x01);
+ epd_write_data(0x00);
+ epd_write_reg(0x3C); //BorderWavefrom
+ epd_write_data(0x01);
+ epd_write_reg(0x11); // data entry mode
+ epd_write_data(0x03); // X-mode
+ epd_address_set(0,0,EPD_W-1,EPD_H-1);
#endif
epd_write_reg(0x18); // Read built-in temperature sensor
@@ -278,6 +294,12 @@ uint8_t epd_init_partial(void)
}
_epd_write_data_over();
epd_cs_set();
+ #elif defined(EPD_42)
+ epd_write_reg(0x3C); //BorderWavefrom
+ epd_write_data(0x80);
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x00); // RED normal
+ epd_write_data(0x00); // single chip application
#endif
return 0;
@@ -293,8 +315,13 @@ epd_power_off();
uint8_t epd_power_on(void)
{
+ #if defined EPD_42
+ epd_write_reg(0x22); // Display Update Control
+ epd_write_data(0xe0);
+ #else
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xf8);
+ #endif
epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy();
@@ -316,15 +343,20 @@ void epd_init_internalTempSensor(void)
epd_write_reg(0x1A);
epd_write_data(0x7F);
- epd_write_data(0xF0);
+// epd_write_data(0xF0);
}
void epd_update(void)
{
+
+ #ifdef EPD_154
epd_write_reg(0x22); // Display Update Control
-#ifdef EPD_154
epd_write_data(0xF4);
+ #elif defined EPD_42
+ epd_write_reg(0x22); // Display Update Control
+ epd_write_data(0xF7);
#else
+ epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF7);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
@@ -334,10 +366,14 @@ void epd_update(void)
void epd_update_partial(void)
{
+ #ifdef EPD_154
epd_write_reg(0x22); // Display Update Control
-#ifdef EPD_154
epd_write_data(0xFC);
+ #elif defined EPD_42
+ epd_write_reg(0x22); // Display Update Control
+ epd_write_data(0xFF);
#else
+ epd_write_reg(0x22); // Display Update Control
epd_write_data(0xCC);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
@@ -345,6 +381,19 @@ void epd_update_partial(void)
epd_wait_busy();
}
+void epd_address_set(uint16_t x_start,uint16_t y_start,uint16_t x_end,uint16_t y_end)
+{
+ epd_write_reg(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
+ epd_write_data((x_start>>3) & 0xFF);
+ epd_write_data((x_end>>3) & 0xFF);
+
+ epd_write_reg(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
+ epd_write_data(y_start & 0xFF);
+ epd_write_data((y_start >> 8) & 0xFF);
+ epd_write_data(y_end & 0xFF);
+ epd_write_data((y_end >> 8) & 0xFF);
+}
+
void epd_setpos(uint16_t x, uint16_t y)
{
uint8_t _x;
@@ -354,8 +403,10 @@ void epd_setpos(uint16_t x, uint16_t y)
#ifdef EPD_154
_y = 199 - y;
- #else
+ #elif defined(EPD_29) || defined(EPD_213)
_y = 295 - y;
+ #elif defined(EPD_42)
+ _y = y;
#endif
epd_write_reg(0x4E); // set RAM x address count to 0;
@@ -376,6 +427,17 @@ void epd_writedata(uint8_t *Image1, uint32_t length)
epd_cs_set();
}
+void epd_writedata2(uint8_t data, uint32_t length)
+{
+ epd_cs_reset();
+ for (uint32_t j = 0; j < length; j++)
+ {
+ _epd_write_data(data);
+ }
+ _epd_write_data_over();
+ epd_cs_set();
+}
+
void epd_display(uint8_t *Image1, uint8_t *Image2)
{
uint32_t Width, Height, i, j;
@@ -404,6 +466,12 @@ void epd_display(uint8_t *Image1, uint8_t *Image2)
_epd_write_data_over();
epd_cs_set();
+ #if defined EPD_42
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x00); // RED normal
+ epd_write_data(0x00); // single chip application
+ #endif
+
epd_update();
}
@@ -455,6 +523,11 @@ void epd_displayRED(uint8_t *Image)
epd_write_reg(0x26);
epd_writedata(Image, Width * Height);
+ #if defined EPD_42
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x00); // RED normal
+ epd_write_data(0x00); // single chip application
+ #endif
epd_update();
}
diff --git a/Example/EpaperModuleTest_GD32F103/Epaper/epaper.h b/Example/EpaperModuleTest_GD32F103/Epaper/epaper.h
index f9dbc60..1653675 100644
--- a/Example/EpaperModuleTest_GD32F103/Epaper/epaper.h
+++ b/Example/EpaperModuleTest_GD32F103/Epaper/epaper.h
@@ -8,11 +8,12 @@ extern "C"
#include "gd32f10x.h"
+//#define EPD_42
//#define EPD_29
//#define EPD_213
//#define EPD_154
-#if (!defined EPD_29) && (!defined EPD_213) && (!defined EPD_154)
+#if (!defined EPD_29) && (!defined EPD_213) && (!defined EPD_154) && (!defined EPD_42)
#error EPD Type Undefine
#endif
@@ -31,6 +32,10 @@ extern "C"
#define EPD_H 200
#endif
+#ifdef EPD_42
+#define EPD_W 400
+#define EPD_H 300
+#endif
#define EPD_OK 0
#define EPD_ERROR 1
@@ -76,6 +81,7 @@ extern "C"
void epd_init_internalTempSensor(void);
void epd_update(void);
void epd_update_partial(void);
+ void epd_address_set(uint16_t x_start,uint16_t y_start,uint16_t x_end,uint16_t y_end);
void epd_setpos(uint16_t x, uint16_t y);
void epd_display(uint8_t *Image1, uint8_t *Image2);
void epd_displayBW(uint8_t *Image);
diff --git a/Example/EpaperModuleTest_GD32F103/Src/main.c b/Example/EpaperModuleTest_GD32F103/Src/main.c
index c0bd4a2..b41e445 100644
--- a/Example/EpaperModuleTest_GD32F103/Src/main.c
+++ b/Example/EpaperModuleTest_GD32F103/Src/main.c
@@ -18,7 +18,7 @@
#include "bmp.h"
// define for White Black Red Epaper Module
-#define EPD_BWR
+//#define EPD_BWR
uint8_t image_bw[EPD_W_BUFF_SIZE * EPD_H];
#ifdef EPD_BWR
@@ -56,16 +56,25 @@ int main(void)
epd_init();
#ifdef EPD_BWR
+ #ifdef EPD_42
+ epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
+ epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
+ #else
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
-
epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
+ #endif
epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE);
epd_paint_selectimage(image_red);
epd_paint_clear(EPD_COLOR_WHITE);
+
+ #ifdef EPD_42
+ epd_paint_showPicture((EPD_W - 250) / 2, (EPD_H - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #else
epd_paint_showPicture((EPD_H - 250) / 2, (EPD_W - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #endif
epd_display(image_bw, image_red);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@@ -83,6 +92,10 @@ int main(void)
#ifdef EPD_29
epd_paint_showString(10, 0, (uint8_t *)&"2.9 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 50, (uint8_t *)&"with 296 x 128 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
+#endif
+#ifdef EPD_42
+ epd_paint_showString(10, 0, (uint8_t *)&"4.2 Inch Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
+ epd_paint_showString(10, 50, (uint8_t *)&"with 400 x 300 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
@@ -99,8 +112,13 @@ int main(void)
#endif
epd_display(image_bw, image_red);
+
+#else
+ #ifdef EPD_42
+ epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
#else
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
+ #endif
epd_paint_selectimage(image_bw);
@@ -109,8 +127,12 @@ int main(void)
epd_paint_showPicture((EPD_H - 200) / 2,(EPD_W - 64) / 2,200,64,gImage_5,EPD_COLOR_WHITE);
#else
epd_paint_clear(EPD_COLOR_WHITE);
+ #ifdef EPD_42
+ epd_paint_showPicture((EPD_W - 250) / 2, (EPD_H - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #else
epd_paint_showPicture((EPD_H - 250) / 2, (EPD_W - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
#endif
+ #endif
epd_displayBW(image_bw);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@@ -138,11 +160,15 @@ epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SI
epd_paint_showString(10, 50, (uint8_t *)&"with 296 x 128 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
-
+#ifdef EPD_42
+ epd_paint_showString(10, 0, (uint8_t *)&"4.2 Inch Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
+ epd_paint_showString(10, 50, (uint8_t *)&"with 400 x 300 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
+ epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
+#endif
#if 1
epd_paint_showString(10,100,(uint8_t *)&"GD32F103CBT6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK);
#else
- epd_paint_drawRectangle(10, 103, EPD_H - 10, 116, EPD_COLOR_BLACK, 1);
+ epd_paint_drawRectangle(10, EPD_W-20, EPD_H - 10, EPD_W-6, EPD_COLOR_BLACK, 1);
#endif
sprintf((char *)&text, ">> Partial Mode");
diff --git a/Example/EpaperModuleTest_GD32F303/Epaper/epaper.c b/Example/EpaperModuleTest_GD32F303/Epaper/epaper.c
index 3902730..e8a1780 100644
--- a/Example/EpaperModuleTest_GD32F303/Epaper/epaper.c
+++ b/Example/EpaperModuleTest_GD32F303/Epaper/epaper.c
@@ -208,6 +208,7 @@ uint8_t epd_init(void)
if (epd_wait_busy())
return 1;
+ #if defined(EPD_29) || defined(EPD_213) || defined(EPD_154)
epd_write_reg(0x01); // Driver output control
#if defined(EPD_29) || defined(EPD_213)
epd_write_data(0x27);
@@ -251,6 +252,21 @@ uint8_t epd_init(void)
epd_write_reg(0x21); // Display update control
epd_write_data(0x00);
epd_write_data(0x80);
+ #endif
+
+ #elif defined(EPD_42)
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x40);
+ epd_write_data(0x00);
+ epd_write_reg(0x01); // Set MUX as 300
+ epd_write_data(0x2B);
+ epd_write_data(0x01);
+ epd_write_data(0x00);
+ epd_write_reg(0x3C); //BorderWavefrom
+ epd_write_data(0x01);
+ epd_write_reg(0x11); // data entry mode
+ epd_write_data(0x03); // X-mode
+ epd_address_set(0,0,EPD_W-1,EPD_H-1);
#endif
epd_write_reg(0x18); // Read built-in temperature sensor
@@ -278,6 +294,12 @@ uint8_t epd_init_partial(void)
}
_epd_write_data_over();
epd_cs_set();
+ #elif defined(EPD_42)
+ epd_write_reg(0x3C); //BorderWavefrom
+ epd_write_data(0x80);
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x00); // RED normal
+ epd_write_data(0x00); // single chip application
#endif
return 0;
@@ -293,8 +315,13 @@ epd_power_off();
uint8_t epd_power_on(void)
{
+ #if defined EPD_42
+ epd_write_reg(0x22); // Display Update Control
+ epd_write_data(0xe0);
+ #else
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xf8);
+ #endif
epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy();
@@ -316,15 +343,20 @@ void epd_init_internalTempSensor(void)
epd_write_reg(0x1A);
epd_write_data(0x7F);
- epd_write_data(0xF0);
+// epd_write_data(0xF0);
}
void epd_update(void)
{
+
+ #ifdef EPD_154
epd_write_reg(0x22); // Display Update Control
-#ifdef EPD_154
epd_write_data(0xF4);
+ #elif defined EPD_42
+ epd_write_reg(0x22); // Display Update Control
+ epd_write_data(0xF7);
#else
+ epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF7);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
@@ -334,10 +366,14 @@ void epd_update(void)
void epd_update_partial(void)
{
+ #ifdef EPD_154
epd_write_reg(0x22); // Display Update Control
-#ifdef EPD_154
epd_write_data(0xFC);
+ #elif defined EPD_42
+ epd_write_reg(0x22); // Display Update Control
+ epd_write_data(0xFF);
#else
+ epd_write_reg(0x22); // Display Update Control
epd_write_data(0xCC);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
@@ -345,6 +381,19 @@ void epd_update_partial(void)
epd_wait_busy();
}
+void epd_address_set(uint16_t x_start,uint16_t y_start,uint16_t x_end,uint16_t y_end)
+{
+ epd_write_reg(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
+ epd_write_data((x_start>>3) & 0xFF);
+ epd_write_data((x_end>>3) & 0xFF);
+
+ epd_write_reg(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
+ epd_write_data(y_start & 0xFF);
+ epd_write_data((y_start >> 8) & 0xFF);
+ epd_write_data(y_end & 0xFF);
+ epd_write_data((y_end >> 8) & 0xFF);
+}
+
void epd_setpos(uint16_t x, uint16_t y)
{
uint8_t _x;
@@ -354,8 +403,10 @@ void epd_setpos(uint16_t x, uint16_t y)
#ifdef EPD_154
_y = 199 - y;
- #else
+ #elif defined(EPD_29) || defined(EPD_213)
_y = 295 - y;
+ #elif defined(EPD_42)
+ _y = y;
#endif
epd_write_reg(0x4E); // set RAM x address count to 0;
@@ -376,6 +427,17 @@ void epd_writedata(uint8_t *Image1, uint32_t length)
epd_cs_set();
}
+void epd_writedata2(uint8_t data, uint32_t length)
+{
+ epd_cs_reset();
+ for (uint32_t j = 0; j < length; j++)
+ {
+ _epd_write_data(data);
+ }
+ _epd_write_data_over();
+ epd_cs_set();
+}
+
void epd_display(uint8_t *Image1, uint8_t *Image2)
{
uint32_t Width, Height, i, j;
@@ -404,6 +466,12 @@ void epd_display(uint8_t *Image1, uint8_t *Image2)
_epd_write_data_over();
epd_cs_set();
+ #if defined EPD_42
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x00); // RED normal
+ epd_write_data(0x00); // single chip application
+ #endif
+
epd_update();
}
@@ -455,6 +523,11 @@ void epd_displayRED(uint8_t *Image)
epd_write_reg(0x26);
epd_writedata(Image, Width * Height);
+ #if defined EPD_42
+ epd_write_reg(0x21); // Display Update Controll
+ epd_write_data(0x00); // RED normal
+ epd_write_data(0x00); // single chip application
+ #endif
epd_update();
}
diff --git a/Example/EpaperModuleTest_GD32F303/Epaper/epaper.h b/Example/EpaperModuleTest_GD32F303/Epaper/epaper.h
index 40eef6c..c8df27e 100644
--- a/Example/EpaperModuleTest_GD32F303/Epaper/epaper.h
+++ b/Example/EpaperModuleTest_GD32F303/Epaper/epaper.h
@@ -8,11 +8,12 @@ extern "C"
#include "gd32f30x.h"
+//#define EPD_42
//#define EPD_29
//#define EPD_213
//#define EPD_154
-#if (!defined EPD_29) && (!defined EPD_213) && (!defined EPD_154)
+#if (!defined EPD_29) && (!defined EPD_213) && (!defined EPD_154) && (!defined EPD_42)
#error EPD Type Undefine
#endif
@@ -31,6 +32,10 @@ extern "C"
#define EPD_H 200
#endif
+#ifdef EPD_42
+#define EPD_W 400
+#define EPD_H 300
+#endif
#define EPD_OK 0
#define EPD_ERROR 1
@@ -76,6 +81,7 @@ extern "C"
void epd_init_internalTempSensor(void);
void epd_update(void);
void epd_update_partial(void);
+ void epd_address_set(uint16_t x_start,uint16_t y_start,uint16_t x_end,uint16_t y_end);
void epd_setpos(uint16_t x, uint16_t y);
void epd_display(uint8_t *Image1, uint8_t *Image2);
void epd_displayBW(uint8_t *Image);
diff --git a/Example/EpaperModuleTest_GD32F303/Src/main.c b/Example/EpaperModuleTest_GD32F303/Src/main.c
index a54d22d..7e517fb 100644
--- a/Example/EpaperModuleTest_GD32F303/Src/main.c
+++ b/Example/EpaperModuleTest_GD32F303/Src/main.c
@@ -24,7 +24,7 @@ void jump_to_app(uint32_t addr);
#include "bmp.h"
// define for White Black Red Epaper Module
-#define EPD_BWR
+//#define EPD_BWR
uint8_t image_bw[EPD_W_BUFF_SIZE * EPD_H];
#ifdef EPD_BWR
@@ -82,16 +82,25 @@ int main(void)
epd_init();
#ifdef EPD_BWR
+ #ifdef EPD_42
+ epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
+ epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
+ #else
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
-
epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
+ #endif
epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE);
epd_paint_selectimage(image_red);
epd_paint_clear(EPD_COLOR_WHITE);
+
+ #ifdef EPD_42
+ epd_paint_showPicture((EPD_W - 250) / 2, (EPD_H - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #else
epd_paint_showPicture((EPD_H - 250) / 2, (EPD_W - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #endif
epd_display(image_bw, image_red);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@@ -109,6 +118,10 @@ int main(void)
#ifdef EPD_29
epd_paint_showString(10, 0, (uint8_t *)&"2.9 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 50, (uint8_t *)&"with 296 x 128 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
+#endif
+#ifdef EPD_42
+ epd_paint_showString(10, 0, (uint8_t *)&"4.2 Inch Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
+ epd_paint_showString(10, 50, (uint8_t *)&"with 400 x 300 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
@@ -125,8 +138,13 @@ int main(void)
#endif
epd_display(image_bw, image_red);
+
+#else
+ #ifdef EPD_42
+ epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
#else
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
+ #endif
epd_paint_selectimage(image_bw);
@@ -135,8 +153,12 @@ int main(void)
epd_paint_showPicture((EPD_H - 200) / 2,(EPD_W - 64) / 2,200,64,gImage_5,EPD_COLOR_WHITE);
#else
epd_paint_clear(EPD_COLOR_WHITE);
+ #ifdef EPD_42
+ epd_paint_showPicture((EPD_W - 250) / 2, (EPD_H - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
+ #else
epd_paint_showPicture((EPD_H - 250) / 2, (EPD_W - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
#endif
+ #endif
epd_displayBW(image_bw);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@@ -164,11 +186,15 @@ epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SI
epd_paint_showString(10, 50, (uint8_t *)&"with 296 x 128 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
-
+#ifdef EPD_42
+ epd_paint_showString(10, 0, (uint8_t *)&"4.2 Inch Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
+ epd_paint_showString(10, 50, (uint8_t *)&"with 400 x 300 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
+ epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
+#endif
#if 1
epd_paint_showString(10,100,(uint8_t *)&"GD32F303CCT6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK);
#else
- epd_paint_drawRectangle(10, 103, EPD_H - 10, 116, EPD_COLOR_BLACK, 1);
+ epd_paint_drawRectangle(10, EPD_W-20, EPD_H - 10, EPD_W-6, EPD_COLOR_BLACK, 1);
#endif
sprintf((char *)&text, ">> Partial Mode");