diff --git a/library.properties b/library.properties index 7b7fdbe..83a9005 100755 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=PDLS_EXT3_Basic_BWRY -version=8.0.1 +version=8.0.3 author=Rei Vilo for Pervasive Displays maintainer=Rei Vilo sentence=Library for Pervasive Displays iTC red and yellow colour screens and EXT3-1 board diff --git a/src/Screen_EPD_EXT3.cpp b/src/Screen_EPD_EXT3.cpp index 0f6dccf..dd009dd 100755 --- a/src/Screen_EPD_EXT3.cpp +++ b/src/Screen_EPD_EXT3.cpp @@ -30,6 +30,9 @@ // Release 702: Added support for xE2417QS0Ax // Release 800: Read OTP memory // Release 801: Improved OTP implementation +// Release 802: Added references to application notes +// Release 802: Refactored CoG functions +// Release 803: Added types for string and frame-buffer // // Library header @@ -41,71 +44,25 @@ /// @cond /// @see /// * ApplicationNote_Spectra_4_smallSize_EPD_v01_20230522.pdf +/// * ApplicationNote_E5_SE_smallSize_EPD_v01_20230522 // -void Screen_EPD_EXT3::COG_reset() +// +// --- Small screens with Q film +// +void Screen_EPD_EXT3::COG_SmallQ_reset() { // Application note § 2. Power on COG driver b_reset(10, 10, 20, 40, 10); // BWRY specific b_waitBusy(); // BWRY specific } -void Screen_EPD_EXT3::COG_initial() -{ - // Application note § 3. COG initial - // Work settings - b_sendCommandData8(0x01, COG_initialData[16]); // PWR - b_sendIndexData(0x00, &COG_initialData[17], 2); // PSR - b_sendIndexData(0x03, &COG_initialData[30], 3); // PFS - - if (u_eScreen_EPD == eScreen_EPD_417_QS_0A) - { - if (COG_initialData[2] == 0x86) - { - b_sendIndexData(0x06, &COG_initialData[23], 3); // BTST_P - } - else if (COG_initialData[2] == 0x82) - { - b_sendIndexData(0x06, &COG_initialData[23], 4); // BTST_P - } - else - { - mySerial.println(); - mySerial.println("hV * ERROR - CoG type not supported"); - while (true);; - } - } - else - { - b_sendIndexData(0x06, &COG_initialData[23], 7); // BTST_P - } - - b_sendCommandData8(0x50, COG_initialData[39]); // CDI - b_sendIndexData(0x60, &COG_initialData[40], 2); // TCON - b_sendIndexData(0x61, &COG_initialData[19], 4); // TRES - b_sendCommandData8(0xE7, COG_initialData[33]); // - b_sendCommandData8(0xE3, COG_initialData[42]); // PWS - - if (u_eScreen_EPD == eScreen_EPD_417_QS_0A) - { - b_sendIndexData(0x65, &COG_initialData[34], 4); // TRES - } - else - { - b_sendCommandData8(0x4D, COG_initialData[43]); // - b_sendCommandData8(0xB4, COG_initialData[44]); // - b_sendCommandData8(0xB5, COG_initialData[45]); // - } - - b_sendCommandData8(0xE9, 0x01); // - b_sendCommandData8(0x30, 0x08); // PLL -} - -void Screen_EPD_EXT3::COG_getDataOTP() +void Screen_EPD_EXT3::COG_SmallQ_getDataOTP() { // 1.6 Read OTP memory mapping data - uint16_t u_chipId; - uint16_t u_readBytes; + uint16_t _chipId; + uint16_t _readBytes = 0; + u_flagOTP = false; // Size cSize cType Driver switch (u_eScreen_EPD) @@ -114,14 +71,14 @@ void Screen_EPD_EXT3::COG_getDataOTP() case eScreen_EPD_213_QS_0F: // 2.13” case eScreen_EPD_266_QS_0F: // 2.66” - u_chipId = 0x0302; - u_readBytes = 48; + _chipId = 0x0302; + _readBytes = 48; break; case eScreen_EPD_417_QS_0A: // 4.17” - u_chipId = 0x0605; - u_readBytes = 112; + _chipId = 0x0605; + _readBytes = 112; break; default: @@ -130,7 +87,7 @@ void Screen_EPD_EXT3::COG_getDataOTP() } // GPIO - COG_reset(); + s_reset(); digitalWrite(b_pin.panelReset, HIGH); // Check @@ -152,13 +109,14 @@ void Screen_EPD_EXT3::COG_getDataOTP() digitalWrite(b_pin.panelCS, HIGH); // Unselect mySerial.println(); - if (ui16 == u_chipId) + if (ui16 == _chipId) { mySerial.println(formatString("hV . OTP check 1 passed - Chip ID %04x as expected", ui16)); } else { - mySerial.println(formatString("hV * OTP check 1 failed - Chip ID 0x%04x, expected 0x%04x", ui16, u_chipId)); + mySerial.println(); + mySerial.println(formatString("hV * OTP check 1 failed - Chip ID 0x%04x, expected 0x%04x", ui16, _chipId)); while (0x01); } @@ -166,7 +124,7 @@ void Screen_EPD_EXT3::COG_getDataOTP() // uint8_t ui8 = 0; uint16_t offset = 0x0000; - if (u_chipId == 0x0302) + if (_chipId == 0x0302) { digitalWrite(b_pin.panelDC, LOW); // Command digitalWrite(b_pin.panelCS, LOW); // Select @@ -198,21 +156,22 @@ void Screen_EPD_EXT3::COG_getDataOTP() // hV_HAL_log(LEVEL_DEBUG, "Dummy read 0x%02x", ui8); digitalWrite(b_pin.panelCS, LOW); // Select - COG_initialData[0] = hV_HAL_SPI3_read(); // First byte for check + COG_data[0] = hV_HAL_SPI3_read(); // First byte for check digitalWrite(b_pin.panelCS, HIGH); // Unselect // Check table start and set bank offset - if (COG_initialData[0] == 0xa5) + if (COG_data[0] == 0xa5) { offset = 0x00; } else { - mySerial.println(formatString("hV * OTP check 2 failed - Bank %i, first 0x%02x, expected 0x%02x", 0, COG_initialData[0], 0xa5)); - while (true); + mySerial.println(); + mySerial.println(formatString("hV * OTP check 2 failed - Bank %i, first 0x%02x, expected 0x%02x", 0, COG_data[0], 0xa5)); + while (0x01); } } - else if (u_chipId == 0x0605) + else if (_chipId == 0x0605) { digitalWrite(b_pin.panelDC, LOW); // Command digitalWrite(b_pin.panelCS, LOW); // Select @@ -249,10 +208,10 @@ void Screen_EPD_EXT3::COG_getDataOTP() // hV_HAL_log(LEVEL_DEBUG, "Dummy read 0x%02x", ui8); digitalWrite(b_pin.panelCS, LOW); // Select - COG_initialData[0] = hV_HAL_SPI3_read(); // First byte for check + COG_data[0] = hV_HAL_SPI3_read(); // First byte for check digitalWrite(b_pin.panelCS, HIGH); // Unselect - if (COG_initialData[0] == 0xa5) // First byte check = 0xa5 + if (COG_data[0] == 0xa5) // First byte check = 0xa5 { offset = 0x00; } @@ -267,89 +226,159 @@ void Screen_EPD_EXT3::COG_getDataOTP() } digitalWrite(b_pin.panelCS, LOW); // Select - COG_initialData[0] = hV_HAL_SPI3_read(); // First byte for check + COG_data[0] = hV_HAL_SPI3_read(); // First byte for check digitalWrite(b_pin.panelCS, HIGH); // Unselect - if (COG_initialData[0] == 0xa5) // First byte check = 0xa5 + if (COG_data[0] == 0xa5) // First byte check = 0xa5 { offset = 0x70; } else { - mySerial.println(formatString("hV * OTP check 2 failed - Bank %i, first 0x%02x, expected 0x%02x", 0, COG_initialData[0], 0xa5)); + mySerial.println(); + mySerial.println(formatString("hV * OTP check 2 failed - Bank %i, first 0x%02x, expected 0x%02x", 0, COG_data[0], 0xa5)); while (0x01); } } } - mySerial.println(formatString("hV . OTP check 2 passed - Bank %i, first 0x%02x as expected", (offset > 0x00), COG_initialData[0])); + mySerial.println(formatString("hV . OTP check 2 passed - Bank %i, first 0x%02x as expected", (offset > 0x00), COG_data[0])); - // Populate COG_initialData - for (uint16_t index = 1; index < u_readBytes; index += 1) + // Populate COG_data + for (uint16_t index = 1; index < _readBytes; index += 1) { digitalWrite(b_pin.panelCS, LOW); // Select - COG_initialData[index] = hV_HAL_SPI3_read(); // Read OTP + COG_data[index] = hV_HAL_SPI3_read(); // Read OTP digitalWrite(b_pin.panelCS, HIGH); // Unselect } u_flagOTP = true; } -void Screen_EPD_EXT3::COG_sendImageDataGlobal() +void Screen_EPD_EXT3::COG_SmallQ_initial() { - // Application note § 4. Input image to the EPD - if (u_eScreen_EPD == eScreen_EPD_417_QS_0A) // 417: 0x04 before sending image + // Application note § 3. COG initial + // Work settings + b_sendCommandData8(0x01, COG_data[16]); // PWR + b_sendIndexData(0x00, &COG_data[17], 2); // PSR + b_sendIndexData(0x03, &COG_data[30], 3); // PFS + + switch (u_eScreen_EPD) { - b_sendCommand8(0x04); // Power on - digitalWrite(b_pin.panelCS, HIGH); // CS# = 1 - b_waitBusy(); + case eScreen_EPD_417_QS_0A: + + if (COG_data[2] == 0x86) + { + b_sendIndexData(0x06, &COG_data[23], 3); // BTST_P + } + else if (COG_data[2] == 0x82) + { + b_sendIndexData(0x06, &COG_data[23], 4); // BTST_P + } + else + { + mySerial.println(); + mySerial.println("hV * ERROR - CoG type not supported"); + while (true);; + } + break; + + default: + + b_sendIndexData(0x06, &COG_data[23], 7); // BTST_P + break; } -#if (SRAM_MODE == USE_INTERNAL_MCU) + b_sendCommandData8(0x50, COG_data[39]); // CDI + b_sendIndexData(0x60, &COG_data[40], 2); // TCON + b_sendIndexData(0x61, &COG_data[19], 4); // TRES + b_sendCommandData8(0xe7, COG_data[33]); // + b_sendCommandData8(0xe3, COG_data[42]); // PWS - b_sendIndexData(0x10, u_newImage, u_frameSize); // First frame, blackBuffer + switch (u_eScreen_EPD) + { + case eScreen_EPD_417_QS_0A: -#elif (SRAM_MODE == USE_EXTERNAL_SPI) + b_sendIndexData(0x65, &COG_data[34], 4); // TRES + break; - b_sendIndexDataSRAM(0x10, u_newImage, u_frameSize); // First frame + default: -#endif // SRAM_MODE + b_sendCommandData8(0x4d, COG_data[43]); // + b_sendCommandData8(0xb4, COG_data[44]); // + b_sendCommandData8(0xb5, COG_data[45]); // + break; + } + + b_sendCommandData8(0xe9, 0x01); // + b_sendCommandData8(0x30, 0x08); // PLL + + switch (u_eScreen_EPD) + { + case eScreen_EPD_417_QS_0A: + + b_sendCommand8(0x04); // Power on + digitalWrite(b_pin.panelCS, HIGH); // CS# = 1 + b_waitBusy(); + break; + + default: + + break; + } } -void Screen_EPD_EXT3::COG_update() +void Screen_EPD_EXT3::COG_SmallQ_sendImageData() +{ + // Application note § 4. Input image to the EPD + b_sendIndexData(0x10, s_newImage, u_pageColourSize); // First frame, blackBuffer +} + +void Screen_EPD_EXT3::COG_SmallQ_update() { // Application note § 5. Send updating command - if (u_eScreen_EPD == eScreen_EPD_417_QS_0A) - { - } - else // All except 417: 0x04 after sending image + switch (u_eScreen_EPD) { - b_sendCommand8(0x04); // Power on - digitalWrite(b_pin.panelCS, HIGH); // CS# = 1 - b_waitBusy(); + case eScreen_EPD_417_QS_0A: + + break; + + default: // All except 417: 0x04 after sending image + + b_sendCommand8(0x04); // Power on + b_waitBusy(); + break; } b_sendCommandData8(0x12, 0x00); // Display Refresh - digitalWrite(b_pin.panelCS, HIGH); // CS# = 1 b_waitBusy(); } -void Screen_EPD_EXT3::COG_powerOff() +void Screen_EPD_EXT3::COG_SmallQ_powerOff() { // Application note § 5. Turn-off DC/DC b_sendCommandData8(0x02, 0x00); // Turn off DC/DC - digitalWrite(b_pin.panelCS, HIGH); // CS# = 1 b_waitBusy(); - if (u_eScreen_EPD == eScreen_EPD_417_QS_0A) + switch (u_eScreen_EPD) { - if (COG_initialData[43] == 0xff) - { - delay(5000); - b_sendIndexData(0x00, &COG_initialData[26], 2); // PSR - } + case eScreen_EPD_417_QS_0A: + + if (COG_data[43] == 0xff) + { + delay(5000); + b_sendIndexData(0x00, &COG_data[26], 2); // PSR + } + break; + + default: + + break; } } +// +// --- End of Small screens with Q film +// /// @endcond // // === End of COG section @@ -362,8 +391,8 @@ Screen_EPD_EXT3::Screen_EPD_EXT3(eScreen_EPD_t eScreen_EPD_EXT3, pins_t board) { u_eScreen_EPD = eScreen_EPD_EXT3; b_pin = board; - u_newImage = 0; // nullptr - COG_initialData[0] = 0; + s_newImage = 0; // nullptr + COG_data[0] = 0; } void Screen_EPD_EXT3::begin() @@ -384,9 +413,7 @@ void Screen_EPD_EXT3::begin() default: - mySerial.println(); - mySerial.println(formatString("hV * Screen %i-%cS-0%c is not black-white-red-yellow", u_codeSize, u_codeFilm, u_codeDriver)); - while (0x01); + debugVariant(FILM_Q); break; } @@ -443,31 +470,27 @@ void Screen_EPD_EXT3::begin() // Actually for 1 colour; BWR requires 2 pages. u_pageColourSize = (uint32_t)u_bufferSizeV * (uint32_t)u_bufferSizeH; - // u_frameSize = u_pageColourSize, except for 9.69 and 11.98 - u_frameSize = u_pageColourSize; - // 9.69 and 11.98 combine two half-screens, hence two frames with adjusted size - #if defined(BOARD_HAS_PSRAM) // ESP32 PSRAM specific case - if (u_newImage == 0) + if (s_newImage == 0) { static uint8_t * _newFrameBuffer; _newFrameBuffer = (uint8_t *) ps_malloc(u_pageColourSize * u_bufferDepth); - u_newImage = (uint8_t *) _newFrameBuffer; + s_newImage = (uint8_t *) _newFrameBuffer; } #else // default case - if (u_newImage == 0) + if (s_newImage == 0) { static uint8_t * _newFrameBuffer; _newFrameBuffer = new uint8_t[u_pageColourSize * u_bufferDepth]; - u_newImage = (uint8_t *) _newFrameBuffer; + s_newImage = (uint8_t *) _newFrameBuffer; } #endif // ESP32 BOARD_HAS_PSRAM - memset(u_newImage, 0x00, u_pageColourSize * u_bufferDepth); + memset(s_newImage, 0x00, u_pageColourSize * u_bufferDepth); // Turn SPI on, initialise GPIOs and set GPIO levels // Reset panel and get tables @@ -475,6 +498,7 @@ void Screen_EPD_EXT3::begin() // Fonts hV_Screen_Buffer::begin(); // Standard + if (f_fontMax() > 0) { f_selectFont(0); @@ -488,9 +512,11 @@ void Screen_EPD_EXT3::begin() u_invert = false; setTemperatureC(25); // 25 Celsius = 77 Fahrenheit + + suspend(); } -String Screen_EPD_EXT3::WhoAmI() +STRING_TYPE Screen_EPD_EXT3::WhoAmI() { char work[64] = {0}; u_WhoAmI(work); @@ -498,19 +524,27 @@ String Screen_EPD_EXT3::WhoAmI() return formatString("iTC %i.%02i\"%s", v_screenDiagonal / 100, v_screenDiagonal % 100, work); } +void Screen_EPD_EXT3::suspend() +{ + b_suspend(); + + hV_HAL_SPI_end(); +} + void Screen_EPD_EXT3::resume() { + // Resume GPIO b_resume(); // Check type and get tables if (u_flagOTP == false) { hV_HAL_SPI3_begin(); // Define 3-wire SPI pins - COG_getDataOTP(); // 3-wire SPI read OTP memory + s_getDataOTP(); // 3-wire SPI read OTP memory } // Reset - COG_reset(); + s_reset(); // Start SPI hV_HAL_SPI_begin(16000000); // Fast 16 MHz @@ -525,7 +559,7 @@ uint8_t Screen_EPD_EXT3::flushMode(uint8_t updateMode) case UPDATE_FAST: case UPDATE_GLOBAL: - s_flushGlobal(); + s_flush(); break; default: @@ -543,18 +577,29 @@ void Screen_EPD_EXT3::flush() flushMode(UPDATE_GLOBAL); } -void Screen_EPD_EXT3::s_flushGlobal() +void Screen_EPD_EXT3::s_reset() { - // Initialise - COG_initial(); + // Reset + COG_SmallQ_reset(); +} + +void Screen_EPD_EXT3::s_getDataOTP() +{ + COG_SmallQ_getDataOTP(); // 3-wire SPI read OTP memory +} - // Send image data - COG_sendImageDataGlobal(); +void Screen_EPD_EXT3::s_flush(uint8_t updateMode) +{ + // Resume GPIO and SPI + resume(); - // Update - COG_update(); + COG_SmallQ_initial(); // Initialise + COG_SmallQ_sendImageData(); // Send image data + COG_SmallQ_update(); // Update + COG_SmallQ_powerOff(); // Power off - COG_powerOff(); + // Suspend GPIO and SPI + suspend(); } void Screen_EPD_EXT3::clear(uint16_t colour) @@ -567,24 +612,24 @@ void Screen_EPD_EXT3::clear(uint16_t colour) uint8_t pattern = (i % 2) ? 0b01000100 : 0b00010001; // black-white : white-black for (uint16_t j = 0; j < u_bufferSizeH; j++) { - u_newImage[i * u_bufferSizeH + j] = pattern; + s_newImage[i * u_bufferSizeH + j] = pattern; } } } else if ((colour == myColours.white) xor u_invert) { // physical black = 0-1 - memset(u_newImage, 0b01010101, u_pageColourSize); + memset(s_newImage, 0b01010101, u_pageColourSize); } else if ((colour == myColours.black) xor u_invert) { // physical white = 0-0 - memset(u_newImage, 0b00000000, u_pageColourSize); + memset(s_newImage, 0b00000000, u_pageColourSize); } else if (colour == myColours.red) { // physical red = 1-1 - memset(u_newImage, 0b11111111, u_pageColourSize); + memset(s_newImage, 0b11111111, u_pageColourSize); } else if (colour == myColours.darkRed) { @@ -594,7 +639,7 @@ void Screen_EPD_EXT3::clear(uint16_t colour) uint8_t pattern = (i % 2) ? 0b11011101 : 0b01110111; // red-black : black-red for (uint16_t j = 0; j < u_bufferSizeH; j++) { - u_newImage[i * u_bufferSizeH + j] = pattern; + s_newImage[i * u_bufferSizeH + j] = pattern; } } } @@ -606,14 +651,14 @@ void Screen_EPD_EXT3::clear(uint16_t colour) uint8_t pattern = (i % 2) ? 0b11001100 : 0b00110011; // red-white : white-red for (uint16_t j = 0; j < u_bufferSizeH; j++) { - u_newImage[i * u_bufferSizeH + j] = pattern; + s_newImage[i * u_bufferSizeH + j] = pattern; } } } else if (colour == myColours.yellow) { // physical yellow = 1-0 - memset(u_newImage, 0b10101010, u_pageColourSize); + memset(s_newImage, 0b10101010, u_pageColourSize); } else if (colour == myColours.darkYellow) { @@ -623,7 +668,7 @@ void Screen_EPD_EXT3::clear(uint16_t colour) uint8_t pattern = (i % 2) ? 0b10011001 : 0b01100110; // yellow-black : black-yellow for (uint16_t j = 0; j < u_bufferSizeH; j++) { - u_newImage[i * u_bufferSizeH + j] = pattern; + s_newImage[i * u_bufferSizeH + j] = pattern; } } } @@ -635,7 +680,7 @@ void Screen_EPD_EXT3::clear(uint16_t colour) uint8_t pattern = (i % 2) ? 0b10001000 : 0b00100010; // yellow-white : white-yellow for (uint16_t j = 0; j < u_bufferSizeH; j++) { - u_newImage[i * u_bufferSizeH + j] = pattern; + s_newImage[i * u_bufferSizeH + j] = pattern; } } } @@ -647,7 +692,7 @@ void Screen_EPD_EXT3::clear(uint16_t colour) uint8_t pattern = (i % 2) ? 0b10111011 : 0b11101110; // yellow-red : red-yellow for (uint16_t j = 0; j < u_bufferSizeH; j++) { - u_newImage[i * u_bufferSizeH + j] = pattern; + s_newImage[i * u_bufferSizeH + j] = pattern; } } } @@ -745,26 +790,26 @@ void Screen_EPD_EXT3::s_setPoint(uint16_t x1, uint16_t y1, uint16_t colour) if ((colour == myColours.black) xor u_invert) { // physical white = 0-0 - bitClear(u_newImage[z1], b1 + 1); // MSB - bitClear(u_newImage[z1], b1); + bitClear(s_newImage[z1], b1 + 1); // MSB + bitClear(s_newImage[z1], b1); } else if ((colour == myColours.white) xor u_invert) { // physical black = 0-1 - bitClear(u_newImage[z1], b1 + 1); // MSB - bitSet(u_newImage[z1], b1); + bitClear(s_newImage[z1], b1 + 1); // MSB + bitSet(s_newImage[z1], b1); } else if (colour == myColours.yellow) { // physical yellow = 1-0 - bitSet(u_newImage[z1], b1 + 1); // MSB - bitClear(u_newImage[z1], b1); + bitSet(s_newImage[z1], b1 + 1); // MSB + bitClear(s_newImage[z1], b1); } else if (colour == myColours.red) { // physical red = 1-1 - bitSet(u_newImage[z1], b1 + 1); // MSB - bitSet(u_newImage[z1], b1); + bitSet(s_newImage[z1], b1 + 1); // MSB + bitSet(s_newImage[z1], b1); } } @@ -823,8 +868,6 @@ bool Screen_EPD_EXT3::s_orientCoordinates(uint16_t & x, uint16_t & y) uint32_t Screen_EPD_EXT3::s_getZ(uint16_t x1, uint16_t y1) { uint32_t z1 = 0; - // According to 11.98 inch Spectra Application Note - // at http://www.pervasivedisplays.com/LiteratureRetrieve.aspx?ID=245146 z1 = (uint32_t)x1 * u_bufferSizeH + (y1 >> 2); // 4 pixels per byte diff --git a/src/Screen_EPD_EXT3.h b/src/Screen_EPD_EXT3.h index 3694d65..a8b5357 100755 --- a/src/Screen_EPD_EXT3.h +++ b/src/Screen_EPD_EXT3.h @@ -18,8 +18,8 @@ /// * EPD_417_QS_0A screen 4.17” /// /// @author Rei Vilo -/// @date 21 Mar 2024 -/// @version 801 +/// @date 21 May 2024 +/// @version 803 /// /// @copyright (c) Rei Vilo, 2010-2024 /// @copyright All rights reserved @@ -65,8 +65,8 @@ #error Required hV_HAL_PERIPHERALS_RELEASE 801 #endif // hV_HAL_PERIPHERALS_RELEASE -#if (hV_CONFIGURATION_RELEASE < 801) -#error Required hV_CONFIGURATION_RELEASE 801 +#if (hV_CONFIGURATION_RELEASE < 803) +#error Required hV_CONFIGURATION_RELEASE 803 #endif // hV_CONFIGURATION_RELEASE #if (hV_SCREEN_BUFFER_RELEASE < 801) @@ -81,20 +81,13 @@ /// /// @brief Library release number /// -#define SCREEN_EPD_EXT3_RELEASE 801 +#define SCREEN_EPD_EXT3_RELEASE 803 /// /// @brief Library variant /// #define SCREEN_EPD_EXT3_VARIANT "Basic-BWRY" -// Other libraries -#include "hV_Screen_Buffer.h" - -#if (hV_SCREEN_BUFFER_RELEASE < 801) -#error Required hV_SCREEN_BUFFER_RELEASE 801 -#endif // hV_SCREEN_BUFFER_RELEASE - /// /// @name Constants for features /// @{ @@ -134,6 +127,12 @@ class Screen_EPD_EXT3 final : public hV_Screen_Buffer, public hV_Utilities_PDLS /// void begin(); + /// + /// @brief Suspend + /// @details Turn SPI off and set all GPIOs low + /// + void suspend(); + /// /// @brief Resume after suspend() /// @details Turn SPI on and set all GPIOs levels @@ -144,7 +143,7 @@ class Screen_EPD_EXT3 final : public hV_Screen_Buffer, public hV_Utilities_PDLS /// @brief Who Am I /// @return Who Am I string /// - String WhoAmI(); + virtual STRING_TYPE WhoAmI(); /// /// @brief Clear the screen @@ -212,12 +211,28 @@ class Screen_EPD_EXT3 final : public hV_Screen_Buffer, public hV_Utilities_PDLS /// uint16_t s_getPoint(uint16_t x1, uint16_t y1); + /// + /// @brief Reset the screen + /// + void s_reset(); + + /// + /// @brief Get data from OTP + /// + void s_getDataOTP(); + + /// + /// @brief Update the screen + /// @param updateMode update mode, default = UPDATE_GLOBAL, otherwise UPDATE_FAST + /// + void s_flush(uint8_t updateMode = UPDATE_GLOBAL); + // Position /// /// @brief Convert /// @param x1 x-axis coordinate /// @param y1 y-axis coordinate - /// @return index for u_newImage[] + /// @return index for s_newImage[] /// uint32_t s_getZ(uint16_t x1, uint16_t y1); @@ -225,7 +240,7 @@ class Screen_EPD_EXT3 final : public hV_Screen_Buffer, public hV_Utilities_PDLS /// @brief Convert /// @param x1 x-axis coordinate /// @param y1 y-axis coordinate - /// @return bit for u_newImage[] + /// @return bit for s_newImage[] /// uint16_t s_getB(uint16_t x1, uint16_t y1); @@ -238,17 +253,14 @@ class Screen_EPD_EXT3 final : public hV_Screen_Buffer, public hV_Utilities_PDLS // // * Other functions specific to the screen - uint8_t COG_initialData[112]; // OTP - - void COG_reset(); - void COG_initial(); - void COG_getDataOTP(); - void COG_sendImageDataGlobal(); - void COG_update(); - void COG_powerOff(); - - // * Flush - void s_flushGlobal(); + uint8_t COG_data[112]; // OTP + + void COG_SmallQ_reset(); + void COG_SmallQ_getDataOTP(); + void COG_SmallQ_initial(); + void COG_SmallQ_sendImageData(); + void COG_SmallQ_update(); + void COG_SmallQ_powerOff(); // // === Touch section diff --git a/src/hV_Board.cpp b/src/hV_Board.cpp index a416744..658d1a5 100755 --- a/src/hV_Board.cpp +++ b/src/hV_Board.cpp @@ -32,14 +32,14 @@ void hV_Board::b_begin(pins_t board, uint8_t family, uint16_t delayCS) void hV_Board::b_reset(uint32_t ms1, uint32_t ms2, uint32_t ms3, uint32_t ms4, uint32_t ms5) { - delay(ms1); // delay 5ms - digitalWrite(b_pin.panelReset, HIGH); // RES# = 1 - delay(ms2); // delay 5ms - digitalWrite(b_pin.panelReset, LOW); + delay(ms1); // Wait for power stabilisation + digitalWrite(b_pin.panelReset, HIGH); // RESET = HIGH + delay(ms2); + digitalWrite(b_pin.panelReset, LOW); // RESET = LOW delay(ms3); - digitalWrite(b_pin.panelReset, HIGH); + digitalWrite(b_pin.panelReset, HIGH); // RESET = HIGH delay(ms4); - digitalWrite(b_pin.panelCS, HIGH); // CS# = 1 + digitalWrite(b_pin.panelCS, HIGH); // CS = HIGH, unselect delay(ms5); } @@ -54,7 +54,11 @@ void hV_Board::b_waitBusy(bool state) void hV_Board::b_suspend() { - // Not implemented + // Optional power circuit + if (b_pin.panelPower != NOT_CONNECTED) // generic + { + digitalWrite(b_pin.panelPower, LOW); + } } void hV_Board::b_resume() @@ -115,7 +119,7 @@ void hV_Board::b_sendIndexFixed(uint8_t index, uint8_t data, uint32_t size) delayMicroseconds(b_delayCS); SPI.transfer(index); - delayMicroseconds(b_delayCS); + delayMicroseconds(b_delayCS); digitalWrite(b_pin.panelDC, HIGH); // DC High = Data diff --git a/src/hV_Board.h b/src/hV_Board.h index 75c8683..0a89267 100755 --- a/src/hV_Board.h +++ b/src/hV_Board.h @@ -164,12 +164,6 @@ class hV_Board /// void b_sendCommandDataSelect8(uint8_t command, uint8_t data, uint8_t select = PANEL_CS_BOTH); - /// @brief Select one half of large screens - /// @param select default = PANEL_CS_BOTH, otherwise PANEL_CS_MASTER or PANEL_CS_SLAVE - /// @note Valid only for 9.69 and 11.98" screens - /// - void b_select(uint8_t select = PANEL_CS_BOTH); - /// /// @brief Suspend /// @@ -184,6 +178,13 @@ class hV_Board uint16_t b_delayCS = 50; // ms uint8_t b_family; + private: + /// @brief Select one half of large screens + /// @param select default = PANEL_CS_BOTH, otherwise PANEL_CS_MASTER or PANEL_CS_SLAVE + /// @note Valid only for 9.69 and 11.98" screens + /// + void b_select(uint8_t select = PANEL_CS_BOTH); + /// @endcond }; diff --git a/src/hV_Common.h b/src/hV_Common.h index 8115a41..edc199e 100755 --- a/src/hV_Common.h +++ b/src/hV_Common.h @@ -6,8 +6,8 @@ /// @n Based on highView technology /// /// @author Rei Vilo -/// @date 21 Mar 2024 -/// @version 801 +/// @date 21 May 2024 +/// @version 803 /// /// @copyright (c) Rei Vilo, 2010-2024 /// @copyright All rights reserved @@ -36,7 +36,7 @@ /// /// @brief Library release number /// -#define hV_COMMON_RELEASE 801 +#define hV_COMMON_RELEASE 803 // SDK #include "hV_HAL_Peripherals.h" diff --git a/src/hV_Configuration.h b/src/hV_Configuration.h index 13f5837..b9d7ecf 100755 --- a/src/hV_Configuration.h +++ b/src/hV_Configuration.h @@ -19,8 +19,8 @@ /// * 11. Set storage mode, not implemented /// /// @author Rei Vilo -/// @date 21 Mar 2024 -/// @version 801 +/// @date 21 May 2024 +/// @version 803 /// /// @copyright (c) Rei Vilo, 2010-2024 /// @copyright All rights reserved @@ -65,8 +65,8 @@ #error Required hV_LIST_CONSTANTS_RELEASE 801 #endif // hV_LIST_CONSTANTS_RELEASE -#if (hV_LIST_OPTIONS_RELEASE < 801) -#error Required hV_LIST_OPTIONS_RELEASE 801 +#if (hV_LIST_OPTIONS_RELEASE < 803) +#error Required hV_LIST_OPTIONS_RELEASE 803 #endif // hV_LIST_OPTIONS_RELEASE #if (hV_LIST_BOARDS_RELEASE < 801) @@ -81,7 +81,7 @@ /// /// @brief Release /// -#define hV_CONFIGURATION_RELEASE 801 +#define hV_CONFIGURATION_RELEASE 803 /// /// @name 1- List of supported Pervasive Displays screens @@ -107,5 +107,18 @@ /// @see hV_List_Options.h /// +/// +/// @brief Type for framebuffer +/// @details Based on SRAM_MODE selection +/// +#define FRAMEBUFFER_TYPE uint8_t * + +/// +/// @brief Type for string +/// @details Based on STRING_MODE selection +/// +#define STRING_TYPE String +#define STRING_CONST_TYPE String + #endif // hV_CONFIGURATION_RELEASE diff --git a/src/hV_Documentation.h b/src/hV_Documentation.h index 40af983..2b0fc88 100755 --- a/src/hV_Documentation.h +++ b/src/hV_Documentation.h @@ -41,8 +41,8 @@ /// Additionally, the **[Wiki](https://docs.pervasivedisplays.com/)** provides a gradual introduction to the e-paper technology and how to use it. /// /// @author Rei Vilo -/// @date 21 Mar 2024 -/// @version 801 +/// @date 21 May 2024 +/// @version 803 /// /// @copyright (c) Rei Vilo, 2010-2024 /// @copyright All rights reserved diff --git a/src/hV_Font_Terminal.cpp b/src/hV_Font_Terminal.cpp index b214a9d..4a521a0 100755 --- a/src/hV_Font_Terminal.cpp +++ b/src/hV_Font_Terminal.cpp @@ -19,21 +19,27 @@ // * Commercial edition: for professionals or organisations, commercial usage // All rights reserved // +// Release 803: Added types for string and frame-buffer +// -#include "hV_Font_Terminal.h" +// Configuration +#include "hV_Configuration.h" // The Arduino IDE does not allow to select the libraries, hence this condition. #if (FONT_MODE == USE_FONT_TERMINAL) +// Font structure +#include "hV_Font_Terminal.h" + // Code // Font functions -//hV_Font_Terminal::hV_Font_Terminal() +// hV_Font_Terminal::hV_Font_Terminal() void hV_Font_Terminal::f_begin() { - f_fontSize = 0; - f_fontNumber = MAX_FONT_SIZE; - f_fontSolid = true; - f_fontSpaceX = 1; + f_fontSize = 0; + f_fontNumber = MAX_FONT_SIZE; + f_fontSolid = true; + f_fontSpaceX = 1; // Take first font f_selectFont(0); @@ -141,21 +147,33 @@ uint16_t hV_Font_Terminal::f_characterSizeY() return f_font.height; } -uint16_t hV_Font_Terminal::f_stringSizeX(String text) +uint16_t hV_Font_Terminal::f_stringSizeX(STRING_CONST_TYPE text) { - return (uint16_t) text.length() * f_font.maxWidth; + uint16_t textWidth = 0; + uint8_t textLength = 0; + + textLength = text.length(); + + textWidth = (f_font.maxWidth + f_fontSpaceX) * textLength; + + return textWidth; } -uint8_t hV_Font_Terminal::f_stringLengthToFitX(String text, uint16_t pixels) +uint8_t hV_Font_Terminal::f_stringLengthToFitX(STRING_CONST_TYPE text, uint16_t pixels) { uint8_t index = 0; + uint16_t textWidth = 0; + uint8_t textLength = 0; + + textLength = text.length(); // Monospaced font index = pixels / f_font.maxWidth - 1; - if (index > text.length()) + if (index > textLength) { - index = text.length(); + index = textLength; } + return index; } diff --git a/src/hV_Font_Terminal.h b/src/hV_Font_Terminal.h index 1e047e9..6e2a0ac 100755 --- a/src/hV_Font_Terminal.h +++ b/src/hV_Font_Terminal.h @@ -6,8 +6,8 @@ /// @n Based on highView technology /// /// @author Rei Vilo -/// @date 21 Mar 2024 -/// @version 801 +/// @date 21 May 2024 +/// @version 803 /// /// @copyright (c) Rei Vilo, 2010-2024 /// @copyright All rights reserved @@ -41,6 +41,14 @@ // Configuration #include "hV_Configuration.h" +// Utilities +#include "hV_Utilities_Common.h" + +// Checks +#if (hV_CONFIGURATION_RELEASE < 803) +#error Required hV_CONFIGURATION_RELEASE 803 +#endif // hV_CONFIGURATION_RELEASE + // The Arduino IDE does not allow to select the libraries, hence this condition. #if (FONT_MODE == USE_FONT_TERMINAL) @@ -87,6 +95,13 @@ enum fontNumber_e /// class hV_Font_Terminal { + // public: + // /// + // /// @brief Constructor + // /// + // hV_Font_Terminal(); + + /// @cond protected: /// /// @brief Initialisation @@ -157,7 +172,7 @@ class hV_Font_Terminal /// @return horizontal size of the string for current font, in pixels /// @n @b More: @ref Fonts /// - uint16_t f_stringSizeX(String text); + uint16_t f_stringSizeX(STRING_CONST_TYPE text); /// /// @brief Number of characters to fit a size, x-axis @@ -166,7 +181,7 @@ class hV_Font_Terminal /// @return number of characters to be displayed inside the pixels /// @n @b More: @ref Fonts /// - uint8_t f_stringLengthToFitX(String text, uint16_t pixels); + uint8_t f_stringLengthToFitX(STRING_CONST_TYPE text, uint16_t pixels); /// /// @brief Number of fonts @@ -188,7 +203,6 @@ class hV_Font_Terminal /// uint8_t f_getFontMaxWidth(); - protected: /// /// @brief Get definition for line of character /// @param character character 32~255 @@ -206,7 +220,7 @@ class hV_Font_Terminal uint8_t f_fontSize; ///< actual font selected uint8_t f_fontSpaceX; ///< pixels between two characters, horizontal axis uint8_t f_fontSpaceY; ///< pixels between two characters, vertical axis - bool f_fontSolid; ///< + bool f_fontSolid; ///< opaque print /// @} }; /// @endcond @@ -214,3 +228,4 @@ class hV_Font_Terminal #endif // USE_FONT_TERMINAL #endif // hV_FONT_TERMINAL_RELEASE + diff --git a/src/hV_HAL_Peripherals.cpp b/src/hV_HAL_Peripherals.cpp index 491fefc..38f624a 100644 --- a/src/hV_HAL_Peripherals.cpp +++ b/src/hV_HAL_Peripherals.cpp @@ -21,9 +21,15 @@ // // Release 800: Added 3-wire SPI // Release 801: Added SPI configuration +// Release 803: Improved stability +// +// Library header #include "hV_HAL_Peripherals.h" +// +// === General section +// #if defined(ENERGIA) /// /// @brief Proxy for SPISettings @@ -63,6 +69,9 @@ void hV_HAL_begin() { // Empty } +// +// === End of General section +// // // === SPI section @@ -100,6 +109,11 @@ void hV_HAL_SPI_begin(uint32_t speed) #endif // ENERGIA } + +void hV_HAL_SPI_end() +{ + SPI.end(); +} // // === End of SPI section // diff --git a/src/hV_HAL_Peripherals.h b/src/hV_HAL_Peripherals.h index eb36732..e234ceb 100755 --- a/src/hV_HAL_Peripherals.h +++ b/src/hV_HAL_Peripherals.h @@ -6,8 +6,8 @@ /// @n Based on highView technology /// /// @author Rei Vilo -/// @date 21 Mar 2024 -/// @version 801 +/// @date 21 May 2024 +/// @version 803 /// /// @copyright (c) Rei Vilo, 2010-2024 /// @copyright All rights reserved @@ -36,7 +36,7 @@ /// /// @brief Release /// -#define hV_HAL_PERIPHERALS_RELEASE 801 +#define hV_HAL_PERIPHERALS_RELEASE 803 /// /// @brief SDK library @@ -75,6 +75,11 @@ void hV_HAL_begin(); /// void hV_HAL_SPI_begin(uint32_t speed = 8000000); +/// +/// @brief End SPI +/// +void hV_HAL_SPI_end(); + /// /// @name 3-wire SPI bus /// @warning @@ -88,7 +93,7 @@ void hV_HAL_SPI_begin(uint32_t speed = 8000000); #define SCK 7 #define MOSI 15 -#endif // ENERGIA +#endif // ENERGIA /// /// @brief Configure 3-wire SPI @@ -100,6 +105,7 @@ void hV_HAL_SPI3_begin(); /// @brief Set the 3-wire SPI pins /// @param pinClock clock, default = SCK /// @param pinData combined data, default = MOSI +/// @note For manual configuration only /// void hV_HAL_SPI3_define(uint8_t pinClock = SCK, uint8_t pinData = MOSI); @@ -119,6 +125,8 @@ uint8_t hV_HAL_SPI3_read(); /// void hV_HAL_SPI3_write(uint8_t value); +/// @} + /// /// @name Wire bus /// diff --git a/src/hV_List_Boards.h b/src/hV_List_Boards.h index 5118f09..99e8229 100755 --- a/src/hV_List_Boards.h +++ b/src/hV_List_Boards.h @@ -7,6 +7,10 @@ /// /// @n Content /// * 2- List of pre-configured boards +/// * 2.1 Recommended boards +/// * 2.2 Other boards +/// * 2.3 Deprecated boards +/// /// /// @author Rei Vilo /// @date 21 Mar 2024 @@ -42,7 +46,7 @@ /// /// @brief Release /// -#define hV_LIST_BOARDS_RELEASE 801 +#define hV_LIST_BOARDS_RELEASE 803 /// /// @brief Not connected pin @@ -76,9 +80,30 @@ struct pins_t }; /// -/// @name Recommended boards +/// @name 2.1 Recommended boards /// @{ +/// +/// @brief Arduino Nano Matter with Silicon Labs MGM240P, tested +/// @note Numbers refer to pins +/// @note Recommended board +/// +const pins_t boardArduinoNanoMatter = +{ + .panelBusy = 10, ///< EXT3 and EXT3-1 pin 3 Red -> D10 + .panelDC = 9, ///< EXT3 and EXT3-1 pin 4 Orange -> D9 + .panelReset = 8, ///< EXT3 and EXT3-1 pin 5 Yellow -> D8 + .flashCS = 7, ///< EXT3 and EXT3-1 pin 8 Violet -> D7 + .panelCS = 6, ///< EXT3 and EXT3-1 pin 9 Grey -> D6 + .panelCSS = NOT_CONNECTED, ///< EXT3 and EXT3-1 pin 12 Grey2 + .flashCSS = NOT_CONNECTED, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange + .panelPower = 2, ///< Optional power circuit -> D2 + .cardCS = NOT_CONNECTED, ///< Separate SD-card board + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + /// /// @brief Raspberry Pi Pico and Pico W with default RP2040 configuration, tested /// @note Numbers refer to GPIOs, not pins @@ -87,20 +112,13 @@ struct pins_t /// const pins_t boardRaspberryPiPico_RP2040 = { - ///< EXT3 and EXT3-1 pin 1 Black -> +3.3V - ///< EXT3 and EXT3-1 pin 2 Brown -> SPI SCK GP18 .panelBusy = 13, ///< EXT3 and EXT3-1 pin 3 Red -> GP13 .panelDC = 12, ///< EXT3 and EXT3-1 pin 4 Orange -> GP12 .panelReset = 11, ///< EXT3 and EXT3-1 pin 5 Yellow -> GP11 - ///< EXT3 and EXT3-1 pin 6 Green -> SPI MISO or NC GP16 - ///< EXT3 and EXT3-1 pin 7 Blue -> SPI MOSI or SDIO GP19 .flashCS = 10, ///< EXT3 and EXT3-1 pin 8 Violet -> GP10 .panelCS = 17, ///< EXT3 and EXT3-1 pin 9 Grey -> GP17 .panelCSS = 14, ///< EXT3 and EXT3-1 pin 12 Grey2 -> GP14 .flashCSS = 15, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> GP15 - ///< EXT3 and EXT3-1 pin 10 White -> GROUND - ///< EXT3-Touch pin 1 Brown -> I2C SDA GP5 - ///< EXT3-Touch pin 2 Black -> I2C SCL GP4 .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> GP2 .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> GP3 .panelPower = NOT_CONNECTED, ///< Optional power circuit @@ -136,20 +154,13 @@ const pins_t boardFeatherNRF52840 = /// const pins_t boardESP32DevKitC = { - ///< EXT3 and EXT3-1 pin 1 Black -> +3.3V - ///< EXT3 and EXT3-1 pin 2 Brown -> SPI SCK GPIO14 .panelBusy = 27, ///< EXT3 and EXT3-1 pin 3 Red -> GPIO27 .panelDC = 26, ///< EXT3 and EXT3-1 pin 4 Orange -> GPIO26 .panelReset = 25, ///< EXT3 and EXT3-1 pin 5 Yellow -> GPIO25 - ///< EXT3 and EXT3-1 pin 6 Green -> SPI MISO GPIO12 - ///< EXT3 and EXT3-1 pin 7 Blue -> SPI MOSI GPIO13 .flashCS = 33, ///< EXT3 and EXT3-1 pin 8 Violet -> GPIO33 .panelCS = 32, ///< EXT3 and EXT3-1 pin 9 Grey -> GPIO32 .panelCSS = 4, ///< EXT3 and EXT3-1 pin 12 Grey2 -> GPIO4 .flashCSS = 0, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> GPIO0 - ///< EXT3 and EXT3-1 pin 10 White -> GROUND - ///< EXT3-Touch pin 1 Brown -> I2C SDA GPIO21 - ///< EXT3-Touch pin 2 Black -> I2C SCL GPIO22 .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> GPIO10 .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> GPIO9 .panelPower = NOT_CONNECTED, ///< Optional power circuit @@ -160,88 +171,9 @@ const pins_t boardESP32DevKitC = /// @} /// -/// @name Other boards +/// @name 2.2 Other boards /// @{ -/// -/// @brief Texas Instruments LaunchPad MSP430 and MSP432 LaunchPad configuration, tested -/// -const pins_t boardLaunchPad = -{ - .panelBusy = 11, ///< EXT3 and EXT3-1 pin 3 Red -> 11 - .panelDC = 12, ///< EXT3 and EXT3-1 pin 4 Orange -> 12 - .panelReset = 13, ///< EXT3 and EXT3-1 pin 5 Yellow -> 13 - .flashCS = 18, ///< EXT3 and EXT3-1 pin 8 Violet -> 18 - .panelCS = 19, ///< EXT3 and EXT3-1 pin 9 Grey -> 19 - .panelCSS = 39, ///< EXT3 and EXT3-1 pin 12 Grey2 -> 39 - .flashCSS = 38, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> 38 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> 8 - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> 6 - .panelPower = NOT_CONNECTED, ///< Optional power circuit -> 2 - .cardCS = NOT_CONNECTED, ///< Separate SD-card board -> 5 - .cardDetect = NOT_CONNECTED, ///< Separate SD-card board -}; - -/// -/// @brief Texas Instruments LaunchPad MSP430FR5994 LaunchPad with SD-card configuration, tested -/// -const pins_t boardMSP430FR5994 = -{ - .panelBusy = 11, ///< EXT3 and EXT3-1 pin 3 Red - .panelDC = 12, ///< EXT3 and EXT3-1 pin 4 Orange - .panelReset = 13, ///< EXT3 and EXT3-1 pin 5 Yellow - .flashCS = 18, ///< EXT3 and EXT3-1 pin 8 Violet - .panelCS = 19, ///< EXT3 and EXT3-1 pin 9 Grey - .panelCSS = 39, ///< EXT3 and EXT3-1 pin 12 Grey2 - .flashCSS = 38, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = 47, ///< Included SD-card - .cardDetect = 51 ///< Included SD-card -}; - -/// -/// @brief Texas Instruments LaunchPad CC1352 configuration, tested -/// -const pins_t boardCC1352 = -{ - .panelBusy = 5, ///< EXT3 and EXT3-1 pin 3 Red - .panelDC = 6, ///< EXT3 and EXT3-1 pin 4 Orange - .panelReset = 19, ///< EXT3 and EXT3-1 pin 5 Yellow - .flashCS = 24, ///< EXT3 and EXT3-1 pin 8 Violet - .panelCS = 26, ///< EXT3 and EXT3-1 pin 9 Grey - .panelCSS = 37, ///< EXT3 and EXT3-1 pin 12 Grey2 -> 37 - .flashCSS = 27, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> 27 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = NOT_CONNECTED, ///< Separate SD-card board - .cardDetect = NOT_CONNECTED, ///< Separate SD-card board -}; - -/// -/// @brief Raspberry Pi Zero, 2B, 3B, 4B configuration with RasPiArduino, tested -/// @warning Not recommended -/// @deprecated Use boardRaspberryPiZeroB_MRAA instead (7.0.0) -/// @see https://github.com/me-no-dev/RasPiArduino -/// -const pins_t boardRaspberryPiZeroB_RasPiArduino = -{ - .panelBusy = 7, ///< EXT3 and EXT3-1 pin 3 Red -> GPIO7 pin 26 - .panelDC = 8, ///< EXT3 and EXT3-1 pin 4 Orange -> GPIO8 pin 24 - .panelReset = 25, ///< EXT3 and EXT3-1 pin 5 Yellow -> GPIO25 pin 22 - .flashCS = 22, ///< EXT3 and EXT3-1 pin 8 Violet -> GPIO22 pin 15 - .panelCS = 27, ///< EXT3 and EXT3-1 pin 9 Grey -> GPIO27 pin 13 - .panelCSS = 23, ///< EXT3 and EXT3-1 pin 12 Grey2 -> GPIO23 pin 16 - .flashCSS = 24, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> GPIO24 pin 18 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = NOT_CONNECTED, ///< Separate SD-card board - .cardDetect = NOT_CONNECTED, ///< Separate SD-card board -}; - /// /// @brief Raspberry Pi Pico Arduino Mbed-OS configuration, not recommended, tested /// @warning Not recommended @@ -353,11 +285,6 @@ const pins_t boardParticlePhoton = .cardDetect = NOT_CONNECTED, ///< Separate SD-card board }; -/// -/// @brief RedBear Duo configuration, tested -/// -const pins_t boardRedBearDuo = boardParticlePhoton; - /// /// @brief Espressif ESP32-Pico-v4 /// @note Numbers refer to GPIOs not pins @@ -435,9 +362,6 @@ const pins_t boardSiLabsBG24Explorer = .panelCS = 0x11, ///< EXT3 and EXT3-1 pin 9 Grey -> PB01 .panelCSS = NOT_CONNECTED, ///< EXT3 and EXT3-1 pin 12 Grey2 -> P.0. .flashCSS = NOT_CONNECTED, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> P.0. - ///< EXT3 and EXT3-1 pin 10 White -> GROUND - // .i2cSDA = 0x15, ///< EXT3-Touch pin 1 Brown -> I2C SDA PB05 - // .i2cSCL = 0x14, ///< EXT3-Touch pin 2 Black -> I2C SCL PB04 .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> PD05 .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> PD04 .panelPower = NOT_CONNECTED, ///< Optional power circuit @@ -445,6 +369,26 @@ const pins_t boardSiLabsBG24Explorer = .cardDetect = NOT_CONNECTED, ///< Separate SD-card board }; +/// +/// @brief STMicroelectronics Nucleo32 L431KC, tested +/// @warning D7/D8 shared with OSC32_IN/OSC32_OUT +/// +const pins_t boardNucleo32L431KC = +{ + .panelBusy = 4, ///< EXT3 and EXT3-1 pin 3 Red + .panelDC = 5, ///< EXT3 and EXT3-1 pin 4 Orange + .panelReset = 6, ///< EXT3 and EXT3-1 pin 5 Yellow + .flashCS = 9, ///< EXT3 and EXT3-1 pin 8 Violet + .panelCS = 10, ///< EXT3 and EXT3-1 pin 9 Grey + .panelCSS = NOT_CONNECTED, ///< EXT3 and EXT3-1 pin 12 Grey2 + .flashCSS = NOT_CONNECTED, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = NOT_CONNECTED, ///< Separate SD-card board + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + /// /// @brief Teensy 3.x configuration, tested /// @@ -466,5 +410,69 @@ const pins_t boardTeensy3x = /// @} +/// +/// @name 2.3 Deprecated boards +/// @{ + +/// +/// @brief Texas Instruments LaunchPad MSP430 and MSP432 configuration, tested +/// @deprecated Texas Instruments LaunchPad boards are deprecated (8.0.3) +/// +const pins_t boardLaunchPad = +{ + .panelBusy = 11, ///< EXT3 and EXT3-1 pin 3 Red -> 11 + .panelDC = 12, ///< EXT3 and EXT3-1 pin 4 Orange -> 12 + .panelReset = 13, ///< EXT3 and EXT3-1 pin 5 Yellow -> 13 + .flashCS = 18, ///< EXT3 and EXT3-1 pin 8 Violet -> 18 + .panelCS = 19, ///< EXT3 and EXT3-1 pin 9 Grey -> 19 + .panelCSS = 39, ///< EXT3 and EXT3-1 pin 12 Grey2 -> 39 + .flashCSS = 38, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> 38 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> 8 + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> 6 + .panelPower = NOT_CONNECTED, ///< Optional power circuit -> 2 + .cardCS = NOT_CONNECTED, ///< Separate SD-card board -> 5 + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + +/// +/// @brief Texas Instruments LaunchPad MSP430FR5994 LaunchPad with SD-card configuration, tested +/// +const pins_t boardMSP430FR5994 = +{ + .panelBusy = 11, ///< EXT3 and EXT3-1 pin 3 Red + .panelDC = 12, ///< EXT3 and EXT3-1 pin 4 Orange + .panelReset = 13, ///< EXT3 and EXT3-1 pin 5 Yellow + .flashCS = 18, ///< EXT3 and EXT3-1 pin 8 Violet + .panelCS = 19, ///< EXT3 and EXT3-1 pin 9 Grey + .panelCSS = 39, ///< EXT3 and EXT3-1 pin 12 Grey2 + .flashCSS = 38, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = 47, ///< Included SD-card + .cardDetect = 51 ///< Included SD-card +}; + +/// +/// @brief Texas Instruments LaunchPad CC1352 configuration, tested +/// +const pins_t boardCC1352 = +{ + .panelBusy = 5, ///< EXT3 and EXT3-1 pin 3 Red + .panelDC = 6, ///< EXT3 and EXT3-1 pin 4 Orange + .panelReset = 19, ///< EXT3 and EXT3-1 pin 5 Yellow + .flashCS = 24, ///< EXT3 and EXT3-1 pin 8 Violet + .panelCS = 26, ///< EXT3 and EXT3-1 pin 9 Grey + .panelCSS = 37, ///< EXT3 and EXT3-1 pin 12 Grey2 -> 37 + .flashCSS = 27, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> 27 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = NOT_CONNECTED, ///< Separate SD-card board + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + +/// @} + #endif // hV_LIST_BOARDS_RELEASE diff --git a/src/hV_List_Options.h b/src/hV_List_Options.h index 128eab3..2a7ad8f 100755 --- a/src/hV_List_Options.h +++ b/src/hV_List_Options.h @@ -15,10 +15,11 @@ /// * 9. Set GPIO expander mode, not implemented /// * 10. String object for basic edition /// * 11. Set storage mode, not implemented +/// * 12. Set debug options /// /// @author Rei Vilo -/// @date 21 Mar 2024 -/// @version 801 +/// @date 21 May 2024 +/// @version 803 /// /// @copyright (c) Rei Vilo, 2010-2024 /// @copyright All rights reserved @@ -47,7 +48,7 @@ /// /// @brief Release /// -#define hV_LIST_OPTIONS_RELEASE 801 +#define hV_LIST_OPTIONS_RELEASE 803 /// /// @name 1- List of supported Pervasive Displays screens @@ -183,3 +184,10 @@ #endif // hV_LIST_OPTIONS_RELEASE +/// +/// @brief 12- Debug options +/// * Basic edition: none +/// * Evaluation edition: all +/// * Commercial edition: option +/// + diff --git a/src/hV_List_Screens.h b/src/hV_List_Screens.h index e47896b..455611c 100755 --- a/src/hV_List_Screens.h +++ b/src/hV_List_Screens.h @@ -10,8 +10,8 @@ /// * 1- List of supported Pervasive Displays screens /// /// @author Rei Vilo -/// @date 21 Mar 2024 -/// @version 801 +/// @date 21 May 2024 +/// @version 803 /// /// @copyright (c) Rei Vilo, 2010-2024 /// @copyright All rights reserved @@ -43,7 +43,7 @@ /// /// @brief Release /// -#define hV_LIST_SCREENS_RELEASE 801 +#define hV_LIST_SCREENS_RELEASE 803 /// @deprecated Screen name format (8.0.0) /// * Name format eScreen_EPD_EXT3___ is deprecated (8.0.0). @@ -171,6 +171,17 @@ #define eScreen_EPD_266_HS_09 SCREEN(SIZE_266, FILM_H, DRIVER_9) ///< reference xE2266HS09x /// @} +/// +/// @name Legacy monochrome screens +/// @note Global update mode +/// @{ +/// +#define eScreen_EPD_581_CS_08 SCREEN(SIZE_581, FILM_C, DRIVER_8) ///< reference xE2581CS08x, previous type +#define eScreen_EPD_741_CS_08 SCREEN(SIZE_741, FILM_C, DRIVER_8) ///< reference xE2741CS08x, previous type +#define eScreen_EPD_969_CS_08 SCREEN(SIZE_969, FILM_C, DRIVER_8) ///< reference xE2969CS08x, previous type +#define eScreen_EPD_B98_CS_08 SCREEN(SIZE_1198, FILM_C, DRIVER_8) ///< reference xE2B98CS08x, previous type +/// @} + /// /// @name Colour black-white-red "Spectra" screens /// @note Global update mode @@ -250,11 +261,13 @@ #define eScreen_EPD_266_PS_0C SCREEN(SIZE_266, FILM_P, DRIVER_C) ///< reference xE2266PS0Cx #define eScreen_EPD_271_PS_09 SCREEN(SIZE_271, FILM_P, DRIVER_9) ///< reference xE2271PS09x #define eScreen_EPD_287_PS_09 SCREEN(SIZE_287, FILM_P, DRIVER_9) ///< reference xE2287PS09x +/// @todo eScreen_EPD_343_PS_0B not tested +#define eScreen_EPD_343_PS_0B SCREEN(SIZE_343, FILM_P, DRIVER_B) ///< reference xE2343PS0Bx #define eScreen_EPD_370_PS_0C SCREEN(SIZE_370, FILM_P, DRIVER_C) ///< reference xE2370PS0Cx #define eScreen_EPD_417_PS_0D SCREEN(SIZE_417, FILM_P, DRIVER_D) ///< reference xE2417PS0Dx #define eScreen_EPD_437_PS_0C SCREEN(SIZE_437, FILM_P, DRIVER_C) ///< reference xE2437PS0Cx -// /// @todo eScreen_EPD_581_PS_0B not tested -// #define eScreen_EPD_581_PS_0B SCREEN(SIZE_581, FILM_P, DRIVER_B) ///< reference xE2581PS0Bx, not tested +/// @todo eScreen_EPD_581_PS_0B not tested +#define eScreen_EPD_581_PS_0B SCREEN(SIZE_581, FILM_P, DRIVER_B) ///< reference xE2581PS0Bx, not tested // /// @todo eScreen_EPD_741_PS_0B not tested // #define eScreen_EPD_741_PS_0B SCREEN(SIZE_741, FILM_P, DRIVER_B) ///< reference xE2741PS0Bx, not tested // /// @todo eScreen_EPD_969_PS_0B not tested @@ -277,12 +290,14 @@ #define eScreen_EPD_271_KS_09 SCREEN(SIZE_271, FILM_K, DRIVER_9) ///< reference xE2271KS09x #define eScreen_EPD_271_KS_0C SCREEN(SIZE_271, FILM_K, DRIVER_C) ///< reference xE2271KS0Cx #define eScreen_EPD_290_KS_0F SCREEN(SIZE_290, FILM_K, DRIVER_F) ///< reference xE2290KS0Fx +/// @todo eScreen_EPD_350_KS_0C not tested +#define eScreen_EPD_350_KS_0C SCREEN(SIZE_350, FILM_K, DRIVER_C) ///< reference xE2350KS0Cx) #define eScreen_EPD_370_KS_0C SCREEN(SIZE_370, FILM_K, DRIVER_C) ///< reference xE2370KS0Cx #define eScreen_EPD_417_KS_0D SCREEN(SIZE_417, FILM_K, DRIVER_D) ///< reference xE2417KS0Dx /// @todo eScreen_EPD_437_KS_0C not tested #define eScreen_EPD_437_KS_0C SCREEN(SIZE_437, FILM_K, DRIVER_C) ///< reference xE2437KS0Cx, not tested -// /// @todo eScreen_EPD_581_KS_0B not tested -// #define eScreen_EPD_581_KS_0B SCREEN(SIZE_581, FILM_K, DRIVER_B) ///< reference xE2581KS0Bx, not tested +/// @todo eScreen_EPD_581_KS_0B not tested +#define eScreen_EPD_581_KS_0B SCREEN(SIZE_581, FILM_K, DRIVER_B) ///< reference xE2581KS0Bx, not tested // /// @todo eScreen_EPD_741_KS_0B not tested // #define eScreen_EPD_741_KS_0B SCREEN(SIZE_741, FILM_K, DRIVER_B) ///< reference xE2741KS0Bx, not tested // /// @todo eScreen_EPD_969_KS_0B not tested diff --git a/src/hV_List_Screens_Legacy.h b/src/hV_List_Screens_Legacy.h index f32d2a1..dfd5e4b 100644 --- a/src/hV_List_Screens_Legacy.h +++ b/src/hV_List_Screens_Legacy.h @@ -135,7 +135,7 @@ // #define eScreen_EPD_EXT3_581_0B_Fast eScreen_EPD_581_PS_0B ///< reference xE2581PS0Bx, not tested // /// @todo eScreen_EPD_EXT3_741_0B_Fast not tested // #define eScreen_EPD_EXT3_741_0B_Fast eScreen_EPD_741_PS_0B ///< reference xE2741PS0Bx, not tested -// /// @todo eScreen_EPD_EXT3_969_0B_Fast not tested +/// @todo eScreen_EPD_EXT3_969_0B_Fast not tested // #define eScreen_EPD_EXT3_969_0B_Fast eScreen_EPD_969_PS_0B ///< reference xE2969PS0Bx, not tested // /// @todo eScreen_EPD_EXT3_B98_0B_Fast not tested // #define eScreen_EPD_EXT3_B98_0B_Fast eScreen_EPD_B98_PS_0B ///< reference xE2B98PS0Bx, not tested diff --git a/src/hV_Screen_Buffer.h b/src/hV_Screen_Buffer.h index 74595b5..5196a19 100755 --- a/src/hV_Screen_Buffer.h +++ b/src/hV_Screen_Buffer.h @@ -406,7 +406,7 @@ class hV_Screen_Buffer : protected hV_Font_Terminal /// uint8_t s_getCharacter(uint8_t character, uint8_t index); - uint8_t * u_newImage; + uint8_t * s_newImage; // Variables provided by hV_Screen_Virtual bool v_penSolid, v_flagRead, v_flagStorage, v_flagEnergy; diff --git a/src/hV_Utilities_Common.cpp b/src/hV_Utilities_Common.cpp index d4c734c..6772942 100755 --- a/src/hV_Utilities_Common.cpp +++ b/src/hV_Utilities_Common.cpp @@ -3,7 +3,8 @@ // Library C++ code // ---------------------------------- // -// Project highView Library Suite +// Project Pervasive Displays Library Suite +// Based on highView technology // // Created by Rei Vilo, 01 Jun 2013 // @@ -14,6 +15,7 @@ // See hV_Utilities_Common.h for references // // Release 700: Refactored screen and board functions +// Release 803: Added types for string and frame-buffer // // Library header @@ -32,17 +34,19 @@ char bufferOut[128]; // Code // Utilities -String formatString(const char * format, ...) + +STRING_TYPE formatString(const char * format, ...) { memset(&bufferOut, 0x00, sizeof(bufferOut)); va_list args; va_start(args, format); vsnprintf(bufferOut, 127, format, args); va_end(args); + return String(bufferOut); } -String trimString(String text) +STRING_TYPE trimString(STRING_TYPE text) { String work = ""; bool flag = true; @@ -153,45 +157,7 @@ int32_t sin32x100(int32_t degreesX100) return cos32x100(degreesX100 + 27000); } -void convertPolar2Rectangle(uint16_t centerX, uint16_t centerY, uint16_t angle, uint16_t radius, uint16_t & rectangularX, uint16_t & rectangularY) -{ - rectangularX = (uint16_t)(centerX + radius * sin32x100(angle * 100) / 100); - rectangularY = (uint16_t)(centerY - radius * cos32x100(angle * 100) / 100); -} - -void convertRectangle2Polar(uint16_t centerX, uint16_t centerY, uint16_t rectangularX, uint16_t rectangularY, uint16_t & angle, uint16_t & radius) -{ - float fX = (float)rectangularX - centerX; - float fY = (float)rectangularY - centerY; - float fZ = sqrt(fX * fX + fY * fY); - fX /= fZ; - fY /= fZ; - - if ((fY == 0) and (fX > 0)) - { - angle = 90; - } - else if ((fY == 0) and (fX < 0)) - { - angle = 270; - } - else - { - float fAngle = -atan(fX / fY); - fAngle *= 360 / 2 / PI; - - if (fY > 0) - { - fAngle += 180; - } - if ((fX < 0) and (fY < 0)) - { - fAngle += 360; - } - angle = (uint16_t)fAngle; - } -} -String utf2iso(String s) +STRING_TYPE utf2iso(STRING_TYPE s) { uint8_t c; diff --git a/src/hV_Utilities_Common.h b/src/hV_Utilities_Common.h index e3277ce..bb9e03e 100755 --- a/src/hV_Utilities_Common.h +++ b/src/hV_Utilities_Common.h @@ -6,8 +6,8 @@ /// @n Based on highView technology /// /// @author Rei Vilo -/// @date 21 Mar 2024 -/// @version 801 +/// @date 21 May 2024 +/// @version 803 /// /// @copyright (c) Rei Vilo, 2010-2024 /// @copyright All rights reserved @@ -35,11 +35,14 @@ // SDK #include "hV_HAL_Peripherals.h" +// Configuration +#include "hV_Configuration.h" + #ifndef hV_UTILITIES_RELEASE /// /// @brief Library release number /// -#define hV_UTILITIES_RELEASE 801 +#define hV_UTILITIES_RELEASE 803 #ifndef min #define min(a, b) ((a) < (b) ? (a) : (b)) @@ -85,31 +88,6 @@ int32_t cos32x100(int32_t degreesX100); /// int32_t sin32x100(int32_t degreesX100); -/* -/// -/// @brief Convert polar to rectangle coordinates -/// @param[in] centerX circle center, x coordinate -/// @param[in] centerY circle center, y coordinate -/// @param[in] angle angle, degrees 0..360° -/// @param[in] radius radius, pixels -/// @param[out] rectangularX x rectangular coordinate -/// @param[out] rectangularY y rectangular coordinate -/// @note This function uses floats. -/// -void convertPolar2Rectangle(uint16_t centerX, uint16_t centerY, uint16_t angle, uint16_t radius, uint16_t & rectangularX, uint16_t & rectangularY); - -/// @brief Convert rectangle to polar coordinates -/// @param[in] centerX circle center, x coordinate -/// @param[in] centerY circle center, y coordinate -/// @param[in] rectangularX x rectangular coordinate -/// @param[in] rectangularY y rectangular coordinate -/// @param[out] angle angle in degrees 0..360° -/// @param[out] radius radius in pixels -/// @note This function uses floats. -/// -void convertRectangle2Polar(uint16_t centerX, uint16_t centerY, uint16_t rectangularX, uint16_t rectangularY, uint16_t & angle, uint16_t & radius); -*/ - /// /// @brief UTF-8 to ISO-8859-1 Converter /// @param s UTF-8 string, input @@ -119,7 +97,7 @@ void convertRectangle2Polar(uint16_t centerX, uint16_t centerY, uint16_t rectang /// (Mountain View, CA: The Unicode Consortium, 2012. ISBN 978-1-936213-07-8) /// http://www.unicode.org/versions/Unicode6.2.0/ /// -String utf2iso(String s); +STRING_TYPE utf2iso(STRING_TYPE s); /// /// @brief Format string @@ -129,7 +107,7 @@ String utf2iso(String s); /// @return string with values formatted /// @see http://www.cplusplus.com/reference/cstdio/printf/?kw=printf for codes /// -String formatString(const char * format, ...); +STRING_TYPE formatString(const char * format, ...); /// /// @brief Remove leading and ending characters @@ -137,7 +115,7 @@ String formatString(const char * format, ...); /// @return trimmed text /// @note Removed characters are LF CR TAB SPACE ' /// -String trimString(String text); +STRING_TYPE trimString(STRING_TYPE text); /// @} diff --git a/src/hV_Utilities_PDLS.cpp b/src/hV_Utilities_PDLS.cpp index 1b77d4b..335e5ee 100755 --- a/src/hV_Utilities_PDLS.cpp +++ b/src/hV_Utilities_PDLS.cpp @@ -6,13 +6,14 @@ // Project Pervasive Displays Library Suite // Based on highView technology // -// Created by Rei Vilo, 16 Aug 2023 +// Created by Rei Vilo, 21 Mar 2024 // // Copyright (c) Rei Vilo, 2010-2024 // Licence All rights reserved // // Release 800: Read OTP memory // Release 801: Added number of colours +// Release 803: Added types for string and frame-buffer // // Library header @@ -45,14 +46,23 @@ void hV_Utilities_PDLS::u_WhoAmI(char * answer) strcat(answer, "-Wide"); break; + case FILM_H: // Film H, Freezer + + strcat(answer, "-Freezer"); + break; + case FILM_J: // Film J, BWR, "Spectra" case FILM_E: // Film E, BWR, deprecated case FILM_F: // Film F, BWR, deprecated - case FILM_G: // Film G, BWY, deprecated strcat(answer, "-BWR"); break; + case FILM_G: // Film G, BWY, deprecated + + strcat(answer, "-BWY"); + break; + case FILM_Q: // Film Q, BWRY, "Spectra 4" strcat(answer, "-BWRY"); @@ -140,21 +150,13 @@ uint8_t hV_Utilities_PDLS::screenColours() default: - result = 0; // error + result = 0; // Error break; } return result; } -String hV_Utilities_PDLS::screenNumber() -{ - char work[64] = {0}; - u_screenNumber(work); - - return formatString("Number %s", work); -} - void hV_Utilities_PDLS::u_screenNumber(char * answer) { memcpy(answer, 0x00, strlen(answer)); @@ -180,6 +182,14 @@ void hV_Utilities_PDLS::u_screenNumber(char * answer) } } +STRING_TYPE hV_Utilities_PDLS::screenNumber() +{ + char work[64] = {0}; + u_screenNumber(work); + + return formatString("Number %s", work); +} + // // === Temperature section // @@ -286,3 +296,47 @@ uint8_t hV_Utilities_PDLS::checkTemperatureMode(uint8_t updateMode) return updateMode; } +void hV_Utilities_PDLS::debugVariant(uint8_t contextFilm) +{ + mySerial.println(); + + switch (contextFilm) + { + case FILM_P: // BW, fast update + case FILM_K: // BW, fast update and wide temperature + + mySerial.println(formatString("hV * Screen %i-%cS-0%c with no fast update", u_codeSize, u_codeFilm, u_codeDriver)); + break; + + case FILM_Q: // BWRY + + mySerial.println(formatString("hV * Screen %i-%cS-0%c is not black-white-red-yellow", u_codeSize, u_codeFilm, u_codeDriver)); + break; + + default: + + mySerial.println(formatString("hV * Screen %i-%cS-0%c is not supported", u_codeSize, u_codeFilm, u_codeDriver)); + break; + } // u_codeFilm + + switch (u_codeFilm) + { + case FILM_P: // BW, fast update + case FILM_K: // BW, fast update and wide temperature + + mySerial.println(formatString("hV * Use PDLS_EXT3_%s_%s instead", "Basic", "Fast")); + break; + + case FILM_Q: // BWRY + + mySerial.println(formatString("hV * Use PDLS_EXT3_%s_%s instead", "Basic", "BWRY")); + break; + + default: + + mySerial.println(formatString("hV * Use PDLS_EXT3_%s_%s instead", "Basic", "Global")); + break; + } // u_codeFilm + + while (0x01); +} diff --git a/src/hV_Utilities_PDLS.h b/src/hV_Utilities_PDLS.h index 94db69f..2339878 100755 --- a/src/hV_Utilities_PDLS.h +++ b/src/hV_Utilities_PDLS.h @@ -8,8 +8,8 @@ /// * Edition: Advanced /// /// @author Rei Vilo -/// @date 21 Mar 2024 -/// @version 801 +/// @date 21 May 2024 +/// @version 803 /// /// @copyright (c) Rei Vilo, 2010-2024 /// @copyright All rights reserved @@ -51,8 +51,8 @@ #error Required hV_HAL_PERIPHERALS_RELEASE 801 #endif // hV_HAL_PERIPHERALS_RELEASE -#if (hV_CONFIGURATION_RELEASE < 801) -#error Required hV_CONFIGURATION_RELEASE 801 +#if (hV_CONFIGURATION_RELEASE < 803) +#error Required hV_CONFIGURATION_RELEASE 803 #endif // hV_CONFIGURATION_RELEASE #if (hV_BOARD_RELEASE < 801) @@ -63,7 +63,7 @@ /// /// @brief Library release number /// -#define hV_UTILITIES_PDLS_RELEASE 801 +#define hV_UTILITIES_PDLS_RELEASE 803 // Objects // @@ -123,7 +123,14 @@ class hV_Utilities_PDLS : public hV_Board /// @brief Screen number /// @return Screen number as string /// - virtual String screenNumber(); + virtual STRING_TYPE screenNumber(); + + /// + /// @brief Recommend variant for film + /// @param uint8_t Context film + /// @note exit() called after + /// + void debugVariant(uint8_t contextFilm); /// @cond protected: @@ -154,7 +161,7 @@ class hV_Utilities_PDLS : public hV_Board uint8_t u_codeDriver; uint8_t u_codeExtra; uint16_t u_bufferSizeV, u_bufferSizeH, u_bufferDepth; - uint32_t u_pageColourSize, u_frameSize; + uint32_t u_pageColourSize; bool u_invert = false; bool u_flagOTP = false;