mirror of
https://github.com/jam422470459/EPD-nRF52-hema213.git
synced 2025-12-06 16:42:49 +08:00
inverse red ram with register
This commit is contained in:
@@ -319,14 +319,12 @@ extern epd_model_t epd_uc8176_420_bw;
|
||||
extern epd_model_t epd_uc8176_420_bwr;
|
||||
extern epd_model_t epd_ssd1619_420_bwr;
|
||||
extern epd_model_t epd_ssd1619_420_bw;
|
||||
extern epd_model_t epd_uc8276_420_bwr;
|
||||
|
||||
static epd_model_t *epd_models[] = {
|
||||
&epd_uc8176_420_bw,
|
||||
&epd_uc8176_420_bwr,
|
||||
&epd_ssd1619_420_bwr,
|
||||
&epd_ssd1619_420_bw,
|
||||
&epd_uc8276_420_bwr,
|
||||
};
|
||||
|
||||
// EPD model
|
||||
|
||||
@@ -45,7 +45,6 @@ typedef enum
|
||||
EPD_UC8176_420_BWR = 3,
|
||||
EPD_SSD1619_420_BWR = 2,
|
||||
EPD_SSD1619_420_BW = 4,
|
||||
EPD_UC8276_420_BWR = 5,
|
||||
} epd_model_id_t;
|
||||
|
||||
typedef struct
|
||||
@@ -55,7 +54,6 @@ typedef struct
|
||||
uint16_t width;
|
||||
uint16_t height;
|
||||
bool bwr;
|
||||
bool invert_color;
|
||||
} epd_model_t;
|
||||
|
||||
#define LOW (0x0)
|
||||
|
||||
@@ -104,6 +104,10 @@ static void SSD1619_Refresh(void)
|
||||
{
|
||||
epd_model_t *EPD = epd_get();
|
||||
|
||||
EPD_WriteCommand(CMD_DISP_CTRL1);
|
||||
EPD_WriteByte(0x80); // Inverse RED RAM
|
||||
EPD_WriteByte(0x00); // Single chip application
|
||||
|
||||
NRF_LOG_DEBUG("[EPD]: refresh begin\n");
|
||||
NRF_LOG_DEBUG("[EPD]: temperature: %d\n", SSD1619_Read_Temp());
|
||||
SSD1619_Update(0xF7);
|
||||
@@ -130,7 +134,7 @@ void SSD1619_Clear(void)
|
||||
EPD_WriteCommand(CMD_WRITE_RAM2);
|
||||
for (uint16_t j = 0; j < Height; j++) {
|
||||
for (uint16_t i = 0; i < Width; i++) {
|
||||
EPD_WriteByte(EPD->invert_color ? 0x00 : 0xFF);
|
||||
EPD_WriteByte(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,8 +160,7 @@ void SSD1619_Write_Image(uint8_t *black, uint8_t *color, uint16_t x, uint16_t y,
|
||||
for (uint16_t i = 0; i < h; i++) {
|
||||
for (uint16_t j = 0; j < w / 8; j++) {
|
||||
if (EPD->bwr) {
|
||||
uint8_t data = color ? color[j + i * wb] : 0xFF;
|
||||
EPD_WriteByte(EPD->invert_color ? ~data : data);
|
||||
EPD_WriteByte(color ? color[j + i * wb] : 0xFF);
|
||||
} else {
|
||||
EPD_WriteByte(black[j + i * wb]);
|
||||
}
|
||||
@@ -189,7 +192,6 @@ const epd_model_t epd_ssd1619_420_bwr = {
|
||||
.width = 400,
|
||||
.height = 300,
|
||||
.bwr = true,
|
||||
.invert_color = true,
|
||||
};
|
||||
|
||||
// SSD1619 400x300 Black/White
|
||||
@@ -199,5 +201,4 @@ const epd_model_t epd_ssd1619_420_bw = {
|
||||
.width = 400,
|
||||
.height = 300,
|
||||
.bwr = false,
|
||||
.invert_color = false,
|
||||
};
|
||||
|
||||
24
EPD/UC8176.c
24
EPD/UC8176.c
@@ -131,10 +131,8 @@ void UC8176_Init()
|
||||
EPD_WriteCommand(CMD_PSR);
|
||||
EPD_WriteByte(psr);
|
||||
|
||||
if (!EPD->bwr) {
|
||||
EPD_WriteCommand(CMD_CDI);
|
||||
EPD_WriteByte(0x97);
|
||||
}
|
||||
EPD_WriteCommand(CMD_CDI);
|
||||
EPD_WriteByte(EPD->bwr ? 0x77 : 0x97);
|
||||
}
|
||||
|
||||
static void UC8176_Write_RAM(uint8_t cmd, uint8_t value)
|
||||
@@ -157,9 +155,8 @@ parameter:
|
||||
******************************************************************************/
|
||||
void UC8176_Clear(void)
|
||||
{
|
||||
epd_model_t *EPD = epd_get();
|
||||
UC8176_Write_RAM(CMD_DTM1, 0xFF);
|
||||
UC8176_Write_RAM(CMD_DTM2, EPD->invert_color ? 0x00 : 0xFF);
|
||||
UC8176_Write_RAM(CMD_DTM2, 0xFF);
|
||||
UC8176_Refresh();
|
||||
}
|
||||
|
||||
@@ -203,8 +200,7 @@ void UC8176_Write_Image(uint8_t *black, uint8_t *color, uint16_t x, uint16_t y,
|
||||
for (uint16_t i = 0; i < h; i++) {
|
||||
for (uint16_t j = 0; j < w / 8; j++) {
|
||||
if (EPD->bwr) {
|
||||
uint8_t data = color ? color[j + i * wb] : 0xFF;
|
||||
EPD_WriteByte(EPD->invert_color ? ~data : data);
|
||||
EPD_WriteByte(color ? color[j + i * wb] : 0xFF);
|
||||
} else {
|
||||
EPD_WriteByte(black[j + i * wb]);
|
||||
}
|
||||
@@ -243,7 +239,6 @@ const epd_model_t epd_uc8176_420_bw = {
|
||||
.width = 400,
|
||||
.height = 300,
|
||||
.bwr = false,
|
||||
.invert_color = false,
|
||||
};
|
||||
|
||||
// UC8176 400x300 Black/White/Red
|
||||
@@ -253,15 +248,4 @@ const epd_model_t epd_uc8176_420_bwr = {
|
||||
.width = 400,
|
||||
.height = 300,
|
||||
.bwr = true,
|
||||
.invert_color = false,
|
||||
};
|
||||
|
||||
// UC8276 400x300 Black/White/Red
|
||||
const epd_model_t epd_uc8276_420_bwr = {
|
||||
.id = EPD_UC8276_420_BWR,
|
||||
.drv = &epd_drv_uc8176,
|
||||
.width = 400,
|
||||
.height = 300,
|
||||
.bwr = true,
|
||||
.invert_color = true,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user