From f1010ad3cc5ff17815c2a76ff7afdaefda2bf79d Mon Sep 17 00:00:00 2001 From: jjwbruijn Date: Sat, 20 Apr 2024 21:02:48 +0200 Subject: [PATCH] Added support for Newton M3 4.2 Yellow #273 --- .../hal/Newton_M3_nRF52811/HAL_Newton_M3.h | 2 +- .../hal/Newton_M3_nRF52811/tagtype_db.cpp | 21 +++++++++++++------ .../src/epd_driver/dualssd.cpp | 4 ++-- .../src/epd_driver/unissd.cpp | 4 ++-- .../Newton_M3_nRF52811/src/userinterface.cpp | 8 +++---- resources/tagtypes/3C.json | 18 ++++++++++++++++ 6 files changed, 42 insertions(+), 15 deletions(-) create mode 100644 resources/tagtypes/3C.json diff --git a/ARM_Tag_FW/Newton_M3_nRF52811/hal/Newton_M3_nRF52811/HAL_Newton_M3.h b/ARM_Tag_FW/Newton_M3_nRF52811/hal/Newton_M3_nRF52811/HAL_Newton_M3.h index 24439241..7cc6f579 100644 --- a/ARM_Tag_FW/Newton_M3_nRF52811/hal/Newton_M3_nRF52811/HAL_Newton_M3.h +++ b/ARM_Tag_FW/Newton_M3_nRF52811/hal/Newton_M3_nRF52811/HAL_Newton_M3.h @@ -110,7 +110,7 @@ struct tagSpecs { bool hasNFC = false; bool hasLED = false; bool ledInverted = false; - bool hasThirdColor = false; + uint8_t thirdColor = false; uint8_t boardType = NRF_BOARDTYPE_REGULAR; uint16_t macSuffix = 0x0000; uint8_t OEPLtype = 0; diff --git a/ARM_Tag_FW/Newton_M3_nRF52811/hal/Newton_M3_nRF52811/tagtype_db.cpp b/ARM_Tag_FW/Newton_M3_nRF52811/hal/Newton_M3_nRF52811/tagtype_db.cpp index 83949a04..914822de 100644 --- a/ARM_Tag_FW/Newton_M3_nRF52811/hal/Newton_M3_nRF52811/tagtype_db.cpp +++ b/ARM_Tag_FW/Newton_M3_nRF52811/hal/Newton_M3_nRF52811/tagtype_db.cpp @@ -34,6 +34,7 @@ void identifyTagInfo() { 0B 81 08 04 14 09 0F 04 00 0D 01 80 01 A8 00 38 00 07 81 9D 00 00 42 FF FF FF FF FF FF FF FF FF 2.9 UC8151 26 36 42 7E 16 03 14 04 00 15 01 80 01 A8 00 38 00 07 01 9C 00 00 42 FF FF FF FF FF FF FF FF FF 2.9 Lite (SSD) (no buttons) F1 D5 B2 05 15 0A 04 04 00 12 01 90 01 2C 01 04 00 07 01 9C 00 00 46 FF FF FF FF FF FF FF FF FF 4.2 SSD + 79 19 1C 06 16 01 05 04 00 12 02 90 01 2C 01 04 00 07 81 9D 00 00 46 FF FF FF FF FF FF FF FF FF 4.2 SSD Yellow CA FE BA DE 15 0B 12 04 00 10 01 E0 01 20 03 39 00 03 81 9D 00 00 4C FF FF FF FF FF FF FF FF FF 7.4 UC8179 F3 22 BC 05 15 0A 0D 04 00 19 01 A0 02 C0 03 38 07 07 01 80 00 00 64 FF FF FF FF FF FF FF FF FF 9.7 SSD AD BA FE CA 15 0A 1B 04 00 19 01 A0 02 C0 03 38 07 07 01 80 00 00 64 FF FF FF FF FF FF FF FF FF 9.7 type 2 @@ -76,10 +77,7 @@ void identifyTagInfo() { capabilities[0] = getUICRByte(0x12); capabilities[1] = getUICRByte(0x13); tag.solumType = getUICRByte(0x16); - - if (getUICRByte(0x0A) == 0x01) { - tag.hasThirdColor = true; - } + tag.thirdColor = getUICRByte(0x0A); switch (controllerType) { case 0x0A: @@ -142,7 +140,7 @@ void identifyTagInfo() { } else { printf("This tag have NFC: No\n"); } - if (tag.hasThirdColor) { + if (tag.thirdColor) { printf("This tag is Black and white only: No\n"); } else { printf("This tag is Black and white only: Yes\n"); @@ -197,8 +195,19 @@ void identifyTagInfo() { epd->XOffset = 8; break; case STYPE_SIZE_042: + switch (tag.thirdColor) { + case 0x01: + tag.macSuffix = 0xB6D0; + tag.OEPLtype = SOLUM_M3_BWR_42; + break; + case 0x02: + tag.macSuffix = 0xC690; + tag.OEPLtype = SOLUM_M3_BWY_42; + break; + } tag.macSuffix = 0xB6D0; tag.OEPLtype = SOLUM_M3_BWR_42; + epd->epdMirrorV = true; break; case STYPE_SIZE_043: @@ -233,7 +242,7 @@ void identifyTagInfo() { tag.OEPLtype = SOLUM_M3_BWR_97; break; case STYPE_SIZE_013: - //epdXRes -= 1; + // epdXRes -= 1; tag.ledInverted = true; tag.macSuffix = 0xBDB0; epd->drawDirectionRight = true; diff --git a/ARM_Tag_FW/Newton_M3_nRF52811/src/epd_driver/dualssd.cpp b/ARM_Tag_FW/Newton_M3_nRF52811/src/epd_driver/dualssd.cpp index 48fe6a74..6175e027 100644 --- a/ARM_Tag_FW/Newton_M3_nRF52811/src/epd_driver/dualssd.cpp +++ b/ARM_Tag_FW/Newton_M3_nRF52811/src/epd_driver/dualssd.cpp @@ -102,7 +102,7 @@ void dualssd::epdSetup() { epdWrite(CMD_DATA_ENTRY_MODE + CONTROLLER_ONE, 1, 0x02); epdWrite(CMD_DATA_ENTRY_MODE + CONTROLLER_TWO, 1, 0x03); - if (tag.hasThirdColor) { + if (tag.thirdColor) { epdWrite(CMD_DISP_UPDATE_CTRL, 2, 0x08, 0x10); } else { epdWrite(CMD_DISP_UPDATE_CTRL, 2, 0x48, 0x10); @@ -127,7 +127,7 @@ void dualssd::epdWriteDisplayData() { uint8_t *buf[2] = {0, 0}; // this will hold pointers to odd/even data lines // Those dual SSD controller (SSD1683??) behave as 2 400pxx wide screens, that needs independent data transfers. uint8_t c_increment = 1; - if (!tag.hasThirdColor) { + if (!tag.thirdColor) { c_increment = 2; } for (uint8_t c = 0; c < 4; c = c + c_increment) { diff --git a/ARM_Tag_FW/Newton_M3_nRF52811/src/epd_driver/unissd.cpp b/ARM_Tag_FW/Newton_M3_nRF52811/src/epd_driver/unissd.cpp index 7f96c3e4..af846b3c 100644 --- a/ARM_Tag_FW/Newton_M3_nRF52811/src/epd_driver/unissd.cpp +++ b/ARM_Tag_FW/Newton_M3_nRF52811/src/epd_driver/unissd.cpp @@ -87,7 +87,7 @@ void unissd::epdSetup() { epdWrite(CMD_TEMP_SENSOR_CONTROL, 1, 0x80); // end stock init // added - if (tag.hasThirdColor) { + if (tag.thirdColor) { epdWrite(CMD_DISP_UPDATE_CTRL, 2, 0x08, 0x00); // fix reversed image with stock setup } else { epdWrite(CMD_DISP_UPDATE_CTRL, 2, 0x48, 0x00); // fix reversed image with stock setup @@ -118,7 +118,7 @@ void unissd::epdWriteDisplayData() { // this display expects two entire framebuffers worth of data to be written, one for b/w and one for red uint8_t *buf[2] = {0, 0}; // this will hold pointers to odd/even data lines uint8_t c_end = 2; // The loop must be executed 2 times if BWR, 1 time if BW - if (!tag.hasThirdColor) { + if (!tag.thirdColor) { c_end = 1; } for (uint8_t c = 0; c < c_end; c++) { diff --git a/ARM_Tag_FW/Newton_M3_nRF52811/src/userinterface.cpp b/ARM_Tag_FW/Newton_M3_nRF52811/src/userinterface.cpp index aca6fa72..d9a2883b 100644 --- a/ARM_Tag_FW/Newton_M3_nRF52811/src/userinterface.cpp +++ b/ARM_Tag_FW/Newton_M3_nRF52811/src/userinterface.cpp @@ -28,7 +28,7 @@ bool noAPShown = false; void addOverlay() { if (currentChannel == 0) { drawMask(epd->Xres - 28, 4, 24, 24, COLOR_BLACK); - if (tag.hasThirdColor) { + if (tag.thirdColor) { drawMask(epd->Xres - 28, 4, 24, 24, COLOR_RED); drawRoundedRectangle(epd->Xres - 28, 4, 24, 24, COLOR_RED); addBufferedImage(epd->Xres - 24, 8, COLOR_BLACK, rotation::ROTATE_0, ant, DRAW_NORMAL); @@ -45,7 +45,7 @@ void addOverlay() { if (lowBattery) { drawMask(epd->Xres - 27, epd->Yres - 26, 22, 22, COLOR_BLACK); - if (tag.hasThirdColor) { + if (tag.thirdColor) { drawMask(epd->Xres - 27, epd->Yres - 26, 22, 22, COLOR_RED); drawRoundedRectangle(epd->Xres - 28, epd->Yres - 26, 24, 24, COLOR_RED); } else { @@ -60,7 +60,7 @@ void addOverlay() { #ifdef DEBUG_BUILD fontrender fr(&FreeSansBold18pt7b); drawMask(15, epd->Yres - 53, 130, 33, COLOR_BLACK); - if (tag.hasThirdColor) { + if (tag.thirdColor) { drawMask(15, epd->Yres - 53, 130, 33, COLOR_RED); drawRoundedRectangle(15, epd->Yres - 53, 129, 33, COLOR_RED); fr.epdPrintf(17, epd->Yres - 50, COLOR_RED, rotation::ROTATE_0, "DEBUG"); @@ -209,7 +209,7 @@ void showSplashScreen() { } #ifdef DEBUG_BUILD drawMask(15, epd->Yres - 53, 129, 33, COLOR_BLACK); - if (tag.hasThirdColor) { + if (tag.thirdColor) { drawMask(15, epd->Yres - 53, 129, 33, COLOR_RED); drawRoundedRectangle(15, epd->Yres - 53, 129, 33, COLOR_RED); fr.setFont(&FreeSansBold18pt7b); diff --git a/resources/tagtypes/3C.json b/resources/tagtypes/3C.json new file mode 100644 index 00000000..834c51ee --- /dev/null +++ b/resources/tagtypes/3C.json @@ -0,0 +1,18 @@ +{ + "version": 1, + "name": "M3 4.2 BWY\"", + "width": 400, + "height": 300, + "rotatebuffer": 0, + "bpp": 2, + "colortable": { + "white": [ 255, 255, 255 ], + "black": [ 0, 0, 0 ], + "yellow": [ 255, 255, 0 ] + }, + "shortlut": 0, + "zlib_compression": "27", + "options": [ "button", "led" ], + "contentids": [ 22, 23, 1, 4, 5, 7, 8, 9, 10, 11, 17, 18, 19, 20 ], + "usetemplate": 2 +} \ No newline at end of file