|
@ -1057,6 +1057,8 @@ void CLCD::init() { |
|
|
host_cmd(Use_Crystal ? CLKEXT : CLKINT, 0); |
|
|
host_cmd(Use_Crystal ? CLKEXT : CLKINT, 0); |
|
|
host_cmd(FTDI::ACTIVE, 0); // Activate the System Clock
|
|
|
host_cmd(FTDI::ACTIVE, 0); // Activate the System Clock
|
|
|
|
|
|
|
|
|
|
|
|
delay(40); // FTDI/BRT recommendation: no SPI traffic during startup. EVE needs at the very least 45ms to start, so leave her alone for a little while.
|
|
|
|
|
|
|
|
|
/* read the device-id until it returns 0x7c or times out, should take less than 150ms */ |
|
|
/* read the device-id until it returns 0x7c or times out, should take less than 150ms */ |
|
|
uint8_t counter; |
|
|
uint8_t counter; |
|
|
for (counter = 0; counter < 250; counter++) { |
|
|
for (counter = 0; counter < 250; counter++) { |
|
@ -1078,6 +1080,24 @@ void CLCD::init() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* make sure that all units are in working conditions, usually the touch-controller needs a little more time */ |
|
|
|
|
|
for (counter = 0; counter < 100; counter++) { |
|
|
|
|
|
uint8_t reset_status = mem_read_8(REG::CPURESET) & 0x03; |
|
|
|
|
|
if (reset_status == 0x00) { |
|
|
|
|
|
#if ENABLED(TOUCH_UI_DEBUG) |
|
|
|
|
|
SERIAL_ECHO_MSG("FTDI chip all units running "); |
|
|
|
|
|
#endif |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
delay(1); |
|
|
|
|
|
|
|
|
|
|
|
if (ENABLED(TOUCH_UI_DEBUG) && counter == 99) { |
|
|
|
|
|
SERIAL_ECHO_START(); |
|
|
|
|
|
SERIAL_ECHOLNPAIR("Timeout waiting for reset status. Should be 0x00, got ", reset_status); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
mem_write_8(REG::PWM_DUTY, 0); // turn off Backlight, Frequency already is set to 250Hz default
|
|
|
mem_write_8(REG::PWM_DUTY, 0); // turn off Backlight, Frequency already is set to 250Hz default
|
|
|
|
|
|
|
|
|
/* Configure the FT8xx Registers */ |
|
|
/* Configure the FT8xx Registers */ |
|
@ -1129,9 +1149,6 @@ void CLCD::init() { |
|
|
// Turning off dithering seems to help prevent horizontal line artifacts on certain colors
|
|
|
// Turning off dithering seems to help prevent horizontal line artifacts on certain colors
|
|
|
mem_write_8(REG::DITHER, 0); |
|
|
mem_write_8(REG::DITHER, 0); |
|
|
|
|
|
|
|
|
// Initialize the command FIFO
|
|
|
|
|
|
CommandFifo::reset(); |
|
|
|
|
|
|
|
|
|
|
|
default_touch_transform(); |
|
|
default_touch_transform(); |
|
|
default_display_orientation(); |
|
|
default_display_orientation(); |
|
|
} |
|
|
} |
|
@ -1151,7 +1168,6 @@ void CLCD::default_display_orientation() { |
|
|
#if FTDI_API_LEVEL >= 810 |
|
|
#if FTDI_API_LEVEL >= 810 |
|
|
// Set the initial display orientation. On the FT810, we use the command
|
|
|
// Set the initial display orientation. On the FT810, we use the command
|
|
|
// processor to do this since it will also update the transform matrices.
|
|
|
// processor to do this since it will also update the transform matrices.
|
|
|
if (FTDI::ftdi_chip >= 810) { |
|
|
|
|
|
CommandFifo cmd; |
|
|
CommandFifo cmd; |
|
|
cmd.setrotate( |
|
|
cmd.setrotate( |
|
|
ENABLED(TOUCH_UI_MIRRORED) * 4 |
|
|
ENABLED(TOUCH_UI_MIRRORED) * 4 |
|
@ -1159,9 +1175,6 @@ void CLCD::default_display_orientation() { |
|
|
+ ENABLED(TOUCH_UI_INVERTED) * 1 |
|
|
+ ENABLED(TOUCH_UI_INVERTED) * 1 |
|
|
); |
|
|
); |
|
|
cmd.execute(); |
|
|
cmd.execute(); |
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
TERN_(TOUCH_UI_INVERTED, mem_write_32(REG::ROTATE, 1)); |
|
|
|
|
|
#elif ANY(TOUCH_UI_PORTRAIT, TOUCH_UI_MIRRORED) |
|
|
#elif ANY(TOUCH_UI_PORTRAIT, TOUCH_UI_MIRRORED) |
|
|
#error "PORTRAIT or MIRRORED orientation not supported on the FT800." |
|
|
#error "PORTRAIT or MIRRORED orientation not supported on the FT800." |
|
|
#elif ENABLED(TOUCH_UI_INVERTED) |
|
|
#elif ENABLED(TOUCH_UI_INVERTED) |
|
|