add 1.54 inch epaper module

This commit is contained in:
YXZhu 2023-11-28 22:47:01 +08:00
parent ac86e76744
commit 2ca4f9b243
38 changed files with 1218 additions and 107 deletions

8
.gitignore vendored
View File

@ -49,3 +49,11 @@ stm32.mak
.vagrant
ubuntu*.log
/.vs
JLinkLog.txt
*.map
*.build_log.htm
*.lst
*.htm
*.sct

BIN
Doc/SSD1681.pdf Normal file

Binary file not shown.

Binary file not shown.

View File

@ -528,6 +528,109 @@ const unsigned char gImage_4[4000]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
const unsigned char gImage_5[1600]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xE0,0xE0,0xE0,0xE0,0xC0,0x00,0x00,0x00,0x00,
0x00,0x80,0xE0,0xE0,0xE0,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0xE0,
0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xE0,0xE0,0xF0,0xF0,0xF0,0xF0,
0xF0,0xF0,0xE0,0xE0,0xC0,0xC0,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xF8,0xF8,0xF8,0xF8,0xF8,0x00,0x00,0x00,0xF8,0xF8,0xF8,0xF8,0xF8,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,
0xFF,0xFF,0xFF,0xFF,0xF8,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFE,
0xE0,0x00,0x00,0x80,0xFC,0xFF,0xFF,0xFF,0x3F,0x01,0x00,0xC0,0xF0,0xF8,0xF8,0xFC,
0x7C,0x3C,0x3C,0x3C,0x7C,0xFC,0xF8,0xF8,0xF0,0xC0,0x00,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,0xE0,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xC1,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0x81,0x01,0x03,0x03,0x07,0x07,0x0F,
0x0F,0x1F,0xFF,0xFF,0xFF,0xFE,0xF8,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,
0xFF,0xFF,0xFF,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xC3,0x00,0x00,0x00,0x00,0x00,
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0x81,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0xFF,0xFF,
0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x03,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x01,0x00,0x00,0x00,0x00,0x00,0x07,
0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x0F,0x0F,0x1F,
0x1F,0x1E,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,0x0E,0x18,0x1F,0x1F,0x1F,0x1F,0x07,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0F,0x1F,0x1F,0x1F,0x1F,0x18,0x03,0x07,
0x0F,0x0F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,0x0F,0x0E,0x00,0x00,0x03,0x0F,
0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x18,0x00,0x00,0x00,0x00,0x00,0x02,0x07,0x0F,
0x0F,0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,0x0F,0x0F,0x07,0x01,0x00,
0x00,0x01,0x0F,0x1F,0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1C,0x00,0x03,0x0F,0x1F,0x1F,
0x1F,0x1F,0x1E,0x1E,0x1E,0x1F,0x0F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x03,0x07,
0x0F,0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x1F,0x0F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,
0x00,0x1F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x03,0x07,0x0F,0x1F,0x1F,0x1F,0x1E,
0x1E,0x1E,0x1F,0x1F,0x1F,0x0F,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
#ifdef __cplusplus
}
#endif

View File

@ -27,7 +27,7 @@ EPD_PAINT EPD_Paint;
static uint8_t _hibernating = 1;
static const unsigned char ut_partial[] =
static const unsigned char lut_partial[] =
{
0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x80, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
@ -214,17 +214,36 @@ uint8_t epd_init(void)
epd_write_reg(0x12); // SWRESET
epd_delay(10);
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);
#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
@ -234,24 +253,23 @@ uint8_t epd_init(void)
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(0x4E); // set RAM x address count to 0;
epd_write_data(0x00);
epd_write_reg(0x4F); // set RAM y address count to 0x127;
epd_write_data(0x27);
epd_write_data(0x01);
epd_setpos(0,0);
if (epd_wait_busy())
if (epd_power_on())
return 1;
return 0;
@ -262,25 +280,46 @@ uint8_t epd_init_partial(void)
if (epd_init())
return 1;
#if defined(EPD_29) || defined(EPD_213)
epd_write_reg(0x32);
epd_cs_reset();
for (int j = 0; j < sizeof(ut_partial); j++)
for (int j = 0; j < sizeof(lut_partial); j++)
{
_epd_write_data(ut_partial[j]);
_epd_write_data(lut_partial[j]);
}
_epd_write_data_over();
epd_cs_set();
#endif
return 0;
}
void epd_enter_deepsleepmode(uint8_t mode)
{
epd_power_off();
epd_write_reg(0x10);
epd_write_data(mode);
_hibernating = 1;
}
uint8_t epd_power_on(void)
{
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xf8);
epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy();
}
uint8_t epd_power_off(void)
{
epd_write_reg(0x22); // Display Update Control
epd_write_data(0x83);
epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy();
}
void epd_init_internalTempSensor(void)
{
epd_write_reg(0x18);
@ -294,7 +333,11 @@ void epd_init_internalTempSensor(void)
void epd_update(void)
{
epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xF4);
#else
epd_write_data(0xF7);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
epd_wait_busy();
@ -303,7 +346,11 @@ void epd_update(void)
void epd_update_partial(void)
{
epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xFC);
#else
epd_write_data(0xCC);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
epd_wait_busy();
@ -316,7 +363,11 @@ void epd_setpos(uint16_t x, uint16_t y)
_x = x / 8;
#ifdef EPD_154
_y = 199 - y;
#else
_y = 295 - y;
#endif
epd_write_reg(0x4E); // set RAM x address count to 0;
epd_write_data(_x);
@ -678,10 +729,14 @@ void epd_paint_showString(uint16_t x, uint16_t y, uint8_t *chr, uint16_t size1,
if (size1 == 8)
{
x += 6;
if(x > EPD_H-6)
break;
}
else
{
x += size1 / 2;
if(x > EPD_H-size1 / 2)
break;
}
}
}

View File

@ -10,8 +10,9 @@ extern "C"
//#define EPD_29
//#define EPD_213
//#define EPD_154
#if (!defined EPD_29) && (!defined EPD_213)
#if (!defined EPD_29) && (!defined EPD_213) && (!defined EPD_154)
#error EPD Type Undefine
#endif
@ -25,6 +26,12 @@ extern "C"
#define EPD_H 250
#endif
#ifdef EPD_154
#define EPD_W 200
#define EPD_H 200
#endif
#define EPD_OK 0
#define EPD_ERROR 1
@ -64,9 +71,12 @@ extern "C"
uint8_t epd_init(void);
uint8_t epd_init_partial(void);
void epd_enter_deepsleepmode(uint8_t mode);
uint8_t epd_power_on(void);
uint8_t epd_power_off(void);
void epd_init_internalTempSensor(void);
void epd_update(void);
void epd_update_partial(void);
void epd_setpos(uint16_t x, uint16_t y);
void epd_display(uint8_t *Image1, uint8_t *Image2);
void epd_displayBW(uint8_t *Image);
void epd_displayBW_partial(uint8_t *Image);

