From 4bbf07511979f3f918e316e80ba36ebac7f2bf9d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 31 Oct 2021 17:16:34 +0100 Subject: pervasive aurora mb: add initialization code for flashless updates --- include/driver/pervasive_aurora_mb.h | 12 ++++- src/driver/pervasive_aurora_mb.cc | 85 +++++++++++++++++++++++++++++++++--- 2 files changed, 90 insertions(+), 7 deletions(-) diff --git a/include/driver/pervasive_aurora_mb.h b/include/driver/pervasive_aurora_mb.h index 9d0bc86..558cba1 100644 --- a/include/driver/pervasive_aurora_mb.h +++ b/include/driver/pervasive_aurora_mb.h @@ -21,7 +21,17 @@ class PervasiveAuroraMb { void setup(); void powerOn(); - void initialize(signed char temperature = 20); + + /** + * Initializes the display + * @param temperature specify ambient temperature, defaults to 20 deg C + * @param flashless perform (fast) flashless updates. Note that this + * is not officially documented and, as far as I know, + * _perminantly_ alters the display's internal look-up tables. It + * may damage your display in the long run. Use at your own risk. + */ + void initialize(signed char temperature = 20, bool flashless = false); + void sendImage(unsigned char *frame, unsigned int x = 0, unsigned int y = 0, unsigned int w = 0, unsigned int h = 0); void sendUpdate(); void powerOff(); diff --git a/src/driver/pervasive_aurora_mb.cc b/src/driver/pervasive_aurora_mb.cc index b422916..0e14437 100644 --- a/src/driver/pervasive_aurora_mb.cc +++ b/src/driver/pervasive_aurora_mb.cc @@ -1,5 +1,6 @@ /* * Copyright 2021 Daniel Friesel + * Copyright 2021 Amar Memic * * SPDX-License-Identifier: BSD-2-Clause * @@ -31,7 +32,7 @@ void PervasiveAuroraMb::powerOn() gpio.write(PERVASIVE_AURORA_CS_PIN, 1); } -void PervasiveAuroraMb::initialize(signed char temperature) +void PervasiveAuroraMb::initialize(signed char temperature, bool flashless) { // "Input Temperature" spiWrite(0xe5, (const unsigned char*)&temperature, 1); @@ -40,10 +41,11 @@ void PervasiveAuroraMb::initialize(signed char temperature) spiWrite(0xe0, (const unsigned char[]){0x02}, 1); // "Panel Settings" - spiWrite(0x00, (const unsigned char[]){0x0f}, 1); - - // "Panel Settings" - spiWrite(0x00, (const unsigned char[]){0x0f}, 1); + if (flashless) { + spiWrite(0x00, (const unsigned char[]){0x3f}, 1); + } else { + spiWrite(0x00, (const unsigned char[]){0x0f}, 1); + } // "Booster soft start settings" spiWrite(0x06, (const unsigned char[]){0x17, 0x17, 0x27}, 3); @@ -52,10 +54,81 @@ void PervasiveAuroraMb::initialize(signed char temperature) spiWrite(0x61, (const unsigned char[]){0x01, 0x90, 0x01, 0x2c}, 4); // "Vcom and data interval setting" - spiWrite(0x50, (const unsigned char[]){0x87}, 1); + if (flashless) { + spiWrite(0x50, (const unsigned char[]){0x80}, 1); + } else { + spiWrite(0x50, (const unsigned char[]){0x87}, 1); + } // "Power Saving" spiWrite(0xe3, (const unsigned char[]){0x88}, 1); + + if (flashless) { + // PLL + spiWrite(0x30, (const unsigned char[]){0x3d}, 1); + + // VCom DC + spiWrite(0x82, (const unsigned char[]){0x0e}, 1); + + // TCon + spiWrite(0x60, (const unsigned char[]){0x00}, 1); + + // VCom LUT + spiWrite(0x20, (const unsigned char[]){ + 0x00, 0x06, 0x06, 0x06, 0x06, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 + }, 44); + + // W2B LUT + spiWrite(0x23, (const unsigned char[]){ + 0xaa, 0x06, 0x06, 0x06, 0x06, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, 42); + + // B2W LUT + spiWrite(0x22, (const unsigned char[]){ + 0x55, 0x06, 0x06, 0x06, 0x06, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, 42); + + // W2W LUT + spiWrite(0x21, (const unsigned char[]){ + 0x00, 0x06, 0x06, 0x06, 0x06, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, 42); + + // B2B LUT + spiWrite(0x24, (const unsigned char[]){ + 0xff, 0x06, 0x06, 0x06, 0x06, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, 42); + } } void PervasiveAuroraMb::sendImage(unsigned char *frame, unsigned int x, unsigned int y, unsigned int w, unsigned int h) -- cgit v1.2.3