add function to dump LUT

This commit is contained in:
Shuanglei Tao
2025-06-01 20:57:09 +08:00
parent 986bb49f8e
commit 95b1aaa99c
3 changed files with 39 additions and 0 deletions

View File

@@ -94,6 +94,22 @@ static void _setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
EPD_Write(CMD_RAM_YCOUNT, y % 256, y / 256);
}
void SSD1619_Dump_LUT(void)
{
uint8_t lut[128];
// Load LUT
SSD1619_Update(0xB1);
SSD1619_WaitBusy(200);
EPD_WriteCmd(CMD_READ_LUT);
EPD_ReadData(lut, sizeof(lut));
NRF_LOG_DEBUG("=== LUT BEGIN ===\n");
NRF_LOG_HEXDUMP_DEBUG(lut, sizeof(lut));
NRF_LOG_DEBUG("=== LUT END ===\n");
}
void SSD1619_Init()
{
epd_model_t *EPD = epd_get();
@@ -106,6 +122,8 @@ void SSD1619_Init()
EPD_Write(CMD_BORDER_CTRL, 0x01);
EPD_Write(CMD_TSENSOR_CTRL, 0x80);
// SSD1619_Dump_LUT();
_setPartialRamArea(0, 0, EPD->width, EPD->height);
}

View File

@@ -109,6 +109,7 @@ void UC8176_Refresh(void)
{
NRF_LOG_DEBUG("[EPD]: refresh begin\n");
UC8176_PowerOn();
NRF_LOG_DEBUG("[EPD]: temperature: %d\n", UC8176_Read_Temp());
EPD_WriteCmd(CMD_DRF);
delay(100);
@@ -131,11 +132,30 @@ static void _setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
0x01);
}
void UC8176_Dump_OTP(void)
{
uint8_t data[128];
UC8176_PowerOn();
EPD_Write(CMD_ROTP, 0x00);
NRF_LOG_DEBUG("=== OTP BEGIN ===\n");
for (int i = 0; i < 0xFFF; i += sizeof(data)) {
EPD_ReadData(data, sizeof(data));
NRF_LOG_HEXDUMP_DEBUG(data, sizeof(data));
}
NRF_LOG_DEBUG("=== OTP END ===\n");
UC8176_PowerOff();
}
void UC8176_Init()
{
epd_model_t *EPD = epd_get();
EPD_Reset(HIGH, 10);
// UC8176_Dump_OTP();
EPD_Write(CMD_PSR, EPD->bwr ? 0x0F : 0x1F);
EPD_Write(CMD_CDI, EPD->bwr ? 0x77 : 0x97);

1
main.c
View File

@@ -757,6 +757,7 @@ int main(void)
// Save reset reason.
m_resetreas = NRF_POWER->RESETREAS;
NRF_POWER->RESETREAS |= NRF_POWER->RESETREAS;
NRF_LOG_DEBUG("== RESET REASON: %d ===\n", m_resetreas);
NRF_LOG_DEBUG("init..\n");