View File

@ -220,7 +220,7 @@
<Group>
<GroupName>App</GroupName>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
@ -700,7 +700,7 @@
<Group>
<GroupName>Epaper</GroupName>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>

View File

@ -10,7 +10,7 @@
<TargetName>Target 1</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>6160000::V6.16::ARMCLANG</pCCUsed>
<pCCUsed>6190000::V6.19::ARMCLANG</pCCUsed>
<uAC6>1</uAC6>
<TargetOption>
<TargetCommonOption>
@ -186,6 +186,7 @@
<RvdsVP>0</RvdsVP>
<RvdsMve>0</RvdsMve>
<RvdsCdeCp>0</RvdsCdeCp>
<nBranchProt>0</nBranchProt>
<hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>8</StupSel>

View File

@ -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
@ -88,7 +88,7 @@ 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 *)&"APM32F103CBT6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_RED);
#else
epd_paint_drawRectangle(10, 103, EPD_H - 10, 116, EPD_COLOR_RED, 1);
@ -99,8 +99,14 @@ int main(void)
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
epd_paint_selectimage(image_bw);
#ifdef EPD_154
epd_paint_clear(EPD_COLOR_WHITE);
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);
#endif
epd_displayBW(image_bw);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@ -111,17 +117,25 @@ int main(void)
epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE);
#ifdef EPD_154
epd_paint_showString(10, 0, (uint8_t *)&"1.54 Inch", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 23, (uint8_t *)&"Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 48, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE12x6, EPD_COLOR_BLACK);
epd_paint_showString(10, 60, (uint8_t *)&"with 200 x 200 resolution", EPD_FONT_SIZE12x6, EPD_COLOR_BLACK);
epd_paint_showPicture((EPD_H - 200) / 2,130,200,64,gImage_5,EPD_COLOR_WHITE);
#endif
#ifdef EPD_213
epd_paint_showString(10, 0, (uint8_t *)&"2.13 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 50, (uint8_t *)&"with 250 x 122 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_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
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
#if 0
#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);

View File

@ -528,6 +528,109 @@ const unsigned char gImage_4[4000]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
const unsigned char gImage_5[1600]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xE0,0xE0,0xE0,0xE0,0xC0,0x00,0x00,0x00,0x00,
0x00,0x80,0xE0,0xE0,0xE0,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0xE0,
0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xE0,0xE0,0xF0,0xF0,0xF0,0xF0,
0xF0,0xF0,0xE0,0xE0,0xC0,0xC0,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0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x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x03,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x01,0x00,0x00,0x00,0x00,0x00,0x07,
0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x0F,0x0F,0x1F,
0x1F,0x1E,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,0x0E,0x18,0x1F,0x1F,0x1F,0x1F,0x07,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0F,0x1F,0x1F,0x1F,0x1F,0x18,0x03,0x07,
0x0F,0x0F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,0x0F,0x0E,0x00,0x00,0x03,0x0F,
0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x18,0x00,0x00,0x00,0x00,0x00,0x02,0x07,0x0F,
0x0F,0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,0x0F,0x0F,0x07,0x01,0x00,
0x00,0x01,0x0F,0x1F,0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1C,0x00,0x03,0x0F,0x1F,0x1F,
0x1F,0x1F,0x1E,0x1E,0x1E,0x1F,0x0F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x03,0x07,
0x0F,0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x1F,0x0F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,
0x00,0x1F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x03,0x07,0x0F,0x1F,0x1F,0x1F,0x1E,
0x1E,0x1E,0x1F,0x1F,0x1F,0x0F,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
#ifdef __cplusplus
}
#endif

View File

@ -24,7 +24,7 @@ EPD_PAINT EPD_Paint;
static uint8_t _hibernating = 1;
static const unsigned char ut_partial[] =
static const unsigned char lut_partial[] =
{
0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x80, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
@ -229,17 +229,36 @@ uint8_t epd_init(void)
epd_write_reg(0x12); // SWRESET
epd_delay(10);
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);
#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
@ -249,24 +268,23 @@ uint8_t epd_init(void)
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(0x4E); // set RAM x address count to 0;
epd_write_data(0x00);
epd_write_reg(0x4F); // set RAM y address count to 0x127;
epd_write_data(0x27);
epd_write_data(0x01);
epd_setpos(0,0);
if (epd_wait_busy())
if (epd_power_on())
return 1;
return 0;
@ -277,25 +295,46 @@ uint8_t epd_init_partial(void)
if (epd_init())
return 1;
#if defined(EPD_29) || defined(EPD_213)
epd_write_reg(0x32);
epd_cs_reset();
for (int j = 0; j < sizeof(ut_partial); j++)
for (int j = 0; j < sizeof(lut_partial); j++)
{
_epd_write_data(ut_partial[j]);
_epd_write_data(lut_partial[j]);
}
_epd_write_data_over();
epd_cs_set();
#endif
return 0;
}
void epd_enter_deepsleepmode(uint8_t mode)
{
epd_power_off();
epd_write_reg(0x10);
epd_write_data(mode);
_hibernating = 1;
}
uint8_t epd_power_on(void)
{
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xf8);
epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy();
}
uint8_t epd_power_off(void)
{
epd_write_reg(0x22); // Display Update Control
epd_write_data(0x83);
epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy();
}
void epd_init_internalTempSensor(void)
{
epd_write_reg(0x18);
@ -309,7 +348,11 @@ void epd_init_internalTempSensor(void)
void epd_update(void)
{
epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xF4);
#else
epd_write_data(0xF7);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
epd_wait_busy();
@ -318,7 +361,11 @@ void epd_update(void)
void epd_update_partial(void)
{
epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xFC);
#else
epd_write_data(0xCC);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
epd_wait_busy();
@ -331,7 +378,11 @@ void epd_setpos(uint16_t x, uint16_t y)
_x = x / 8;
#ifdef EPD_154
_y = 199 - y;
#else
_y = 295 - y;
#endif
epd_write_reg(0x4E); // set RAM x address count to 0;
epd_write_data(_x);
@ -693,10 +744,14 @@ void epd_paint_showString(uint16_t x, uint16_t y, uint8_t *chr, uint16_t size1,
if (size1 == 8)
{
x += 6;
if(x > EPD_H-6)
break;
}
else
{
x += size1 / 2;
if(x > EPD_H-size1 / 2)
break;
}
}
}

