add 4.2 inch epaper module examples

This commit is contained in:
YXZhu 2024-05-22 23:36:56 +08:00
parent 7a725ab68b
commit 708ad3a891
24 changed files with 742 additions and 103 deletions

View File

@ -219,6 +219,7 @@ uint8_t epd_init(void)
if (epd_wait_busy()) if (epd_wait_busy())
return 1; return 1;
#if defined(EPD_29) || defined(EPD_213) || defined(EPD_154)
epd_write_reg(0x01); // Driver output control epd_write_reg(0x01); // Driver output control
#if defined(EPD_29) || defined(EPD_213) #if defined(EPD_29) || defined(EPD_213)
epd_write_data(0x27); epd_write_data(0x27);
@ -262,6 +263,21 @@ uint8_t epd_init(void)
epd_write_reg(0x21); // Display update control epd_write_reg(0x21); // Display update control
epd_write_data(0x00); epd_write_data(0x00);
epd_write_data(0x80); 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 #endif
epd_write_reg(0x18); // Read built-in temperature sensor epd_write_reg(0x18); // Read built-in temperature sensor
@ -289,6 +305,12 @@ uint8_t epd_init_partial(void)
} }
_epd_write_data_over(); _epd_write_data_over();
epd_cs_set(); 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 #endif
return 0; return 0;
@ -304,8 +326,13 @@ void epd_enter_deepsleepmode(uint8_t mode)
uint8_t epd_power_on(void) 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_reg(0x22); // Display Update Control
epd_write_data(0xf8); epd_write_data(0xf8);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy(); return epd_wait_busy();
@ -327,15 +354,20 @@ void epd_init_internalTempSensor(void)
epd_write_reg(0x1A); epd_write_reg(0x1A);
epd_write_data(0x7F); epd_write_data(0x7F);
epd_write_data(0xF0); // epd_write_data(0xF0);
} }
void epd_update(void) void epd_update(void)
{ {
#ifdef EPD_154
epd_write_reg(0x22); // Display Update Control epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xF4); epd_write_data(0xF4);
#elif defined EPD_42
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF7);
#else #else
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF7); epd_write_data(0xF7);
#endif #endif
epd_write_reg(0x20); // Activate Display Update Sequence epd_write_reg(0x20); // Activate Display Update Sequence
@ -345,10 +377,14 @@ void epd_update(void)
void epd_update_partial(void) void epd_update_partial(void)
{ {
#ifdef EPD_154
epd_write_reg(0x22); // Display Update Control epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xFC); epd_write_data(0xFC);
#elif defined EPD_42
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xFF);
#else #else
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xCC); epd_write_data(0xCC);
#endif #endif
epd_write_reg(0x20); // Activate Display Update Sequence epd_write_reg(0x20); // Activate Display Update Sequence
@ -356,6 +392,19 @@ void epd_update_partial(void)
epd_wait_busy(); 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) void epd_setpos(uint16_t x, uint16_t y)
{ {
uint8_t _x; uint8_t _x;
@ -365,8 +414,10 @@ void epd_setpos(uint16_t x, uint16_t y)
#ifdef EPD_154 #ifdef EPD_154
_y = 199 - y; _y = 199 - y;
#else #elif defined(EPD_29) || defined(EPD_213)
_y = 295 - y; _y = 295 - y;
#elif defined(EPD_42)
_y = y;
#endif #endif
epd_write_reg(0x4E); // set RAM x address count to 0; 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(); 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) void epd_display(uint8_t *Image1, uint8_t *Image2)
{ {
uint32_t Width, Height, i, j; uint32_t Width, Height, i, j;
@ -415,6 +477,12 @@ void epd_display(uint8_t *Image1, uint8_t *Image2)
_epd_write_data_over(); _epd_write_data_over();
epd_cs_set(); 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(); epd_update();
} }
@ -466,6 +534,11 @@ void epd_displayRED(uint8_t *Image)
epd_write_reg(0x26); epd_write_reg(0x26);
epd_writedata(Image, Width * Height); 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(); epd_update();
} }

View File

@ -8,11 +8,12 @@ extern "C"
#include "apm32f10x.h" #include "apm32f10x.h"
//#define EPD_42
//#define EPD_29 //#define EPD_29
//#define EPD_213 //#define EPD_213
//#define EPD_154 //#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 #error EPD Type Undefine
#endif #endif
@ -31,6 +32,10 @@ extern "C"
#define EPD_H 200 #define EPD_H 200
#endif #endif
#ifdef EPD_42
#define EPD_W 400
#define EPD_H 300
#endif
#define EPD_OK 0 #define EPD_OK 0
#define EPD_ERROR 1 #define EPD_ERROR 1
@ -76,6 +81,7 @@ extern "C"
void epd_init_internalTempSensor(void); void epd_init_internalTempSensor(void);
void epd_update(void); void epd_update(void);
void epd_update_partial(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_setpos(uint16_t x, uint16_t y);
void epd_display(uint8_t *Image1, uint8_t *Image2); void epd_display(uint8_t *Image1, uint8_t *Image2);
void epd_displayBW(uint8_t *Image); void epd_displayBW(uint8_t *Image);

View File

@ -52,16 +52,25 @@ int main(void)
epd_init(); epd_init();
#ifdef EPD_BWR #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_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); epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
#endif
epd_paint_selectimage(image_bw); epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE); epd_paint_clear(EPD_COLOR_WHITE);
epd_paint_selectimage(image_red); epd_paint_selectimage(image_red);
epd_paint_clear(EPD_COLOR_WHITE); 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); 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_display(image_bw, image_red);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1); epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@ -79,6 +88,10 @@ int main(void)
#ifdef EPD_29 #ifdef EPD_29
epd_paint_showString(10, 0, (uint8_t *)&"2.9 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK); 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); 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 #endif
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK); 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 #endif
epd_display(image_bw, image_red); epd_display(image_bw, image_red);
#else #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); epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
#endif
epd_paint_selectimage(image_bw); 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); epd_paint_showPicture((EPD_H - 200) / 2,(EPD_W - 64) / 2,200,64,gImage_5,EPD_COLOR_WHITE);
#else #else
epd_paint_clear(EPD_COLOR_WHITE); 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); 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_displayBW(image_bw);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1); 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, 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); epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif #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 #if 1
epd_paint_showString(10,100,(uint8_t *)&"APM32F103CBT6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK); epd_paint_showString(10,100,(uint8_t *)&"APM32F103CBT6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK);
#else #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 #endif
sprintf((char *)&text, ">> Partial Mode"); sprintf((char *)&text, ">> Partial Mode");

