Unverified Commit 4bbf0751 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

pervasive aurora mb: add initialization code for flashless updates

parent 9e909994
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -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();
+79 −6
Original line number Diff line number Diff line
/*
 * 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"
	if (flashless) {
		spiWrite(0x00, (const unsigned char[]){0x3f}, 1);
	} else {
		spiWrite(0x00, (const unsigned char[]){0x0f}, 1);

	// "Panel Settings"
	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"
	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)