View File

@ -10,8 +10,9 @@ extern "C"
//#define EPD_29
//#define EPD_213
//#define EPD_154
#if (!defined EPD_29) && (!defined EPD_213)
#if (!defined EPD_29) && (!defined EPD_213) && (!defined EPD_154)
#error EPD Type Undefine
#endif
@ -25,6 +26,12 @@ extern "C"
#define EPD_H 250
#endif
#ifdef EPD_154
#define EPD_W 200
#define EPD_H 200
#endif
#define EPD_OK 0
#define EPD_ERROR 1
@ -64,9 +71,12 @@ extern "C"
uint8_t epd_init(void);
uint8_t epd_init_partial(void);
void epd_enter_deepsleepmode(uint8_t mode);
uint8_t epd_power_on(void);
uint8_t epd_power_off(void);
void epd_init_internalTempSensor(void);
void epd_update(void);
void epd_update_partial(void);
void epd_setpos(uint16_t x, uint16_t y);
void epd_display(uint8_t *Image1, uint8_t *Image2);
void epd_displayBW(uint8_t *Image);
void epd_displayBW_partial(uint8_t *Image);

View File

@ -10,7 +10,7 @@
<TargetName>Target 1</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>6160000::V6.16::ARMCLANG</pCCUsed>
<pCCUsed>6190000::V6.19::ARMCLANG</pCCUsed>
<uAC6>1</uAC6>
<TargetOption>
<TargetCommonOption>
@ -185,6 +185,7 @@
<RvdsVP>2</RvdsVP>
<RvdsMve>0</RvdsMve>
<RvdsCdeCp>0</RvdsCdeCp>
<nBranchProt>0</nBranchProt>
<hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>8</StupSel>

View File