View File

@ -234,54 +234,70 @@ uint8_t epd_init(void)
if (epd_wait_busy()) if (epd_wait_busy())
return 1; return 1;
epd_write_reg(0x01); // Driver output control #if defined(EPD_29) || defined(EPD_213) || defined(EPD_154)
#if defined(EPD_29) || defined(EPD_213) epd_write_reg(0x01); // Driver output control
epd_write_data(0x27); #if defined(EPD_29) || defined(EPD_213)
epd_write_data(0x01); epd_write_data(0x27);
epd_write_data(0x01); epd_write_data(0x01);
#else epd_write_data(0x01);
epd_write_data(0xC7); #else
epd_write_data(0x00); epd_write_data(0xC7);
epd_write_data(0x01); 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 #endif
epd_write_reg(0x11); // data entry mode epd_write_reg(0x18); // Read built-in temperature sensor
epd_write_data(0x01); epd_write_data(0x80);
#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_setpos(0,0); epd_setpos(0,0);
if (epd_power_on()) if (epd_power_on())
@ -304,6 +320,12 @@ uint8_t epd_init_partial(void)
} }
_epd_write_data_over(); _epd_write_data_over();
epd_cs_set(); 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 #endif
return 0; return 0;
@ -319,8 +341,13 @@ void epd_enter_deepsleepmode(uint8_t mode)
uint8_t epd_power_on(void) 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_reg(0x22); // Display Update Control
epd_write_data(0xf8); epd_write_data(0xf8);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy(); return epd_wait_busy();
@ -342,15 +369,20 @@ void epd_init_internalTempSensor(void)
epd_write_reg(0x1A); epd_write_reg(0x1A);
epd_write_data(0x7F); epd_write_data(0x7F);
epd_write_data(0xF0); // epd_write_data(0xF0);
} }
void epd_update(void) void epd_update(void)
{ {
epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154 #ifdef EPD_154
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF4); epd_write_data(0xF4);
#elif defined EPD_42
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF7);
#else #else
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF7); epd_write_data(0xF7);
#endif #endif
epd_write_reg(0x20); // Activate Display Update Sequence epd_write_reg(0x20); // Activate Display Update Sequence
@ -360,10 +392,14 @@ void epd_update(void)
void epd_update_partial(void) void epd_update_partial(void)
{ {
epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154 #ifdef EPD_154
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xFC); epd_write_data(0xFC);
#elif defined EPD_42
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xFF);
#else #else
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xCC); epd_write_data(0xCC);
#endif #endif
epd_write_reg(0x20); // Activate Display Update Sequence epd_write_reg(0x20); // Activate Display Update Sequence
@ -371,6 +407,19 @@ void epd_update_partial(void)
epd_wait_busy(); 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) void epd_setpos(uint16_t x, uint16_t y)
{ {
uint8_t _x; uint8_t _x;
@ -380,8 +429,10 @@ void epd_setpos(uint16_t x, uint16_t y)
#ifdef EPD_154 #ifdef EPD_154
_y = 199 - y; _y = 199 - y;
#else #elif defined(EPD_29) || defined(EPD_213)
_y = 295 - y; _y = 295 - y;
#elif defined(EPD_42)
_y = y;
#endif #endif
epd_write_reg(0x4E); // set RAM x address count to 0; 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(); 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) void epd_display(uint8_t *Image1, uint8_t *Image2)
{ {
uint32_t Width, Height, i, j; uint32_t Width, Height, i, j;
@ -430,6 +492,12 @@ void epd_display(uint8_t *Image1, uint8_t *Image2)
_epd_write_data_over(); _epd_write_data_over();
epd_cs_set(); 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(); epd_update();
} }
@ -481,6 +549,11 @@ void epd_displayRED(uint8_t *Image)
epd_write_reg(0x26); epd_write_reg(0x26);
epd_writedata(Image, Width * Height); 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(); epd_update();
} }

View File

