diff --git a/EPD/SSD1619.c b/EPD/SSD1619.c index cad9d9a..6a56655 100644 --- a/EPD/SSD1619.c +++ b/EPD/SSD1619.c @@ -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); } diff --git a/EPD/UC8176.c b/EPD/UC8176.c index af68bf9..49865cb 100644 --- a/EPD/UC8176.c +++ b/EPD/UC8176.c @@ -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); diff --git a/main.c b/main.c index 5c44249..bdb2d8a 100644 --- a/main.c +++ b/main.c @@ -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");