@ -20,7 +20,7 @@
#include <string.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
@ -96,8 +96,14 @@ int main(void)
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
epd_paint_selectimage(image_bw);
#ifdef EPD_154
epd_paint_clear(EPD_COLOR_WHITE);
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);
#endif
epd_displayBW(image_bw);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@ -108,20 +114,28 @@ int main(void)
epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE);
#ifdef EPD_154
epd_paint_showString(10, 0, (uint8_t *)&"1.54 Inch", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 23, (uint8_t *)&"Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 48, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE12x6, EPD_COLOR_BLACK);
epd_paint_showString(10, 60, (uint8_t *)&"with 200 x 200 resolution", EPD_FONT_SIZE12x6, EPD_COLOR_BLACK);
epd_paint_showPicture((EPD_H - 200) / 2,130,200,64,gImage_5,EPD_COLOR_WHITE);
#endif
#ifdef EPD_213
epd_paint_showString(10, 0, (uint8_t *)&"2.13 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 50, (uint8_t *)&"with 250 x 122 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_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
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
#if 0
#if 1
epd_paint_showString(10,100,(uint8_t *)&"AT32F403ACGU7 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");

View File

@ -7,15 +7,18 @@
#include <GxEPD2_3C.h>
#include <Fonts/FreeMonoBold9pt7b.h>
// ESP32 SS=5,SCL(SCK)=18,SDA(MOSI)=23,BUSY=15,RST=2,DC=0
// ESP32 CS(SS)=5,SCL(SCK)=18,SDA(MOSI)=23,BUSY=15,RES(RST)=2,DC=0
// 1.54'' EPD Module
//GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> display(GxEPD2_154_D67(/*CS=5*/ 5, /*DC=*/ 0, /*RES=*/ 2, /*BUSY=*/ 15)); // GDEH0154D67 200x200, SSD1681
// 2.13'' EPD Module
GxEPD2_BW<GxEPD2_213_BN, GxEPD2_213_BN::HEIGHT> display(GxEPD2_213_BN(/*CS=5*/ 5, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 15)); // DEPG0213BN 122x250, SSD1680
//GxEPD2_3C<GxEPD2_213_Z98c, GxEPD2_213_Z98c::HEIGHT> display(GxEPD2_213_Z98c(/*CS=5*/ 5, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 15)); // GDEY0213Z98 122x250, SSD1680
GxEPD2_BW<GxEPD2_213_BN, GxEPD2_213_BN::HEIGHT> display(GxEPD2_213_BN(/*CS=5*/ 5, /*DC=*/ 0, /*RES=*/ 2, /*BUSY=*/ 15)); // DEPG0213BN 122x250, SSD1680
//GxEPD2_3C<GxEPD2_213_Z98c, GxEPD2_213_Z98c::HEIGHT> display(GxEPD2_213_Z98c(/*CS=5*/ 5, /*DC=*/ 0, /*RES=*/ 2, /*BUSY=*/ 15)); // GDEY0213Z98 122x250, SSD1680
// 2.9'' EPD Module
//GxEPD2_BW<GxEPD2_290_BS, GxEPD2_290_BS::HEIGHT> display(GxEPD2_290_BS(/*CS=5*/ 5, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 15)); // DEPG0290BS 128x296, SSD1680
//GxEPD2_3C<GxEPD2_290_C90c, GxEPD2_290_C90c::HEIGHT> display(GxEPD2_290_C90c(/*CS=5*/ 5, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 15)); // GDEM029C90 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
void setup()
{

View File

@ -7,15 +7,18 @@
#include <GxEPD2_3C.h>
#include <Fonts/FreeMonoBold9pt7b.h>
// ESP32-C3 SS=7,SCL(SCK)=4,SDA(MOSI)=6,BUSY=3,RST=2,DC=1
// ESP32-C3 CS(SS)=7,SCL(SCK)=4,SDA(MOSI)=6,BUSY=3,RES(RST)=2,DC=1
// 1.54'' EPD Module
//GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> display(GxEPD2_154_D67(/*CS=5*/ SS, /*DC=*/ 1, /*RES=*/ 2, /*BUSY=*/ 3)); // GDEH0154D67 200x200, SSD1681
// 2.13'' EPD Module
GxEPD2_BW<GxEPD2_213_BN, GxEPD2_213_BN::HEIGHT> display(GxEPD2_213_BN(/*CS=5*/ SS, /*DC=*/ 1, /*RST=*/ 2, /*BUSY=*/ 3)); // DEPG0213BN 122x250, SSD1680
//GxEPD2_3C<GxEPD2_213_Z98c, GxEPD2_213_Z98c::HEIGHT> display(GxEPD2_213_Z98c(/*CS=5*/ SS, /*DC=*/ 1, /*RST=*/ 2, /*BUSY=*/ 3)); // GDEY0213Z98 122x250, SSD1680
GxEPD2_BW<GxEPD2_213_BN, GxEPD2_213_BN::HEIGHT> display(GxEPD2_213_BN(/*CS=5*/ SS, /*DC=*/ 1, /*RES=*/ 2, /*BUSY=*/ 3)); // DEPG0213BN 122x250, SSD1680
//GxEPD2_3C<GxEPD2_213_Z98c, GxEPD2_213_Z98c::HEIGHT> display(GxEPD2_213_Z98c(/*CS=5*/ SS, /*DC=*/ 1, /*RES=*/ 2, /*BUSY=*/ 3)); // GDEY0213Z98 122x250, SSD1680
// 2.9'' EPD Module
//GxEPD2_BW<GxEPD2_290_BS, GxEPD2_290_BS::HEIGHT> display(GxEPD2_290_BS(/*CS=5*/ SS, /*DC=*/ 1, /*RST=*/ 2, /*BUSY=*/ 3)); // DEPG0290BS 128x296, SSD1680
//GxEPD2_3C<GxEPD2_290_C90c, GxEPD2_290_C90c::HEIGHT> display(GxEPD2_290_C90c(/*CS=5*/ SS, /*DC=*/ 1, /*RST=*/ 2, /*BUSY=*/ 3)); // GDEM029C90 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
void setup()
{

View File

@ -7,15 +7,18 @@
#include <GxEPD2_3C.h>
#include <Fonts/FreeMonoBold9pt7b.h>
// ESP8266 SS=15,SCL(SCK)=14,SDA(MOSI)=13,BUSY=16,RST=5,DC=4
// ESP8266 CS(SS)=15,SCL(SCK)=14,SDA(MOSI)=13,BUSY=16,RES(RST)=5,DC=4
// 1.54'' EPD Module
//GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> display(GxEPD2_154_D67(/*CS=5*/ 15, /*DC=*/ 4, /*RES=*/ 5, /*BUSY=*/ 16)); // GDEH0154D67 200x200, SSD1681
// 2.13'' EPD Module
GxEPD2_BW<GxEPD2_213_BN, GxEPD2_213_BN::HEIGHT> display(GxEPD2_213_BN(/*CS=5*/ 15, /*DC=*/ 4, /*RST=*/ 5, /*BUSY=*/ 16)); // DEPG0213BN 122x250, SSD1680
//GxEPD2_3C<GxEPD2_213_Z98c, GxEPD2_213_Z98c::HEIGHT> display(GxEPD2_213_Z98c(/*CS=5*/ 15, /*DC=*/ 4, /*RST=*/ 5, /*BUSY=*/ 16)); // GDEY0213Z98 122x250, SSD1680
GxEPD2_BW<GxEPD2_213_BN, GxEPD2_213_BN::HEIGHT> display(GxEPD2_213_BN(/*CS=5*/ 15, /*DC=*/ 4, /*RES=*/ 5, /*BUSY=*/ 16)); // DEPG0213BN 122x250, SSD1680
//GxEPD2_3C<GxEPD2_213_Z98c, GxEPD2_213_Z98c::HEIGHT> display(GxEPD2_213_Z98c(/*CS=5*/ 15, /*DC=*/ 4, /*RES=*/ 5, /*BUSY=*/ 16)); // GDEY0213Z98 122x250, SSD1680
// 2.9'' EPD Module
//GxEPD2_BW<GxEPD2_290_BS, GxEPD2_290_BS::HEIGHT> display(GxEPD2_290_BS(/*CS=5*/ 15, /*DC=*/ 4, /*RST=*/ 5, /*BUSY=*/ 16)); // DEPG0290BS 128x296, SSD1680
//GxEPD2_3C<GxEPD2_290_C90c, GxEPD2_290_C90c::HEIGHT> display(GxEPD2_290_C90c(/*CS=5*/ 15, /*DC=*/ 4, /*RST=*/ 5, /*BUSY=*/ 16)); // GDEM029C90 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
void setup()
{

View File

@ -528,6 +528,109 @@ const unsigned char gImage_4[4000]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
const unsigned char gImage_5[1600]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xE0,0xE0,0xE0,0xE0,0xC0,0x00,0x00,0x00,0x00,
0x00,0x80,0xE0,0xE0,0xE0,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0xE0,
0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xE0,0xE0,0xF0,0xF0,0xF0,0xF0,
0xF0,0xF0,0xE0,0xE0,0xC0,0xC0,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x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00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x03,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x01,0x00,0x00,0x00,0x00,0x00,0x07,
0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x0F,0x0F,0x1F,
0x1F,0x1E,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,0x0E,0x18,0x1F,0x1F,0x1F,0x1F,0x07,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0F,0x1F,0x1F,0x1F,0x1F,0x18,0x03,0x07,
0x0F,0x0F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,0x0F,0x0E,0x00,0x00,0x03,0x0F,
0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x18,0x00,0x00,0x00,0x00,0x00,0x02,0x07,0x0F,
0x0F,0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,0x0F,0x0F,0x07,0x01,0x00,
0x00,0x01,0x0F,0x1F,0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1C,0x00,0x03,0x0F,0x1F,0x1F,
0x1F,0x1F,0x1E,0x1E,0x1E,0x1F,0x0F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x03,0x07,
0x0F,0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x1F,0x0F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,
0x00,0x1F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x03,0x07,0x0F,0x1F,0x1F,0x1F,0x1E,
0x1E,0x1E,0x1F,0x1F,0x1F,0x0F,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
#ifdef __cplusplus
}
#endif

View File

@ -24,7 +24,7 @@ EPD_PAINT EPD_Paint;
static uint8_t _hibernating = 1;
static const unsigned char ut_partial[] =
static const unsigned char lut_partial[] =
{
0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x80, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
@ -213,17 +213,36 @@ uint8_t epd_init(void)
epd_write_reg(0x12); // SWRESET
epd_delay(10);
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);
#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
@ -233,24 +252,23 @@ uint8_t epd_init(void)
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(0x4E); // set RAM x address count to 0;
epd_write_data(0x00);
epd_write_reg(0x4F); // set RAM y address count to 0x127;
epd_write_data(0x27);
epd_write_data(0x01);
epd_setpos(0,0);
if (epd_wait_busy())
if (epd_power_on())
return 1;
return 0;
@ -261,25 +279,46 @@ uint8_t epd_init_partial(void)
if (epd_init())
return 1;
#if defined(EPD_29) || defined(EPD_213)
epd_write_reg(0x32);
epd_cs_reset();
for (int j = 0; j < sizeof(ut_partial); j++)
for (int j = 0; j < sizeof(lut_partial); j++)
{
_epd_write_data(ut_partial[j]);
_epd_write_data(lut_partial[j]);
}
_epd_write_data_over();
epd_cs_set();
#endif
return 0;
}
void epd_enter_deepsleepmode(uint8_t mode)
{
epd_power_off();
epd_write_reg(0x10);
epd_write_data(mode);
_hibernating = 1;
}
uint8_t epd_power_on(void)
{
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xf8);
epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy();
}
uint8_t epd_power_off(void)
{
epd_write_reg(0x22); // Display Update Control
epd_write_data(0x83);
epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy();
}
void epd_init_internalTempSensor(void)
{
epd_write_reg(0x18);
@ -293,7 +332,11 @@ void epd_init_internalTempSensor(void)
void epd_update(void)
{
epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xF4);
#else
epd_write_data(0xF7);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
epd_wait_busy();
@ -302,7 +345,11 @@ void epd_update(void)
void epd_update_partial(void)
{
epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xFC);
#else
epd_write_data(0xCC);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
epd_wait_busy();
@ -315,7 +362,11 @@ void epd_setpos(uint16_t x, uint16_t y)
_x = x / 8;
#ifdef EPD_154
_y = 199 - y;
#else
_y = 295 - y;
#endif
epd_write_reg(0x4E); // set RAM x address count to 0;
epd_write_data(_x);
@ -677,10 +728,14 @@ void epd_paint_showString(uint16_t x, uint16_t y, uint8_t *chr, uint16_t size1,
if (size1 == 8)
{
x += 6;
if(x > EPD_H-6)
break;
}
else
{
x += size1 / 2;
if(x > EPD_H-size1 / 2)
break;
}
}
}

View File

@ -10,8 +10,9 @@ extern "C"
//#define EPD_29
//#define EPD_213
//#define EPD_154
#if (!defined EPD_29) && (!defined EPD_213)
#if (!defined EPD_29) && (!defined EPD_213) && (!defined EPD_154)
#error EPD Type Undefine
#endif
@ -25,6 +26,12 @@ extern "C"
#define EPD_H 250
#endif
#ifdef EPD_154
#define EPD_W 200
#define EPD_H 200
#endif
#define EPD_OK 0
#define EPD_ERROR 1
@ -64,9 +71,12 @@ extern "C"
uint8_t epd_init(void);
uint8_t epd_init_partial(void);
void epd_enter_deepsleepmode(uint8_t mode);
uint8_t epd_power_on(void);
uint8_t epd_power_off(void);
void epd_init_internalTempSensor(void);
void epd_update(void);
void epd_update_partial(void);
void epd_setpos(uint16_t x, uint16_t y);
void epd_display(uint8_t *Image1, uint8_t *Image2);
void epd_displayBW(uint8_t *Image);
void epd_displayBW_partial(uint8_t *Image);

View File

@ -92,7 +92,7 @@ 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 *)&"CH32F103C8T6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_RED);
#else
epd_paint_drawRectangle(10, 103, EPD_H - 10, 116, EPD_COLOR_RED, 1);
@ -103,8 +103,14 @@ int main(void)
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
epd_paint_selectimage(image_bw);
#ifdef EPD_154
epd_paint_clear(EPD_COLOR_WHITE);
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);
#endif
epd_displayBW(image_bw);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@ -115,17 +121,25 @@ int main(void)
epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE);
#ifdef EPD_154
epd_paint_showString(10, 0, (uint8_t *)&"1.54 Inch", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 23, (uint8_t *)&"Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 48, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE12x6, EPD_COLOR_BLACK);
epd_paint_showString(10, 60, (uint8_t *)&"with 200 x 200 resolution", EPD_FONT_SIZE12x6, EPD_COLOR_BLACK);
epd_paint_showPicture((EPD_H - 200) / 2,130,200,64,gImage_5,EPD_COLOR_WHITE);
#endif
#ifdef EPD_213
epd_paint_showString(10, 0, (uint8_t *)&"2.13 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 50, (uint8_t *)&"with 250 x 122 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_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
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
#if 0
#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);

View File

@ -528,6 +528,109 @@ const unsigned char gImage_4[4000]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
const unsigned char gImage_5[1600]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xE0,0xE0,0xE0,0xE0,0xC0,0x00,0x00,0x00,0x00,
0x00,0x80,0xE0,0xE0,0xE0,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0xE0,
0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xE0,0xE0,0xF0,0xF0,0xF0,0xF0,
0xF0,0xF0,0xE0,0xE0,0xC0,0xC0,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xF8,0xF8,0xF8,0xF8,0xF8,0x00,0x00,0x00,0xF8,0xF8,0xF8,0xF8,0xF8,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,
0xFF,0xFF,0xFF,0xFF,0xF8,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,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,0xFF,0xFF,0x9E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,
0x1F,0x1F,0x00,0xE0,0xFC,0xFF,0xFF,0xFF,0x3F,0x3D,0x3C,0x3C,0x3C,0x3F,0x3F,0xFF,
0xFF,0xFF,0xFC,0xE0,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xC1,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0x81,0x01,0x03,0x03,0x07,0x07,0x0F,
0x0F,0x1F,0xFF,0xFF,0xFF,0xFE,0xF8,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,
0xFF,0xFF,0xFF,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xC3,0x00,0x00,0x00,0x00,0x00,
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0x81,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0xFF,0xFF,
0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x03,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x01,0x00,0x00,0x00,0x00,0x00,0x07,
0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x0F,0x0F,0x1F,
0x1F,0x1E,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,0x0E,0x18,0x1F,0x1F,0x1F,0x1F,0x07,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0F,0x1F,0x1F,0x1F,0x1F,0x18,0x03,0x07,
0x0F,0x0F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,0x0F,0x0E,0x00,0x00,0x03,0x0F,
0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x18,0x00,0x00,0x00,0x00,0x00,0x02,0x07,0x0F,
0x0F,0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,0x0F,0x0F,0x07,0x01,0x00,
0x00,0x01,0x0F,0x1F,0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1C,0x00,0x03,0x0F,0x1F,0x1F,
0x1F,0x1F,0x1E,0x1E,0x1E,0x1F,0x0F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x03,0x07,
0x0F,0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x1F,0x0F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,
0x00,0x1F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x03,0x07,0x0F,0x1F,0x1F,0x1F,0x1E,
0x1E,0x1E,0x1F,0x1F,0x1F,0x0F,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
#ifdef __cplusplus
}
#endif

View File

@ -24,7 +24,7 @@ EPD_PAINT EPD_Paint;
static uint8_t _hibernating = 1;
static const unsigned char ut_partial[] =
static const unsigned char lut_partial[] =
{
0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x80, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
@ -213,17 +213,36 @@ uint8_t epd_init(void)
epd_write_reg(0x12); // SWRESET
epd_delay(10);
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);
#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
@ -233,24 +252,23 @@ uint8_t epd_init(void)
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(0x4E); // set RAM x address count to 0;
epd_write_data(0x00);
epd_write_reg(0x4F); // set RAM y address count to 0x127;
epd_write_data(0x27);
epd_write_data(0x01);
epd_setpos(0,0);
if (epd_wait_busy())
if (epd_power_on())
return 1;
return 0;
@ -261,25 +279,46 @@ uint8_t epd_init_partial(void)
if (epd_init())
return 1;
#if defined(EPD_29) || defined(EPD_213)
epd_write_reg(0x32);
epd_cs_reset();
for (int j = 0; j < sizeof(ut_partial); j++)
for (int j = 0; j < sizeof(lut_partial); j++)
{
_epd_write_data(ut_partial[j]);
_epd_write_data(lut_partial[j]);
}
_epd_write_data_over();
epd_cs_set();
#endif
return 0;
}
void epd_enter_deepsleepmode(uint8_t mode)
{
epd_power_off();
epd_write_reg(0x10);
epd_write_data(mode);
_hibernating = 1;
}
uint8_t epd_power_on(void)
{
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xf8);
epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy();
}
uint8_t epd_power_off(void)
{
epd_write_reg(0x22); // Display Update Control
epd_write_data(0x83);
epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy();
}
void epd_init_internalTempSensor(void)
{
epd_write_reg(0x18);
@ -293,7 +332,11 @@ void epd_init_internalTempSensor(void)
void epd_update(void)
{
epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xF4);
#else
epd_write_data(0xF7);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
epd_wait_busy();
@ -302,7 +345,11 @@ void epd_update(void)
void epd_update_partial(void)
{
epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xFC);
#else
epd_write_data(0xCC);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
epd_wait_busy();
@ -315,7 +362,11 @@ void epd_setpos(uint16_t x, uint16_t y)
_x = x / 8;
#ifdef EPD_154
_y = 199 - y;
#else
_y = 295 - y;
#endif
epd_write_reg(0x4E); // set RAM x address count to 0;
epd_write_data(_x);
@ -677,10 +728,14 @@ void epd_paint_showString(uint16_t x, uint16_t y, uint8_t *chr, uint16_t size1,
if (size1 == 8)
{
x += 6;
if(x > EPD_H-6)
break;
}
else
{
x += size1 / 2;
if(x > EPD_H-size1 / 2)
break;
}
}
}