@ -8,11 +8,12 @@ extern "C"
#include "at32f403a_407.h" #include "at32f403a_407.h"
//#define EPD_42
//#define EPD_29 //#define EPD_29
//#define EPD_213 //#define EPD_213
//#define EPD_154 //#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 #error EPD Type Undefine
#endif #endif
@ -31,6 +32,10 @@ extern "C"
#define EPD_H 200 #define EPD_H 200
#endif #endif
#ifdef EPD_42
#define EPD_W 400
#define EPD_H 300
#endif
#define EPD_OK 0 #define EPD_OK 0
#define EPD_ERROR 1 #define EPD_ERROR 1
@ -76,6 +81,7 @@ extern "C"
void epd_init_internalTempSensor(void); void epd_init_internalTempSensor(void);
void epd_update(void); void epd_update(void);
void epd_update_partial(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_setpos(uint16_t x, uint16_t y);
void epd_display(uint8_t *Image1, uint8_t *Image2); void epd_display(uint8_t *Image1, uint8_t *Image2);
void epd_displayBW(uint8_t *Image); void epd_displayBW(uint8_t *Image);

View File

@ -10,7 +10,7 @@
<TargetName>Target 1</TargetName> <TargetName>Target 1</TargetName>
<ToolsetNumber>0x4</ToolsetNumber> <ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName> <ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>6190000::V6.19::ARMCLANG</pCCUsed> <pCCUsed>6210000::V6.21::ARMCLANG</pCCUsed>
<uAC6>1</uAC6> <uAC6>1</uAC6>
<TargetOption> <TargetOption>
<TargetCommonOption> <TargetCommonOption>

View File

@ -49,16 +49,25 @@ int main(void)
epd_init(); epd_init();
#ifdef EPD_BWR #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_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); epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
#endif
epd_paint_selectimage(image_bw); epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE); epd_paint_clear(EPD_COLOR_WHITE);
epd_paint_selectimage(image_red); epd_paint_selectimage(image_red);
epd_paint_clear(EPD_COLOR_WHITE); 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_display(image_bw, image_red);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1); epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@ -76,6 +85,10 @@ int main(void)
#ifdef EPD_29 #ifdef EPD_29
epd_paint_showString(10, 0, (uint8_t *)&"2.9 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK); 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); 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 #endif
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK); 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."); sprintf((char *)&text, ">> Hello World.");
epd_paint_showString(10, 71, text, EPD_FONT_SIZE24x12, EPD_COLOR_RED); 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); epd_paint_showString(10,100,(uint8_t *)&"AT32F403ACGU7 Example",EPD_FONT_SIZE16x8,EPD_COLOR_RED);
#else #else
epd_paint_drawRectangle(10, 103, EPD_H - 10, 116, EPD_COLOR_RED, 1); epd_paint_drawRectangle(10, 103, EPD_H - 10, 116, EPD_COLOR_RED, 1);
#endif #endif
epd_display(image_bw, image_red); epd_display(image_bw, image_red);
#else #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); 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); epd_paint_showPicture((EPD_H - 200) / 2,(EPD_W - 64) / 2,200,64,gImage_5,EPD_COLOR_WHITE);
#else #else
epd_paint_clear(EPD_COLOR_WHITE); 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 #endif
epd_displayBW(image_bw); 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, 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); epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif #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 #if 1
epd_paint_showString(10,100,(uint8_t *)&"AT32F403ACGU7 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK); epd_paint_showString(10,100,(uint8_t *)&"AT32F403ACGU7 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK);
#else #else

View File

