dynamic changes, rsen working, still no t1

This commit is contained in:
Piotr Dobrowolski 2018-06-26 13:39:09 +02:00
parent 9d2cb3ad5e
commit 863ff46105

View File

@ -176,6 +176,13 @@ void select_output(char output)
}
uint8_t matrixInit() {
debugf("Logic reset...");
i2cWrite(0x64, 0x40, 0x08);
delay(500);
debugf("Reset, clearing...");
i2cWrite(0x64, 0x40, 0x00);
setEDID(0, edidbuf);
setEDID(1, edidbuf);
setEDID(2, edidbuf);
@ -191,10 +198,10 @@ uint8_t matrixInit() {
i2cWrite(0x64, 0x46, 0xe4);
i2cWrite(0x64, 0x47, 0x80);
i2cWrite(0x64, 0x48, 0x04);
i2cWrite(0x64, 0x49, 0b10110100);
i2cWrite(0x64, 0x4a, 0xff);
i2cWrite(0x64, 0x49, 0b01110000);
i2cWrite(0x64, 0x4a, 0xcf); // 0xff
//i2cWrite(0x64, 0x49, 0xc0);
i2cWrite(0x64, 0x4b, 0x24);
i2cWrite(0x64, 0x4b, 0b111111);
uint8_t err;
uint8_t physettings[4] = {0x4c, 0x02, 0x50, 0x00};
@ -205,7 +212,15 @@ uint8_t matrixInit() {
physettings[0] = 0x4d;
physettings[1] = 0x16;
physettings[2] = 0x21;
physettings[2] = 0x41;
if ((err = twi_writeTo(0x64, physettings, 3, true)) != 0) {
Serial.printf("txphy write failed: %d\r\n", err);
}
Serial.printf("discharging txphy...");
delay(1000);
physettings[2] = 0x01;
if ((err = twi_writeTo(0x64, physettings, 3, true)) != 0) {
Serial.printf("txphy write failed: %d\r\n", err);
@ -249,7 +264,13 @@ void init()
{
Serial.begin(SERIAL_BAUD_RATE); // 115200 by default
Serial.systemDebugOutput(true); // Disable debug output
Serial.setCallback(*[](Stream& src, char arrived, uint16_t available) {
debugf("arrived: %02x", arrived);
input_a = (arrived - 0x31) & 0x3;
input_b = (arrived - 0x31) & 0x3;
debugf("setting: %d", input_a);
i2cWrite(0x64, 0x49, (0b01010000 | 0) | (input_b << 2));
});
WDT.enable(false); // First (but not the best) option: fully disable watch dog timer
// Default I2C pins (SDA: 2, SCL:0)
@ -338,6 +359,9 @@ void init()
if (status4 & 0x02) Serial.printf("ri_rdy ");
if (status4 & 0x10) Serial.printf("rptr ");
uint8_t status5 = i2cRead(0x65, 0x0e);
if (status5 & 0x01) Serial.printf("hdmi ");
Serial.printf("[%02x ", i2cRead(0x65, 0x07));
Serial.printf("%02x ", i2cRead(0x65, 0x08));
Serial.printf("%02x ", i2cRead(0x65, 0x09));