View File

@ -10,8 +10,9 @@ extern "C"
//#define EPD_29
//#define EPD_213
//#define EPD_154
#if (!defined EPD_29) && (!defined EPD_213)
#if (!defined EPD_29) && (!defined EPD_213) && (!defined EPD_154)
#error EPD Type Undefine
#endif
@ -25,6 +26,12 @@ extern "C"
#define EPD_H 250
#endif
#ifdef EPD_154
#define EPD_W 200
#define EPD_H 200
#endif
#define EPD_OK 0
#define EPD_ERROR 1
@ -64,9 +71,12 @@ extern "C"
uint8_t epd_init(void);
uint8_t epd_init_partial(void);
void epd_enter_deepsleepmode(uint8_t mode);
uint8_t epd_power_on(void);
uint8_t epd_power_off(void);
void epd_init_internalTempSensor(void);
void epd_update(void);
void epd_update_partial(void);
void epd_setpos(uint16_t x, uint16_t y);
void epd_display(uint8_t *Image1, uint8_t *Image2);
void epd_displayBW(uint8_t *Image);
void epd_displayBW_partial(uint8_t *Image);

View File

@ -92,7 +92,7 @@ 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 *)&"CH32V103C8T6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_RED);
#else
epd_paint_drawRectangle(10, 103, EPD_H - 10, 116, EPD_COLOR_RED, 1);
@ -103,8 +103,14 @@ int main(void)
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
epd_paint_selectimage(image_bw);
#ifdef EPD_154
epd_paint_clear(EPD_COLOR_WHITE);
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);
#endif
epd_displayBW(image_bw);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@ -115,17 +121,25 @@ int main(void)
epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE);
#ifdef EPD_154
epd_paint_showString(10, 0, (uint8_t *)&"1.54 Inch", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 23, (uint8_t *)&"Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 48, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE12x6, EPD_COLOR_BLACK);
epd_paint_showString(10, 60, (uint8_t *)&"with 200 x 200 resolution", EPD_FONT_SIZE12x6, EPD_COLOR_BLACK);
epd_paint_showPicture((EPD_H - 200) / 2,130,200,64,gImage_5,EPD_COLOR_WHITE);
#endif
#ifdef EPD_213
epd_paint_showString(10, 0, (uint8_t *)&"2.13 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 50, (uint8_t *)&"with 250 x 122 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_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
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
#if 0
#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);

View File

@ -528,6 +528,109 @@ const unsigned char gImage_4[4000]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
const unsigned char gImage_5[1600]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xE0,0xE0,0xE0,0xE0,0xC0,0x00,0x00,0x00,0x00,
0x00,0x80,0xE0,0xE0,0xE0,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0xE0,
0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xE0,0xE0,0xF0,0xF0,0xF0,0xF0,
0xF0,0xF0,0xE0,0xE0,0xC0,0xC0,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xF8,0xF8,0xF8,0xF8,0xF8,0x00,0x00,0x00,0xF8,0xF8,0xF8,0xF8,0xF8,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,
0xFF,0xFF,0xFF,0xFF,0xF8,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFE,
0xE0,0x00,0x00,0x80,0xFC,0xFF,0xFF,0xFF,0x3F,0x01,0x00,0xC0,0xF0,0xF8,0xF8,0xFC,
0x7C,0x3C,0x3C,0x3C,0x7C,0xFC,0xF8,0xF8,0xF0,0xC0,0x00,0x00,0x00,0x80,0xF0,0xFE,
0xFF,0xFF,0x3F,0x07,0x3F,0xFF,0xFF,0xFE,0xF0,0x80,0x00,0x00,0x00,0x00,0xC0,0xE0,
0xF0,0xF8,0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,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0x81,0x01,0x03,0x03,0x07,0x07,0x0F,
0x0F,0x1F,0xFF,0xFF,0xFF,0xFE,0xF8,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,
0xFF,0xFF,0xFF,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xC3,0x00,0x00,0x00,0x00,0x00,
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0x81,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0xFF,0xFF,
0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x03,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x01,0x00,0x00,0x00,0x00,0x00,0x07,
0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x0F,0x0F,0x1F,
0x1F,0x1E,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,0x0E,0x18,0x1F,0x1F,0x1F,0x1F,0x07,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0F,0x1F,0x1F,0x1F,0x1F,0x18,0x03,0x07,
0x0F,0x0F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,0x0F,0x0E,0x00,0x00,0x03,0x0F,
0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x18,0x00,0x00,0x00,0x00,0x00,0x02,0x07,0x0F,
0x0F,0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,0x0F,0x0F,0x07,0x01,0x00,
0x00,0x01,0x0F,0x1F,0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1C,0x00,0x03,0x0F,0x1F,0x1F,
0x1F,0x1F,0x1E,0x1E,0x1E,0x1F,0x0F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x03,0x07,
0x0F,0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x1F,0x0F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,
0x00,0x1F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x03,0x07,0x0F,0x1F,0x1F,0x1F,0x1E,
0x1E,0x1E,0x1F,0x1F,0x1F,0x0F,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
#ifdef __cplusplus
}
#endif

View File

@ -24,7 +24,7 @@ EPD_PAINT EPD_Paint;
static uint8_t _hibernating = 1;
static const unsigned char ut_partial[] =
static const unsigned char lut_partial[] =
{
0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x80, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
@ -203,17 +203,36 @@ uint8_t epd_init(void)
epd_write_reg(0x12); // SWRESET
epd_delay(10);
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);
#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
@ -223,24 +242,23 @@ uint8_t epd_init(void)
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(0x4E); // set RAM x address count to 0;
epd_write_data(0x00);
epd_write_reg(0x4F); // set RAM y address count to 0x127;
epd_write_data(0x27);
epd_write_data(0x01);
epd_setpos(0,0);
if (epd_wait_busy())
if (epd_power_on())
return 1;
return 0;
@ -251,25 +269,46 @@ uint8_t epd_init_partial(void)
if (epd_init())
return 1;
#if defined(EPD_29) || defined(EPD_213)
epd_write_reg(0x32);
epd_cs_reset();
for (int j = 0; j < sizeof(ut_partial); j++)
for (int j = 0; j < sizeof(lut_partial); j++)
{
_epd_write_data(ut_partial[j]);
_epd_write_data(lut_partial[j]);
}
_epd_write_data_over();
epd_cs_set();
#endif
return 0;
}
void epd_enter_deepsleepmode(uint8_t mode)
{
epd_power_off();
epd_write_reg(0x10);
epd_write_data(mode);
_hibernating = 1;
}
uint8_t epd_power_on(void)
{
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xf8);
epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy();
}
uint8_t epd_power_off(void)
{
epd_write_reg(0x22); // Display Update Control
epd_write_data(0x83);
epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy();
}
void epd_init_internalTempSensor(void)
{
epd_write_reg(0x18);
@ -283,7 +322,11 @@ void epd_init_internalTempSensor(void)
void epd_update(void)
{
epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xF4);
#else
epd_write_data(0xF7);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
epd_wait_busy();
@ -292,7 +335,11 @@ void epd_update(void)
void epd_update_partial(void)
{
epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xFC);
#else
epd_write_data(0xCC);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
epd_wait_busy();
@ -305,7 +352,11 @@ void epd_setpos(uint16_t x, uint16_t y)
_x = x / 8;
#ifdef EPD_154
_y = 199 - y;
#else
_y = 295 - y;
#endif
epd_write_reg(0x4E); // set RAM x address count to 0;
epd_write_data(_x);
@ -667,10 +718,14 @@ void epd_paint_showString(uint16_t x, uint16_t y, uint8_t *chr, uint16_t size1,
if (size1 == 8)
{
x += 6;
if(x > EPD_H-6)
break;
}
else
{
x += size1 / 2;
if(x > EPD_H-size1 / 2)
break;
}
}
}