@ -20,6 +20,9 @@ GxEPD2_BW<GxEPD2_213_BN, GxEPD2_213_BN::HEIGHT> display(GxEPD2_213_BN(/*CS=5*/ 5
//GxEPD2_BW<GxEPD2_290_BS, GxEPD2_290_BS::HEIGHT> display(GxEPD2_290_BS(/*CS=5*/ 5, /*DC=*/ 0, /*RES=*/ 2, /*BUSY=*/ 15)); // DEPG0290BS 128x296, SSD1680 //GxEPD2_BW<GxEPD2_290_BS, GxEPD2_290_BS::HEIGHT> display(GxEPD2_290_BS(/*CS=5*/ 5, /*DC=*/ 0, /*RES=*/ 2, /*BUSY=*/ 15)); // DEPG0290BS 128x296, SSD1680
//GxEPD2_3C<GxEPD2_290_C90c, GxEPD2_290_C90c::HEIGHT> display(GxEPD2_290_C90c(/*CS=5*/ 5, /*DC=*/ 0, /*RES=*/ 2, /*BUSY=*/ 15)); // GDEM029C90 128x296, SSD1680 //GxEPD2_3C<GxEPD2_290_C90c, GxEPD2_290_C90c::HEIGHT> display(GxEPD2_290_C90c(/*CS=5*/ 5, /*DC=*/ 0, /*RES=*/ 2, /*BUSY=*/ 15)); // GDEM029C90 128x296, SSD1680
// 4.2'' EPD Module
//GxEPD2_BW<GxEPD2_420_GDEY042T81, GxEPD2_420_GDEY042T81::HEIGHT> display(GxEPD2_420_GDEY042T81(/*CS=5*/ 5, /*DC=*/ 0, /*RES=*/ 2, /*BUSY=*/ 15)); // 400x300, SSD1683
void setup() void setup()
{ {
display.init(115200,true,50,false); display.init(115200,true,50,false);

View File

@ -20,6 +20,9 @@ GxEPD2_BW<GxEPD2_213_BN, GxEPD2_213_BN::HEIGHT> display(GxEPD2_213_BN(/*CS=5*/ S
//GxEPD2_BW<GxEPD2_290_BS, GxEPD2_290_BS::HEIGHT> display(GxEPD2_290_BS(/*CS=5*/ SS, /*DC=*/ 1, /*RES=*/ 2, /*BUSY=*/ 3)); // DEPG0290BS 128x296, SSD1680 //GxEPD2_BW<GxEPD2_290_BS, GxEPD2_290_BS::HEIGHT> display(GxEPD2_290_BS(/*CS=5*/ SS, /*DC=*/ 1, /*RES=*/ 2, /*BUSY=*/ 3)); // DEPG0290BS 128x296, SSD1680
//GxEPD2_3C<GxEPD2_290_C90c, GxEPD2_290_C90c::HEIGHT> display(GxEPD2_290_C90c(/*CS=5*/ SS, /*DC=*/ 1, /*RES=*/ 2, /*BUSY=*/ 3)); // GDEM029C90 128x296, SSD1680 //GxEPD2_3C<GxEPD2_290_C90c, GxEPD2_290_C90c::HEIGHT> display(GxEPD2_290_C90c(/*CS=5*/ SS, /*DC=*/ 1, /*RES=*/ 2, /*BUSY=*/ 3)); // GDEM029C90 128x296, SSD1680
// 4.2'' EPD Module
//GxEPD2_BW<GxEPD2_420_GDEY042T81, GxEPD2_420_GDEY042T81::HEIGHT> display(GxEPD2_420_GDEY042T81(/*CS=5*/ SS, /*DC=*/ 1, /*RES=*/ 2, /*BUSY=*/ 3)); // 400x300, SSD1683
void setup() void setup()
{ {
pinMode(8, OUTPUT); pinMode(8, OUTPUT);

View File

@ -20,6 +20,9 @@ GxEPD2_BW<GxEPD2_213_BN, GxEPD2_213_BN::HEIGHT> display(GxEPD2_213_BN(/*CS=5*/ 1
//GxEPD2_BW<GxEPD2_290_BS, GxEPD2_290_BS::HEIGHT> display(GxEPD2_290_BS(/*CS=5*/ 15, /*DC=*/ 4, /*RES=*/ 5, /*BUSY=*/ 16)); // DEPG0290BS 128x296, SSD1680 //GxEPD2_BW<GxEPD2_290_BS, GxEPD2_290_BS::HEIGHT> display(GxEPD2_290_BS(/*CS=5*/ 15, /*DC=*/ 4, /*RES=*/ 5, /*BUSY=*/ 16)); // DEPG0290BS 128x296, SSD1680
//GxEPD2_3C<GxEPD2_290_C90c, GxEPD2_290_C90c::HEIGHT> display(GxEPD2_290_C90c(/*CS=5*/ 15, /*DC=*/ 4, /*RES=*/ 5, /*BUSY=*/ 16)); // GDEM029C90 128x296, SSD1680 //GxEPD2_3C<GxEPD2_290_C90c, GxEPD2_290_C90c::HEIGHT> display(GxEPD2_290_C90c(/*CS=5*/ 15, /*DC=*/ 4, /*RES=*/ 5, /*BUSY=*/ 16)); // GDEM029C90 128x296, SSD1680
// 4.2'' EPD Module
//GxEPD2_BW<GxEPD2_420_GDEY042T81, GxEPD2_420_GDEY042T81::HEIGHT> display(GxEPD2_420_GDEY042T81(/*CS=5*/ 15, /*DC=*/ 4, /*RES=*/ 5, /*BUSY=*/ 16)); // 400x300, SSD1683
void setup() void setup()
{ {
display.init(115200,true,50,false); display.init(115200,true,50,false);

View File

@ -218,6 +218,7 @@ uint8_t epd_init(void)
if (epd_wait_busy()) if (epd_wait_busy())
return 1; return 1;
#if defined(EPD_29) || defined(EPD_213) || defined(EPD_154)
epd_write_reg(0x01); // Driver output control epd_write_reg(0x01); // Driver output control
#if defined(EPD_29) || defined(EPD_213) #if defined(EPD_29) || defined(EPD_213)
epd_write_data(0x27); epd_write_data(0x27);
@ -261,6 +262,21 @@ uint8_t epd_init(void)
epd_write_reg(0x21); // Display update control epd_write_reg(0x21); // Display update control
epd_write_data(0x00); epd_write_data(0x00);
epd_write_data(0x80); 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 #endif
epd_write_reg(0x18); // Read built-in temperature sensor epd_write_reg(0x18); // Read built-in temperature sensor
@ -288,6 +304,12 @@ uint8_t epd_init_partial(void)
} }
_epd_write_data_over(); _epd_write_data_over();
epd_cs_set(); 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 #endif
return 0; return 0;
@ -303,8 +325,13 @@ void epd_enter_deepsleepmode(uint8_t mode)
uint8_t epd_power_on(void) 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_reg(0x22); // Display Update Control
epd_write_data(0xf8); epd_write_data(0xf8);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy(); return epd_wait_busy();
@ -326,15 +353,20 @@ void epd_init_internalTempSensor(void)
epd_write_reg(0x1A); epd_write_reg(0x1A);
epd_write_data(0x7F); epd_write_data(0x7F);
epd_write_data(0xF0); // epd_write_data(0xF0);
} }
void epd_update(void) void epd_update(void)
{ {
#ifdef EPD_154
epd_write_reg(0x22); // Display Update Control epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xF4); epd_write_data(0xF4);
#elif defined EPD_42
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF7);
#else #else
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF7); epd_write_data(0xF7);
#endif #endif
epd_write_reg(0x20); // Activate Display Update Sequence epd_write_reg(0x20); // Activate Display Update Sequence
@ -344,10 +376,14 @@ void epd_update(void)
void epd_update_partial(void) void epd_update_partial(void)
{ {
#ifdef EPD_154
epd_write_reg(0x22); // Display Update Control epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xFC); epd_write_data(0xFC);
#elif defined EPD_42
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xFF);
#else #else
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xCC); epd_write_data(0xCC);
#endif #endif
epd_write_reg(0x20); // Activate Display Update Sequence epd_write_reg(0x20); // Activate Display Update Sequence
@ -355,6 +391,19 @@ void epd_update_partial(void)
epd_wait_busy(); 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) void epd_setpos(uint16_t x, uint16_t y)
{ {
uint8_t _x; uint8_t _x;
@ -364,8 +413,10 @@ void epd_setpos(uint16_t x, uint16_t y)
#ifdef EPD_154 #ifdef EPD_154
_y = 199 - y; _y = 199 - y;
#else #elif defined(EPD_29) || defined(EPD_213)
_y = 295 - y; _y = 295 - y;
#elif defined(EPD_42)
_y = y;
#endif #endif
epd_write_reg(0x4E); // set RAM x address count to 0; 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(); 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) void epd_display(uint8_t *Image1, uint8_t *Image2)
{ {
uint32_t Width, Height, i, j; uint32_t Width, Height, i, j;
@ -414,6 +476,12 @@ void epd_display(uint8_t *Image1, uint8_t *Image2)
_epd_write_data_over(); _epd_write_data_over();
epd_cs_set(); 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(); epd_update();
} }
@ -465,6 +533,11 @@ void epd_displayRED(uint8_t *Image)
epd_write_reg(0x26); epd_write_reg(0x26);
epd_writedata(Image, Width * Height); 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(); epd_update();
} }

View File

@ -8,11 +8,12 @@ extern "C"
#include "ch32f10x.h" #include "ch32f10x.h"
//#define EPD_42
//#define EPD_29 //#define EPD_29
//#define EPD_213 //#define EPD_213
//#define EPD_154 //#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 #error EPD Type Undefine
#endif #endif
@ -31,6 +32,10 @@ extern "C"
#define EPD_H 200 #define EPD_H 200
#endif #endif
#ifdef EPD_42
#define EPD_W 400
#define EPD_H 300
#endif
#define EPD_OK 0 #define EPD_OK 0
#define EPD_ERROR 1 #define EPD_ERROR 1
@ -76,6 +81,7 @@ extern "C"
void epd_init_internalTempSensor(void); void epd_init_internalTempSensor(void);
void epd_update(void); void epd_update(void);
void epd_update_partial(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_setpos(uint16_t x, uint16_t y);
void epd_display(uint8_t *Image1, uint8_t *Image2); void epd_display(uint8_t *Image1, uint8_t *Image2);
void epd_displayBW(uint8_t *Image); void epd_displayBW(uint8_t *Image);

View File

@ -15,7 +15,7 @@
#include "bmp.h" #include "bmp.h"
// define for White Black Red Epaper Module // define for White Black Red Epaper Module
#define EPD_BWR //#define EPD_BWR
uint8_t image_bw[EPD_W_BUFF_SIZE * EPD_H]; uint8_t image_bw[EPD_W_BUFF_SIZE * EPD_H];
#ifdef EPD_BWR #ifdef EPD_BWR
@ -56,16 +56,25 @@ int main(void)
epd_init(); epd_init();
#ifdef EPD_BWR #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_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); epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
#endif
epd_paint_selectimage(image_bw); epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE); epd_paint_clear(EPD_COLOR_WHITE);
epd_paint_selectimage(image_red); epd_paint_selectimage(image_red);
epd_paint_clear(EPD_COLOR_WHITE); 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); 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_display(image_bw, image_red);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1); epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@ -83,6 +92,10 @@ int main(void)
#ifdef EPD_29 #ifdef EPD_29
epd_paint_showString(10, 0, (uint8_t *)&"2.9 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK); 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); 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 #endif
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK); 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 #endif
epd_display(image_bw, image_red); 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 #else
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE); epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
#endif
epd_paint_selectimage(image_bw); 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); epd_paint_showPicture((EPD_H - 200) / 2,(EPD_W - 64) / 2,200,64,gImage_5,EPD_COLOR_WHITE);
#else #else
epd_paint_clear(EPD_COLOR_WHITE); 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); 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_displayBW(image_bw);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1); 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, 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); epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif #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 #if 1
epd_paint_showString(10,100,(uint8_t *)&"CH32F103C8T6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK); epd_paint_showString(10,100,(uint8_t *)&"CH32F103C8T6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK);
#else #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 #endif
sprintf((char *)&text, ">> Partial Mode"); sprintf((char *)&text, ">> Partial Mode");