View File

@ -10,8 +10,9 @@ extern "C"
//#define EPD_29
//#define EPD_213
//#define EPD_154
#if (!defined EPD_29) && (!defined EPD_213)
#if (!defined EPD_29) && (!defined EPD_213) && (!defined EPD_154)
#error EPD Type Undefine
#endif
@ -25,6 +26,12 @@ extern "C"
#define EPD_H 250
#endif
#ifdef EPD_154
#define EPD_W 200
#define EPD_H 200
#endif
#define EPD_OK 0
#define EPD_ERROR 1
@ -64,9 +71,12 @@ extern "C"
uint8_t epd_init(void);
uint8_t epd_init_partial(void);
void epd_enter_deepsleepmode(uint8_t mode);
uint8_t epd_power_on(void);
uint8_t epd_power_off(void);
void epd_init_internalTempSensor(void);
void epd_update(void);
void epd_update_partial(void);
void epd_setpos(uint16_t x, uint16_t y);
void epd_display(uint8_t *Image1, uint8_t *Image2);
void epd_displayBW(uint8_t *Image);
void epd_displayBW_partial(uint8_t *Image);

View File

@ -103,8 +103,14 @@ int main(void)
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
epd_paint_selectimage(image_bw);
#ifdef EPD_154
epd_paint_clear(EPD_COLOR_WHITE);
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);
#endif
epd_displayBW(image_bw);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@ -115,17 +121,25 @@ int main(void)
epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE);
#ifdef EPD_154
epd_paint_showString(10, 0, (uint8_t *)&"1.54 Inch", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 23, (uint8_t *)&"Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 48, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE12x6, EPD_COLOR_BLACK);
epd_paint_showString(10, 60, (uint8_t *)&"with 200 x 200 resolution", EPD_FONT_SIZE12x6, EPD_COLOR_BLACK);
epd_paint_showPicture((EPD_H - 200) / 2,130,200,64,gImage_5,EPD_COLOR_WHITE);
#endif
#ifdef EPD_213
epd_paint_showString(10, 0, (uint8_t *)&"2.13 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 50, (uint8_t *)&"with 250 x 122 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_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
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
#if 0
#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);

View File

@ -528,6 +528,109 @@ const unsigned char gImage_4[4000]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
const unsigned char gImage_5[1600]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xE0,0xE0,0xE0,0xE0,0xC0,0x00,0x00,0x00,0x00,
0x00,0x80,0xE0,0xE0,0xE0,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0xE0,
0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xE0,0xE0,0xF0,0xF0,0xF0,0xF0,
0xF0,0xF0,0xE0,0xE0,0xC0,0xC0,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x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x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x03,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x01,0x00,0x00,0x00,0x00,0x00,0x07,
0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x0F,0x0F,0x1F,
0x1F,0x1E,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,0x0E,0x18,0x1F,0x1F,0x1F,0x1F,0x07,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0F,0x1F,0x1F,0x1F,0x1F,0x18,0x03,0x07,
0x0F,0x0F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,0x0F,0x0E,0x00,0x00,0x03,0x0F,
0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x18,0x00,0x00,0x00,0x00,0x00,0x02,0x07,0x0F,
0x0F,0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x1E,0x1F,0x1F,0x0F,0x0F,0x07,0x01,0x00,
0x00,0x01,0x0F,0x1F,0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1C,0x00,0x03,0x0F,0x1F,0x1F,
0x1F,0x1F,0x1E,0x1E,0x1E,0x1F,0x0F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x03,0x07,
0x0F,0x1F,0x1F,0x1F,0x1E,0x1E,0x1E,0x1E,0x1F,0x0F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,
0x00,0x1F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x03,0x07,0x0F,0x1F,0x1F,0x1F,0x1E,
0x1E,0x1E,0x1F,0x1F,0x1F,0x0F,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
#ifdef __cplusplus
}
#endif

View File

@ -24,7 +24,7 @@ EPD_PAINT EPD_Paint;
static uint8_t _hibernating = 1;
static const unsigned char ut_partial[] =
static const unsigned char lut_partial[] =
{
0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x80, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
@ -203,17 +203,36 @@ uint8_t epd_init(void)
epd_write_reg(0x12); // SWRESET
epd_delay(10);
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);
#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
@ -223,24 +242,23 @@ uint8_t epd_init(void)
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(0x4E); // set RAM x address count to 0;
epd_write_data(0x00);
epd_write_reg(0x4F); // set RAM y address count to 0x127;
epd_write_data(0x27);
epd_write_data(0x01);
epd_setpos(0,0);
if (epd_wait_busy())
if (epd_power_on())
return 1;
return 0;
@ -251,25 +269,46 @@ uint8_t epd_init_partial(void)
if (epd_init())
return 1;
#if defined(EPD_29) || defined(EPD_213)
epd_write_reg(0x32);
epd_cs_reset();
for (int j = 0; j < sizeof(ut_partial); j++)
for (int j = 0; j < sizeof(lut_partial); j++)
{
_epd_write_data(ut_partial[j]);
_epd_write_data(lut_partial[j]);
}
_epd_write_data_over();
epd_cs_set();
#endif
return 0;
}
void epd_enter_deepsleepmode(uint8_t mode)
{
epd_power_off();
epd_write_reg(0x10);
epd_write_data(mode);
_hibernating = 1;
}
uint8_t epd_power_on(void)
{
epd_write_reg(0x22); // Display Update Control
epd_write_data(0xf8);
epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy();
}
uint8_t epd_power_off(void)
{
epd_write_reg(0x22); // Display Update Control
epd_write_data(0x83);
epd_write_reg(0x20); // Activate Display Update Sequence
return epd_wait_busy();
}
void epd_init_internalTempSensor(void)
{
epd_write_reg(0x18);
@ -283,7 +322,11 @@ void epd_init_internalTempSensor(void)
void epd_update(void)
{
epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xF4);
#else
epd_write_data(0xF7);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
epd_wait_busy();
@ -292,7 +335,11 @@ void epd_update(void)
void epd_update_partial(void)
{
epd_write_reg(0x22); // Display Update Control
#ifdef EPD_154
epd_write_data(0xFC);
#else
epd_write_data(0xCC);
#endif
epd_write_reg(0x20); // Activate Display Update Sequence
epd_wait_busy();
@ -305,7 +352,11 @@ void epd_setpos(uint16_t x, uint16_t y)
_x = x / 8;
#ifdef EPD_154
_y = 199 - y;
#else
_y = 295 - y;
#endif
epd_write_reg(0x4E); // set RAM x address count to 0;
epd_write_data(_x);
@ -667,10 +718,14 @@ void epd_paint_showString(uint16_t x, uint16_t y, uint8_t *chr, uint16_t size1,
if (size1 == 8)
{
x += 6;
if(x > EPD_H-6)
break;
}
else
{
x += size1 / 2;
if(x > EPD_H-size1 / 2)
break;
}
}
}

View File

@ -10,8 +10,9 @@ extern "C"
//#define EPD_29
//#define EPD_213
//#define EPD_154
#if (!defined EPD_29) && (!defined EPD_213)
#if (!defined EPD_29) && (!defined EPD_213) && (!defined EPD_154)
#error EPD Type Undefine
#endif
@ -25,6 +26,12 @@ extern "C"
#define EPD_H 250
#endif
#ifdef EPD_154
#define EPD_W 200
#define EPD_H 200
#endif
#define EPD_OK 0
#define EPD_ERROR 1
@ -64,9 +71,12 @@ extern "C"
uint8_t epd_init(void);
uint8_t epd_init_partial(void);
void epd_enter_deepsleepmode(uint8_t mode);
uint8_t epd_power_on(void);
uint8_t epd_power_off(void);
void epd_init_internalTempSensor(void);
void epd_update(void);
void epd_update_partial(void);
void epd_setpos(uint16_t x, uint16_t y);
void epd_display(uint8_t *Image1, uint8_t *Image2);
void epd_displayBW(uint8_t *Image);
void epd_displayBW_partial(uint8_t *Image);

View File

@ -118,7 +118,7 @@ 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 *)&"GD32F303CCT6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_RED);
#else
epd_paint_drawRectangle(10, 103, EPD_H - 10, 116, EPD_COLOR_RED, 1);
@ -129,8 +129,14 @@ int main(void)
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
epd_paint_selectimage(image_bw);
#ifdef EPD_154
epd_paint_clear(EPD_COLOR_WHITE);
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);
#endif
epd_displayBW(image_bw);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@ -141,17 +147,25 @@ int main(void)
epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE);
#ifdef EPD_154
epd_paint_showString(10, 0, (uint8_t *)&"1.54 Inch", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 23, (uint8_t *)&"Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 48, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE12x6, EPD_COLOR_BLACK);
epd_paint_showString(10, 60, (uint8_t *)&"with 200 x 200 resolution", EPD_FONT_SIZE12x6, EPD_COLOR_BLACK);
epd_paint_showPicture((EPD_H - 200) / 2,130,200,64,gImage_5,EPD_COLOR_WHITE);
#endif
#ifdef EPD_213
epd_paint_showString(10, 0, (uint8_t *)&"2.13 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 50, (uint8_t *)&"with 250 x 122 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_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
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
#if 0
#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);