View File

@ -218,6 +218,7 @@ uint8_t epd_init(void)
if (epd_wait_busy()) if (epd_wait_busy())
return 1; return 1;
#if defined(EPD_29) || defined(EPD_213) || defined(EPD_154)
epd_write_reg(0x01); // Driver output control epd_write_reg(0x01); // Driver output control
#if defined(EPD_29) || defined(EPD_213) #if defined(EPD_29) || defined(EPD_213)
epd_write_data(0x27); epd_write_data(0x27);
@ -261,6 +262,21 @@ uint8_t epd_init(void)
epd_write_reg(0x21); // Display update control epd_write_reg(0x21); // Display update control
epd_write_data(0x00); epd_write_data(0x00);
epd_write_data(0x80); 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 #endif
epd_write_reg(0x18); // Read built-in temperature sensor epd_write_reg(0x18); // Read built-in temperature sensor
@ -288,6 +304,12 @@ uint8_t epd_init_partial(void)
} }
_epd_write_data_over(); _epd_write_data_over();
epd_cs_set(); 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 #endif
return 0; return 0;
@ -303,8 +325,13 @@ void epd_enter_deepsleepmode(uint8_t mode)
uint8_t epd_power_on(void) 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_reg(0x22); // Display Update Control
epd_write_data(0xf8); epd_write_data(0xf8);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy(); return epd_wait_busy();
@ -326,15 +353,20 @@ void epd_init_internalTempSensor(void)
epd_write_reg(0x1A); epd_write_reg(0x1A);
epd_write_data(0x7F); epd_write_data(0x7F);
epd_write_data(0xF0); // epd_write_data(0xF0);
} }
void epd_update(void) void epd_update(void)
{ {
#ifdef EPD_154
epd_write_reg(0x22); // Display Update Control epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xF4); epd_write_data(0xF4);
#elif defined EPD_42
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF7);
#else #else
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF7); epd_write_data(0xF7);
#endif #endif
epd_write_reg(0x20); // Activate Display Update Sequence epd_write_reg(0x20); // Activate Display Update Sequence
@ -344,10 +376,14 @@ void epd_update(void)
void epd_update_partial(void) void epd_update_partial(void)
{ {
#ifdef EPD_154
epd_write_reg(0x22); // Display Update Control epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xFC); epd_write_data(0xFC);
#elif defined EPD_42
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xFF);
#else #else
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xCC); epd_write_data(0xCC);
#endif #endif
epd_write_reg(0x20); // Activate Display Update Sequence epd_write_reg(0x20); // Activate Display Update Sequence
@ -355,6 +391,19 @@ void epd_update_partial(void)
epd_wait_busy(); 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) void epd_setpos(uint16_t x, uint16_t y)
{ {
uint8_t _x; uint8_t _x;
@ -364,8 +413,10 @@ void epd_setpos(uint16_t x, uint16_t y)
#ifdef EPD_154 #ifdef EPD_154
_y = 199 - y; _y = 199 - y;
#else #elif defined(EPD_29) || defined(EPD_213)
_y = 295 - y; _y = 295 - y;
#elif defined(EPD_42)
_y = y;
#endif #endif
epd_write_reg(0x4E); // set RAM x address count to 0; 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(); 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) void epd_display(uint8_t *Image1, uint8_t *Image2)
{ {
uint32_t Width, Height, i, j; uint32_t Width, Height, i, j;
@ -414,6 +476,12 @@ void epd_display(uint8_t *Image1, uint8_t *Image2)
_epd_write_data_over(); _epd_write_data_over();
epd_cs_set(); 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(); epd_update();
} }
@ -465,6 +533,11 @@ void epd_displayRED(uint8_t *Image)
epd_write_reg(0x26); epd_write_reg(0x26);
epd_writedata(Image, Width * Height); 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(); epd_update();
} }

View File

@ -8,11 +8,12 @@ extern "C"
#include "ch32v10x.h" #include "ch32v10x.h"
//#define EPD_42
//#define EPD_29 //#define EPD_29
//#define EPD_213 //#define EPD_213
//#define EPD_154 //#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 #error EPD Type Undefine
#endif #endif
@ -31,6 +32,10 @@ extern "C"
#define EPD_H 200 #define EPD_H 200
#endif #endif
#ifdef EPD_42
#define EPD_W 400
#define EPD_H 300
#endif
#define EPD_OK 0 #define EPD_OK 0
#define EPD_ERROR 1 #define EPD_ERROR 1
@ -76,6 +81,7 @@ extern "C"
void epd_init_internalTempSensor(void); void epd_init_internalTempSensor(void);
void epd_update(void); void epd_update(void);
void epd_update_partial(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_setpos(uint16_t x, uint16_t y);
void epd_display(uint8_t *Image1, uint8_t *Image2); void epd_display(uint8_t *Image1, uint8_t *Image2);
void epd_displayBW(uint8_t *Image); void epd_displayBW(uint8_t *Image);

View File

@ -15,7 +15,7 @@
#include "bmp.h" #include "bmp.h"
// define for White Black Red Epaper Module // define for White Black Red Epaper Module
#define EPD_BWR //#define EPD_BWR
uint8_t image_bw[EPD_W_BUFF_SIZE * EPD_H]; uint8_t image_bw[EPD_W_BUFF_SIZE * EPD_H];
#ifdef EPD_BWR #ifdef EPD_BWR
@ -56,16 +56,25 @@ int main(void)
epd_init(); epd_init();
#ifdef EPD_BWR #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_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); epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
#endif
epd_paint_selectimage(image_bw); epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE); epd_paint_clear(EPD_COLOR_WHITE);
epd_paint_selectimage(image_red); epd_paint_selectimage(image_red);
epd_paint_clear(EPD_COLOR_WHITE); 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); 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_display(image_bw, image_red);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1); epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@ -83,6 +92,10 @@ int main(void)
#ifdef EPD_29 #ifdef EPD_29
epd_paint_showString(10, 0, (uint8_t *)&"2.9 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK); 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); 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 #endif
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK); 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 #endif
epd_display(image_bw, image_red); 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 #else
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE); epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
#endif
epd_paint_selectimage(image_bw); 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); epd_paint_showPicture((EPD_H - 200) / 2,(EPD_W - 64) / 2,200,64,gImage_5,EPD_COLOR_WHITE);
#else #else
epd_paint_clear(EPD_COLOR_WHITE); 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); 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_displayBW(image_bw);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1); 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, 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); epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif #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 #if 1
epd_paint_showString(10,100,(uint8_t *)&"CH32V103C8T6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK); epd_paint_showString(10,100,(uint8_t *)&"CH32V103C8T6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK);
#else #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 #endif
sprintf((char *)&text, ">> Partial Mode"); sprintf((char *)&text, ">> Partial Mode");

View File

@ -208,6 +208,7 @@ uint8_t epd_init(void)
if (epd_wait_busy()) if (epd_wait_busy())
return 1; return 1;
#if defined(EPD_29) || defined(EPD_213) || defined(EPD_154)
epd_write_reg(0x01); // Driver output control epd_write_reg(0x01); // Driver output control
#if defined(EPD_29) || defined(EPD_213) #if defined(EPD_29) || defined(EPD_213)
epd_write_data(0x27); epd_write_data(0x27);
@ -251,6 +252,21 @@ uint8_t epd_init(void)
epd_write_reg(0x21); // Display update control epd_write_reg(0x21); // Display update control
epd_write_data(0x00); epd_write_data(0x00);
epd_write_data(0x80); 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 #endif
epd_write_reg(0x18); // Read built-in temperature sensor epd_write_reg(0x18); // Read built-in temperature sensor
@ -278,6 +294,12 @@ uint8_t epd_init_partial(void)
} }
_epd_write_data_over(); _epd_write_data_over();
epd_cs_set(); 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 #endif
return 0; return 0;
@ -293,8 +315,13 @@ epd_power_off();
uint8_t epd_power_on(void) 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_reg(0x22); // Display Update Control
epd_write_data(0xf8); epd_write_data(0xf8);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy(); return epd_wait_busy();
@ -316,15 +343,20 @@ void epd_init_internalTempSensor(void)
epd_write_reg(0x1A); epd_write_reg(0x1A);
epd_write_data(0x7F); epd_write_data(0x7F);
epd_write_data(0xF0); // epd_write_data(0xF0);
} }
void epd_update(void) void epd_update(void)
{ {
#ifdef EPD_154
epd_write_reg(0x22); // Display Update Control epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xF4); epd_write_data(0xF4);
#elif defined EPD_42
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF7);
#else #else
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF7); epd_write_data(0xF7);
#endif #endif
epd_write_reg(0x20); // Activate Display Update Sequence epd_write_reg(0x20); // Activate Display Update Sequence
@ -334,10 +366,14 @@ void epd_update(void)
void epd_update_partial(void) void epd_update_partial(void)
{ {
#ifdef EPD_154
epd_write_reg(0x22); // Display Update Control epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xFC); epd_write_data(0xFC);
#elif defined EPD_42
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xFF);
#else #else
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xCC); epd_write_data(0xCC);
#endif #endif
epd_write_reg(0x20); // Activate Display Update Sequence epd_write_reg(0x20); // Activate Display Update Sequence
@ -345,6 +381,19 @@ void epd_update_partial(void)
epd_wait_busy(); 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) void epd_setpos(uint16_t x, uint16_t y)
{ {
uint8_t _x; uint8_t _x;
@ -354,8 +403,10 @@ void epd_setpos(uint16_t x, uint16_t y)
#ifdef EPD_154 #ifdef EPD_154
_y = 199 - y; _y = 199 - y;
#else #elif defined(EPD_29) || defined(EPD_213)
_y = 295 - y; _y = 295 - y;
#elif defined(EPD_42)
_y = y;
#endif #endif
epd_write_reg(0x4E); // set RAM x address count to 0; 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(); 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) void epd_display(uint8_t *Image1, uint8_t *Image2)
{ {
uint32_t Width, Height, i, j; uint32_t Width, Height, i, j;
@ -404,6 +466,12 @@ void epd_display(uint8_t *Image1, uint8_t *Image2)
_epd_write_data_over(); _epd_write_data_over();
epd_cs_set(); 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(); epd_update();
} }
@ -455,6 +523,11 @@ void epd_displayRED(uint8_t *Image)
epd_write_reg(0x26); epd_write_reg(0x26);
epd_writedata(Image, Width * Height); 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(); epd_update();
} }

View File

@ -8,11 +8,12 @@ extern "C"
#include "gd32f10x.h" #include "gd32f10x.h"
//#define EPD_42
//#define EPD_29 //#define EPD_29
//#define EPD_213 //#define EPD_213
//#define EPD_154 //#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 #error EPD Type Undefine
#endif #endif
@ -31,6 +32,10 @@ extern "C"
#define EPD_H 200 #define EPD_H 200
#endif #endif
#ifdef EPD_42
#define EPD_W 400
#define EPD_H 300
#endif
#define EPD_OK 0 #define EPD_OK 0
#define EPD_ERROR 1 #define EPD_ERROR 1
@ -76,6 +81,7 @@ extern "C"
void epd_init_internalTempSensor(void); void epd_init_internalTempSensor(void);
void epd_update(void); void epd_update(void);
void epd_update_partial(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_setpos(uint16_t x, uint16_t y);
void epd_display(uint8_t *Image1, uint8_t *Image2); void epd_display(uint8_t *Image1, uint8_t *Image2);
void epd_displayBW(uint8_t *Image); void epd_displayBW(uint8_t *Image);

View File

@ -18,7 +18,7 @@
#include "bmp.h" #include "bmp.h"
// define for White Black Red Epaper Module // define for White Black Red Epaper Module
#define EPD_BWR //#define EPD_BWR
uint8_t image_bw[EPD_W_BUFF_SIZE * EPD_H]; uint8_t image_bw[EPD_W_BUFF_SIZE * EPD_H];
#ifdef EPD_BWR #ifdef EPD_BWR
@ -56,16 +56,25 @@ int main(void)
epd_init(); epd_init();
#ifdef EPD_BWR #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_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); epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
#endif
epd_paint_selectimage(image_bw); epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE); epd_paint_clear(EPD_COLOR_WHITE);
epd_paint_selectimage(image_red); epd_paint_selectimage(image_red);
epd_paint_clear(EPD_COLOR_WHITE); 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); 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_display(image_bw, image_red);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1); epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@ -83,6 +92,10 @@ int main(void)
#ifdef EPD_29 #ifdef EPD_29
epd_paint_showString(10, 0, (uint8_t *)&"2.9 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK); 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); 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 #endif
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK); 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 #endif
epd_display(image_bw, image_red); 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 #else
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE); epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
#endif
epd_paint_selectimage(image_bw); 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); epd_paint_showPicture((EPD_H - 200) / 2,(EPD_W - 64) / 2,200,64,gImage_5,EPD_COLOR_WHITE);
#else #else
epd_paint_clear(EPD_COLOR_WHITE); 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); 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_displayBW(image_bw);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1); 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, 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); epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif #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 #if 1
epd_paint_showString(10,100,(uint8_t *)&"GD32F103CBT6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK); epd_paint_showString(10,100,(uint8_t *)&"GD32F103CBT6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK);
#else #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 #endif
sprintf((char *)&text, ">> Partial Mode"); sprintf((char *)&text, ">> Partial Mode");

View File

@ -208,6 +208,7 @@ uint8_t epd_init(void)
if (epd_wait_busy()) if (epd_wait_busy())
return 1; return 1;
#if defined(EPD_29) || defined(EPD_213) || defined(EPD_154)
epd_write_reg(0x01); // Driver output control epd_write_reg(0x01); // Driver output control
#if defined(EPD_29) || defined(EPD_213) #if defined(EPD_29) || defined(EPD_213)
epd_write_data(0x27); epd_write_data(0x27);
@ -251,6 +252,21 @@ uint8_t epd_init(void)
epd_write_reg(0x21); // Display update control epd_write_reg(0x21); // Display update control
epd_write_data(0x00); epd_write_data(0x00);
epd_write_data(0x80); 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 #endif
epd_write_reg(0x18); // Read built-in temperature sensor epd_write_reg(0x18); // Read built-in temperature sensor
@ -278,6 +294,12 @@ uint8_t epd_init_partial(void)
} }
_epd_write_data_over(); _epd_write_data_over();
epd_cs_set(); 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 #endif
return 0; return 0;
@ -293,8 +315,13 @@ epd_power_off();
uint8_t epd_power_on(void) 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_reg(0x22); // Display Update Control
epd_write_data(0xf8); epd_write_data(0xf8);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy(); return epd_wait_busy();
@ -316,15 +343,20 @@ void epd_init_internalTempSensor(void)
epd_write_reg(0x1A); epd_write_reg(0x1A);
epd_write_data(0x7F); epd_write_data(0x7F);
epd_write_data(0xF0); // epd_write_data(0xF0);
} }
void epd_update(void) void epd_update(void)
{ {
#ifdef EPD_154
epd_write_reg(0x22); // Display Update Control epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xF4); epd_write_data(0xF4);
#elif defined EPD_42
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF7);
#else #else
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xF7); epd_write_data(0xF7);
#endif #endif
epd_write_reg(0x20); // Activate Display Update Sequence epd_write_reg(0x20); // Activate Display Update Sequence
@ -334,10 +366,14 @@ void epd_update(void)
void epd_update_partial(void) void epd_update_partial(void)
{ {
#ifdef EPD_154
epd_write_reg(0x22); // Display Update Control epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xFC); epd_write_data(0xFC);
#elif defined EPD_42
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xFF);
#else #else
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xCC); epd_write_data(0xCC);
#endif #endif
epd_write_reg(0x20); // Activate Display Update Sequence epd_write_reg(0x20); // Activate Display Update Sequence
@ -345,6 +381,19 @@ void epd_update_partial(void)
epd_wait_busy(); 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) void epd_setpos(uint16_t x, uint16_t y)
{ {
uint8_t _x; uint8_t _x;
@ -354,8 +403,10 @@ void epd_setpos(uint16_t x, uint16_t y)
#ifdef EPD_154 #ifdef EPD_154
_y = 199 - y; _y = 199 - y;
#else #elif defined(EPD_29) || defined(EPD_213)
_y = 295 - y; _y = 295 - y;
#elif defined(EPD_42)
_y = y;
#endif #endif
epd_write_reg(0x4E); // set RAM x address count to 0; 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(); 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) void epd_display(uint8_t *Image1, uint8_t *Image2)
{ {
uint32_t Width, Height, i, j; uint32_t Width, Height, i, j;
@ -404,6 +466,12 @@ void epd_display(uint8_t *Image1, uint8_t *Image2)
_epd_write_data_over(); _epd_write_data_over();
epd_cs_set(); 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(); epd_update();
} }
@ -455,6 +523,11 @@ void epd_displayRED(uint8_t *Image)
epd_write_reg(0x26); epd_write_reg(0x26);
epd_writedata(Image, Width * Height); 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(); epd_update();
} }

View File

@ -8,11 +8,12 @@ extern "C"
#include "gd32f30x.h" #include "gd32f30x.h"
//#define EPD_42
//#define EPD_29 //#define EPD_29
//#define EPD_213 //#define EPD_213
//#define EPD_154 //#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 #error EPD Type Undefine
#endif #endif
@ -31,6 +32,10 @@ extern "C"
#define EPD_H 200 #define EPD_H 200
#endif #endif
#ifdef EPD_42
#define EPD_W 400
#define EPD_H 300
#endif
#define EPD_OK 0 #define EPD_OK 0
#define EPD_ERROR 1 #define EPD_ERROR 1
@ -76,6 +81,7 @@ extern "C"
void epd_init_internalTempSensor(void); void epd_init_internalTempSensor(void);
void epd_update(void); void epd_update(void);
void epd_update_partial(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_setpos(uint16_t x, uint16_t y);
void epd_display(uint8_t *Image1, uint8_t *Image2); void epd_display(uint8_t *Image1, uint8_t *Image2);
void epd_displayBW(uint8_t *Image); void epd_displayBW(uint8_t *Image);

View File

@ -24,7 +24,7 @@ void jump_to_app(uint32_t addr);
#include "bmp.h" #include "bmp.h"
// define for White Black Red Epaper Module // define for White Black Red Epaper Module
#define EPD_BWR //#define EPD_BWR
uint8_t image_bw[EPD_W_BUFF_SIZE * EPD_H]; uint8_t image_bw[EPD_W_BUFF_SIZE * EPD_H];
#ifdef EPD_BWR #ifdef EPD_BWR
@ -82,16 +82,25 @@ int main(void)
epd_init(); epd_init();
#ifdef EPD_BWR #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_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); epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
#endif
epd_paint_selectimage(image_bw); epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE); epd_paint_clear(EPD_COLOR_WHITE);
epd_paint_selectimage(image_red); epd_paint_selectimage(image_red);
epd_paint_clear(EPD_COLOR_WHITE); 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); 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_display(image_bw, image_red);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1); epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@ -109,6 +118,10 @@ int main(void)
#ifdef EPD_29 #ifdef EPD_29
epd_paint_showString(10, 0, (uint8_t *)&"2.9 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK); 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); 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 #endif
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK); 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 #endif
epd_display(image_bw, image_red); 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 #else
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE); epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
#endif
epd_paint_selectimage(image_bw); 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); epd_paint_showPicture((EPD_H - 200) / 2,(EPD_W - 64) / 2,200,64,gImage_5,EPD_COLOR_WHITE);
#else #else
epd_paint_clear(EPD_COLOR_WHITE); 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); 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_displayBW(image_bw);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1); 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, 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); epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif #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 #if 1
epd_paint_showString(10,100,(uint8_t *)&"GD32F303CCT6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK); epd_paint_showString(10,100,(uint8_t *)&"GD32F303CCT6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK);
#else #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 #endif
sprintf((char *)&text, ">> Partial Mode"); sprintf((char *)&text, ">> Partial Mode");