Fixes for FYSETC Touch EVE 5" on AVR (#17659)

Co-Authored-By: RudolphRiedel <rudolphriedel@users.noreply.github.com>
Co-authored-by: sL1pKn07 <sl1pkn07@gmail.com>
This commit is contained in:
Scott Lahteine
2020-04-24 22:35:46 -05:00
committed by GitHub
parent d7f90c36df
commit 3a27933ae7
12 changed files with 294 additions and 111 deletions

View File

@ -58,7 +58,7 @@ void CLCD::FontMetrics::load(const uint8_t font) {
uint16_t CLCD::FontMetrics::get_text_width(const char *str, size_t n) const {
uint16_t width = 0;
const uint8_t *p = (const uint8_t *) str;
for(;;) {
for (;;) {
const uint8_t val = *p++; n--;
if (!val || n == 0) break;
width += val < 128 ? char_widths[val] : 0;
@ -69,7 +69,7 @@ uint16_t CLCD::FontMetrics::get_text_width(const char *str, size_t n) const {
uint16_t CLCD::FontMetrics::get_text_width(progmem_str str, size_t n) const {
uint16_t width = 0;
const uint8_t *p = (const uint8_t *) str;
for(;;) {
for (;;) {
const uint8_t val = pgm_read_byte(p++); n--;
if (!val || n == 0) break;
width += val < 128 ? char_widths[val] : 0;
@ -79,7 +79,7 @@ uint16_t CLCD::FontMetrics::get_text_width(progmem_str str, size_t n) const {
/************************** HOST COMMAND FUNCTION *********************************/
void CLCD::host_cmd (unsigned char host_command, unsigned char byte2) { // Sends 24-Bit Host Command to LCD
void CLCD::host_cmd(unsigned char host_command, unsigned char byte2) { // Sends 24-Bit Host Command to LCD
if (host_command != FTDI::ACTIVE) {
host_command |= 0x40;
}
@ -92,7 +92,7 @@ void CLCD::host_cmd (unsigned char host_command, unsigned char byte2) { // Send
/************************** MEMORY READ FUNCTIONS *********************************/
void CLCD::spi_read_addr (uint32_t reg_address) {
void CLCD::spi_read_addr(uint32_t reg_address) {
spi_send((reg_address >> 16) & 0x3F); // Address [21:16]
spi_send((reg_address >> 8 ) & 0xFF); // Address [15:8]
spi_send((reg_address >> 0) & 0xFF); // Address [7:0]
@ -100,7 +100,7 @@ void CLCD::spi_read_addr (uint32_t reg_address) {
}
// Write 4-Byte Address, Read Multiple Bytes
void CLCD::mem_read_bulk (uint32_t reg_address, uint8_t *data, uint16_t len) {
void CLCD::mem_read_bulk(uint32_t reg_address, uint8_t *data, uint16_t len) {
spi_ftdi_select();
spi_read_addr(reg_address);
spi_read_bulk (data, len);
@ -108,7 +108,7 @@ void CLCD::mem_read_bulk (uint32_t reg_address, uint8_t *data, uint16_t len) {
}
// Write 4-Byte Address, Read 1-Byte Data
uint8_t CLCD::mem_read_8 (uint32_t reg_address) {
uint8_t CLCD::mem_read_8(uint32_t reg_address) {
spi_ftdi_select();
spi_read_addr(reg_address);
uint8_t r_data = spi_read_8();
@ -117,7 +117,7 @@ uint8_t CLCD::mem_read_8 (uint32_t reg_address) {
}
// Write 4-Byte Address, Read 2-Bytes Data
uint16_t CLCD::mem_read_16 (uint32_t reg_address) {
uint16_t CLCD::mem_read_16(uint32_t reg_address) {
using namespace SPI::least_significant_byte_first;
spi_ftdi_select();
spi_read_addr(reg_address);
@ -127,7 +127,7 @@ uint16_t CLCD::mem_read_16 (uint32_t reg_address) {
}
// Write 4-Byte Address, Read 4-Bytes Data
uint32_t CLCD::mem_read_32 (uint32_t reg_address) {
uint32_t CLCD::mem_read_32(uint32_t reg_address) {
using namespace SPI::least_significant_byte_first;
spi_ftdi_select();
spi_read_addr(reg_address);
@ -147,14 +147,14 @@ static inline uint8_t reverse_byte(uint8_t a) {
}
static inline uint8_t xbm_write(const uint8_t *p) {return reverse_byte(pgm_read_byte(p));}
void CLCD::spi_write_addr (uint32_t reg_address) {
void CLCD::spi_write_addr(uint32_t reg_address) {
spi_send((reg_address >> 16) | 0x80); // Address [21:16]
spi_send((reg_address >> 8 ) & 0xFF); // Address [15:8]
spi_send((reg_address >> 0) & 0xFF); // Address [7:0]
}
// Write 3-Byte Address, Multiple Bytes, plus padding bytes, from RAM
void CLCD::mem_write_bulk (uint32_t reg_address, const void *data, uint16_t len, uint8_t padding) {
void CLCD::mem_write_bulk(uint32_t reg_address, const void *data, uint16_t len, uint8_t padding) {
spi_ftdi_select();
spi_write_addr(reg_address);
spi_write_bulk<ram_write>(data, len, padding);
@ -162,7 +162,7 @@ void CLCD::mem_write_bulk (uint32_t reg_address, const void *data, uint16_t len,
}
// Write 3-Byte Address, Multiple Bytes, plus padding bytes, from PROGMEM
void CLCD::mem_write_bulk (uint32_t reg_address, progmem_str str, uint16_t len, uint8_t padding) {
void CLCD::mem_write_bulk(uint32_t reg_address, progmem_str str, uint16_t len, uint8_t padding) {
spi_ftdi_select();
spi_write_addr(reg_address);
spi_write_bulk<pgm_write>(str, len, padding);
@ -170,7 +170,7 @@ void CLCD::mem_write_bulk (uint32_t reg_address, progmem_str str, uint16_t len,
}
// Write 3-Byte Address, Multiple Bytes, plus padding bytes, from PROGMEM
void CLCD::mem_write_pgm (uint32_t reg_address, const void *data, uint16_t len, uint8_t padding) {
void CLCD::mem_write_pgm(uint32_t reg_address, const void *data, uint16_t len, uint8_t padding) {
spi_ftdi_select();
spi_write_addr(reg_address);
spi_write_bulk<pgm_write>(data, len, padding);
@ -178,7 +178,7 @@ void CLCD::mem_write_pgm (uint32_t reg_address, const void *data, uint16_t len,
}
// Write 3-Byte Address, Multiple Bytes, plus padding bytes, from PROGMEM, reversing bytes (suitable for loading XBM images)
void CLCD::mem_write_xbm (uint32_t reg_address, progmem_str data, uint16_t len, uint8_t padding) {
void CLCD::mem_write_xbm(uint32_t reg_address, progmem_str data, uint16_t len, uint8_t padding) {
spi_ftdi_select();
spi_write_addr(reg_address);
spi_write_bulk<xbm_write>(data, len, padding);
@ -186,7 +186,7 @@ void CLCD::mem_write_xbm (uint32_t reg_address, progmem_str data, uint16_t len,
}
// Write 3-Byte Address, Write 1-Byte Data
void CLCD::mem_write_8 (uint32_t reg_address, uint8_t data) {
void CLCD::mem_write_8(uint32_t reg_address, uint8_t data) {
spi_ftdi_select();
spi_write_addr(reg_address);
spi_write_8(data);
@ -194,16 +194,16 @@ void CLCD::mem_write_8 (uint32_t reg_address, uint8_t data) {
}
// Write 3-Byte Address, Write 2-Bytes Data
void CLCD::mem_write_16 (uint32_t reg_address, uint16_t data) {
void CLCD::mem_write_16(uint32_t reg_address, uint16_t data) {
using namespace SPI::least_significant_byte_first;
spi_ftdi_select();
spi_write_addr(reg_address);
spi_write_32(data);
spi_write_16(data);
spi_ftdi_deselect();
}
// Write 3-Byte Address, Write 4-Bytes Data
void CLCD::mem_write_32 (uint32_t reg_address, uint32_t data) {
void CLCD::mem_write_32(uint32_t reg_address, uint32_t data) {
using namespace SPI::least_significant_byte_first;
spi_ftdi_select();
spi_write_addr(reg_address);
@ -281,7 +281,7 @@ void CLCD::CommandFifo::text(int16_t x, int16_t y, int16_t font, uint16_t optio
}
// This sends the a toggle command to the command preprocessor, must be followed by str()
void CLCD::CommandFifo::toggle (int16_t x, int16_t y, int16_t w, int16_t font, uint16_t options, bool state) {
void CLCD::CommandFifo::toggle(int16_t x, int16_t y, int16_t w, int16_t font, uint16_t options, bool state) {
struct {
int32_t type = CMD_TOGGLE;
int16_t x;
@ -303,7 +303,7 @@ void CLCD::CommandFifo::toggle (int16_t x, int16_t y, int16_t w, int16_t font, u
}
// This sends the a keys command to the command preprocessor, must be followed by str()
void CLCD::CommandFifo::keys (int16_t x, int16_t y, int16_t w, int16_t h, int16_t font, uint16_t options) {
void CLCD::CommandFifo::keys(int16_t x, int16_t y, int16_t w, int16_t h, int16_t font, uint16_t options) {
struct {
int32_t type = CMD_KEYS;
int16_t x;
@ -324,7 +324,7 @@ void CLCD::CommandFifo::keys (int16_t x, int16_t y, int16_t w, int16_t h, int16_
cmd( &cmd_data, sizeof(cmd_data) );
}
void CLCD::CommandFifo::clock (int16_t x, int16_t y, int16_t r, uint16_t options, int16_t h, int16_t m, int16_t s, int16_t ms)
void CLCD::CommandFifo::clock(int16_t x, int16_t y, int16_t r, uint16_t options, int16_t h, int16_t m, int16_t s, int16_t ms)
{
struct {
int32_t type = CMD_CLOCK;
@ -350,7 +350,7 @@ void CLCD::CommandFifo::clock (int16_t x, int16_t y, int16_t r, uint16_t options
cmd( &cmd_data, sizeof(cmd_data) );
}
void CLCD::CommandFifo::gauge (int16_t x, int16_t y, int16_t r, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range)
void CLCD::CommandFifo::gauge(int16_t x, int16_t y, int16_t r, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range)
{
struct {
int32_t type = CMD_GAUGE;
@ -376,7 +376,7 @@ void CLCD::CommandFifo::gauge (int16_t x, int16_t y, int16_t r, uint16_t options
cmd( &cmd_data, sizeof(cmd_data) );
}
void CLCD::CommandFifo::dial (int16_t x, int16_t y, int16_t r, uint16_t options, uint16_t val)
void CLCD::CommandFifo::dial(int16_t x, int16_t y, int16_t r, uint16_t options, uint16_t val)
{
struct {
int32_t type = CMD_DIAL;
@ -396,7 +396,7 @@ void CLCD::CommandFifo::dial (int16_t x, int16_t y, int16_t r, uint16_t options,
cmd( &cmd_data, sizeof(cmd_data) );
}
void CLCD::CommandFifo::scrollbar (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t size, uint16_t range) {
void CLCD::CommandFifo::scrollbar(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t size, uint16_t range) {
struct {
int32_t type = CMD_SCROLLBAR;
int16_t x;
@ -421,7 +421,7 @@ void CLCD::CommandFifo::scrollbar (int16_t x, int16_t y, int16_t w, int16_t h, u
cmd( &cmd_data, sizeof(cmd_data) );
}
void CLCD::CommandFifo::progress (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t range) {
void CLCD::CommandFifo::progress(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t range) {
struct {
int32_t type = CMD_PROGRESS;
int16_t x;
@ -444,7 +444,7 @@ void CLCD::CommandFifo::progress (int16_t x, int16_t y, int16_t w, int16_t h, ui
cmd( &cmd_data, sizeof(cmd_data) );
}
void CLCD::CommandFifo::slider (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t range) {
void CLCD::CommandFifo::slider(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t range) {
struct {
int32_t type = CMD_SLIDER;
int16_t x;
@ -467,7 +467,7 @@ void CLCD::CommandFifo::slider (int16_t x, int16_t y, int16_t w, int16_t h, uint
cmd( &cmd_data, sizeof(cmd_data) );
}
void CLCD::CommandFifo::gradient (int16_t x0, int16_t y0, uint32_t rgb0, int16_t x1, int16_t y1, uint32_t rgb1) {
void CLCD::CommandFifo::gradient(int16_t x0, int16_t y0, uint32_t rgb0, int16_t x1, int16_t y1, uint32_t rgb1) {
struct {
int32_t type = CMD_GRADIENT;
int16_t x0;
@ -488,7 +488,7 @@ void CLCD::CommandFifo::gradient (int16_t x0, int16_t y0, uint32_t rgb0, int16_t
cmd( &cmd_data, sizeof(cmd_data) );
}
void CLCD::CommandFifo::number (int16_t x, int16_t y, int16_t font, uint16_t options, int32_t n) {
void CLCD::CommandFifo::number(int16_t x, int16_t y, int16_t font, uint16_t options, int32_t n) {
struct {
int32_t type = CMD_NUMBER;
int16_t x;
@ -507,7 +507,7 @@ void CLCD::CommandFifo::number (int16_t x, int16_t y, int16_t font, uint16_t opt
cmd( &cmd_data, sizeof(cmd_data) );
}
void CLCD::CommandFifo::memzero (uint32_t ptr, uint32_t size) {
void CLCD::CommandFifo::memzero(uint32_t ptr, uint32_t size) {
struct {
uint32_t type = CMD_MEMZERO;
uint32_t ptr;
@ -520,7 +520,7 @@ void CLCD::CommandFifo::memzero (uint32_t ptr, uint32_t size) {
cmd( &cmd_data, sizeof(cmd_data) );
}
void CLCD::CommandFifo::memset (uint32_t ptr, uint32_t val, uint32_t size) {
void CLCD::CommandFifo::memset(uint32_t ptr, uint32_t val, uint32_t size) {
struct {
uint32_t type = CMD_MEMSET;
uint32_t ptr;
@ -535,7 +535,7 @@ void CLCD::CommandFifo::memset (uint32_t ptr, uint32_t val, uint32_t size) {
cmd( &cmd_data, sizeof(cmd_data) );
}
void CLCD::CommandFifo::memcpy (uint32_t dst, uint32_t src, uint32_t size) {
void CLCD::CommandFifo::memcpy(uint32_t dst, uint32_t src, uint32_t size) {
struct {
uint32_t type = CMD_MEMCPY;
uint32_t dst;
@ -550,7 +550,7 @@ void CLCD::CommandFifo::memcpy (uint32_t dst, uint32_t src, uint32_t size) {
cmd( &cmd_data, sizeof(cmd_data) );
}
void CLCD::CommandFifo::memcrc (uint32_t ptr, uint32_t num, uint32_t result) {
void CLCD::CommandFifo::memcrc(uint32_t ptr, uint32_t num, uint32_t result) {
struct {
uint32_t type = CMD_MEMCRC;
uint32_t ptr;
@ -565,7 +565,7 @@ void CLCD::CommandFifo::memcrc (uint32_t ptr, uint32_t num, uint32_t result) {
cmd( &cmd_data, sizeof(cmd_data) );
}
void CLCD::CommandFifo::memwrite (uint32_t ptr, uint32_t value) {
void CLCD::CommandFifo::memwrite(uint32_t ptr, uint32_t value) {
struct {
uint32_t type = CMD_MEMWRITE;
uint32_t ptr;
@ -580,7 +580,7 @@ void CLCD::CommandFifo::memwrite (uint32_t ptr, uint32_t value) {
cmd( &cmd_data, sizeof(cmd_data) );
}
void CLCD::CommandFifo::append (uint32_t ptr, uint32_t size) {
void CLCD::CommandFifo::append(uint32_t ptr, uint32_t size) {
struct {
uint32_t type = CMD_APPEND;
uint32_t ptr;
@ -593,7 +593,7 @@ void CLCD::CommandFifo::append (uint32_t ptr, uint32_t size) {
cmd( &cmd_data, sizeof(cmd_data) );
}
void CLCD::CommandFifo::inflate (uint32_t ptr) {
void CLCD::CommandFifo::inflate(uint32_t ptr) {
struct {
uint32_t type = CMD_INFLATE;
uint32_t ptr;
@ -604,7 +604,7 @@ void CLCD::CommandFifo::inflate (uint32_t ptr) {
cmd( &cmd_data, sizeof(cmd_data) );
}
void CLCD::CommandFifo::getptr (uint32_t result) {
void CLCD::CommandFifo::getptr(uint32_t result) {
struct {
uint32_t type = CMD_GETPTR;
uint32_t result;
@ -696,7 +696,7 @@ void CLCD::CommandFifo::loadimage(uint32_t ptr, uint32_t options) {
cmd( &cmd_data, sizeof(cmd_data) );
}
void CLCD::CommandFifo::getprops (uint32_t ptr, uint32_t width, uint32_t height) {
void CLCD::CommandFifo::getprops(uint32_t ptr, uint32_t width, uint32_t height) {
struct {
uint32_t type = CMD_GETPROPS;
uint32_t ptr;
@ -735,7 +735,7 @@ void CLCD::CommandFifo::rotate(int32_t a) {
cmd( &cmd_data, sizeof(cmd_data) );
}
void CLCD::CommandFifo::translate (int32_t tx, int32_t ty) {
void CLCD::CommandFifo::translate(int32_t tx, int32_t ty) {
struct {
uint32_t type = CMD_TRANSLATE;
int32_t tx;
@ -749,7 +749,7 @@ void CLCD::CommandFifo::translate (int32_t tx, int32_t ty) {
}
#if FTDI_API_LEVEL >= 810
void CLCD::CommandFifo::setbase (uint8_t base) {
void CLCD::CommandFifo::setbase(uint8_t base) {
struct {
int32_t type = CMD_SETBASE;
uint32_t base;
@ -855,7 +855,7 @@ void CLCD::CommandFifo::playvideo(uint32_t options) {
#endif
#if FTDI_API_LEVEL >= 810
void CLCD::CommandFifo::setrotate (uint8_t rotation) {
void CLCD::CommandFifo::setrotate(uint8_t rotation) {
struct {
uint32_t type = CMD_SETROTATE;
uint32_t rotation;
@ -868,7 +868,7 @@ void CLCD::CommandFifo::setrotate (uint8_t rotation) {
#endif
#if FTDI_API_LEVEL >= 810
void CLCD::CommandFifo::romfont (uint8_t font, uint8_t romslot) {
void CLCD::CommandFifo::romfont(uint8_t font, uint8_t romslot) {
struct {
uint32_t type = CMD_ROMFONT;
uint32_t font;
@ -1054,18 +1054,12 @@ void CLCD::init() {
spi_init(); // Set Up I/O Lines for SPI and FT800/810 Control
ftdi_reset(); // Power down/up the FT8xx with the apropriate delays
if (Use_Crystal == 1) {
host_cmd(CLKEXT, 0);
}
else {
host_cmd(CLKINT, 0);
}
host_cmd(Use_Crystal ? CLKEXT : CLKINT, 0);
host_cmd(FTDI::ACTIVE, 0); // Activate the System Clock
/* read the device-id until it returns 0x7c or times out, should take less than 150ms */
uint8_t counter;
for(counter = 0; counter < 250; counter++) {
for (counter = 0; counter < 250; counter++) {
uint8_t device_id = mem_read_8(REG::ID); // Read Device ID, Should Be 0x7C;
if (device_id == 0x7c) {
#if ENABLED(TOUCH_UI_DEBUG)
@ -1073,9 +1067,9 @@ void CLCD::init() {
#endif
break;
}
else {
else
delay(1);
}
if (counter == 249) {
#if ENABLED(TOUCH_UI_DEBUG)
SERIAL_ECHO_START();
@ -1130,7 +1124,7 @@ void CLCD::init() {
mem_write_8(REG::PCLK, Pclk); // Turns on Clock by setting PCLK Register to the value necessary for the module
mem_write_16(REG::PWM_HZ, 0x00FA);
mem_write_16(REG::PWM_HZ, ENABLED(LCD_FYSETC_TFT81050) ? 0x2710 : 0x00FA);
// Turning off dithering seems to help prevent horizontal line artifacts on certain colors
mem_write_8(REG::DITHER, 0);

View File

@ -27,7 +27,11 @@
/********************************* SPI Functions *********************************/
namespace FTDI {
#ifndef CLCD_USE_SOFT_SPI
#ifndef __AVR__
SPIClass EVE_SPI(CLCD_SPI_BUS);
#endif
SPISettings SPI::spi_settings(SPI_FREQUENCY, MSBFIRST, SPI_MODE0);
#endif
@ -57,12 +61,12 @@ namespace FTDI {
SET_INPUT_PULLUP(CLCD_SOFT_SPI_MISO);
#else
::SPI.begin();
SPI_OBJ.begin();
#endif
}
#ifdef CLCD_USE_SOFT_SPI
uint8_t SPI::_soft_spi_xfer (uint8_t spiOutByte) {
uint8_t SPI::_soft_spi_xfer(uint8_t spiOutByte) {
uint8_t spiIndex = 0x80;
uint8_t spiInByte = 0;
uint8_t k;
@ -71,8 +75,8 @@ namespace FTDI {
for (k = 0; k < 8; k++) { // Output and Read each bit of spiOutByte and spiInByte
WRITE(CLCD_SOFT_SPI_MOSI, (spiOutByte & spiIndex) ? 1 : 0); // Output MOSI Bit
WRITE(CLCD_SOFT_SPI_SCLK, 1); // Pulse Clock
if (READ(CLCD_SOFT_SPI_MISO)) spiInByte |= spiIndex; // MISO changes on the falling edge of clock, so sample it before
WRITE(CLCD_SOFT_SPI_SCLK, 0);
if (READ(CLCD_SOFT_SPI_MISO)) spiInByte |= spiIndex;
spiIndex >>= 1;
}
interrupts();
@ -81,7 +85,7 @@ namespace FTDI {
#endif
#ifdef CLCD_USE_SOFT_SPI
void SPI::_soft_spi_send (uint8_t spiOutByte) {
void SPI::_soft_spi_send(uint8_t spiOutByte) {
uint8_t k, spiIndex = 0x80;
noInterrupts();
@ -95,16 +99,12 @@ namespace FTDI {
}
#endif
void SPI::spi_read_bulk (void *data, uint16_t len) {
void SPI::spi_read_bulk(void *data, uint16_t len) {
uint8_t* p = (uint8_t *)data;
#ifndef CLCD_USE_SOFT_SPI
::SPI.transfer(p, len);
#else
while (len--) *p++ = spi_recv();
#endif
while (len--) *p++ = spi_recv();
}
bool SPI::spi_verify_bulk (const void *data, uint16_t len) {
bool SPI::spi_verify_bulk(const void *data, uint16_t len) {
const uint8_t* p = (const uint8_t *)data;
while (len--) if (*p++ != spi_recv()) return false;
return true;
@ -113,7 +113,7 @@ namespace FTDI {
// CLCD SPI - Chip Select
void SPI::spi_ftdi_select() {
#ifndef CLCD_USE_SOFT_SPI
::SPI.beginTransaction(spi_settings);
SPI_OBJ.beginTransaction(spi_settings);
#endif
WRITE(CLCD_SPI_CS, 0);
#ifdef CLCD_SPI_EXTRA_CS
@ -129,25 +129,25 @@ namespace FTDI {
WRITE(CLCD_SPI_EXTRA_CS, 1);
#endif
#ifndef CLCD_USE_SOFT_SPI
::SPI.endTransaction();
SPI_OBJ.endTransaction();
#endif
}
#ifdef SPI_FLASH_SS
// Serial SPI Flash SPI - Chip Select
void SPI::spi_flash_select () {
void SPI::spi_flash_select() {
#ifndef CLCD_USE_SOFT_SPI
::SPI.beginTransaction(spi_settings);
SPI_OBJ.beginTransaction(spi_settings);
#endif
WRITE(SPI_FLASH_SS, 0);
delayMicroseconds(1);
}
// Serial SPI Flash SPI - Chip Deselect
void SPI::spi_flash_deselect () {
void SPI::spi_flash_deselect() {
WRITE(SPI_FLASH_SS, 1);
#ifndef CLCD_USE_SOFT_SPI
::SPI.endTransaction();
SPI_OBJ.endTransaction();
#endif
}
#endif

View File

@ -27,6 +27,14 @@
#endif
namespace FTDI {
#if defined(__AVR__) || defined(CLCD_USE_SOFT_SPI)
#define SPI_OBJ ::SPI
#else
extern SPIClass EVE_SPI;
#define SPI_OBJ EVE_SPI
#endif
namespace SPI {
#ifndef CLCD_USE_SOFT_SPI
extern SPISettings spi_settings;
@ -47,7 +55,7 @@ namespace FTDI {
#ifdef CLCD_USE_SOFT_SPI
return _soft_spi_xfer(0x00);
#else
return ::SPI.transfer(0x00);
SPI_OBJ.transfer(0x00);
#endif
};
@ -55,7 +63,7 @@ namespace FTDI {
#ifdef CLCD_USE_SOFT_SPI
_soft_spi_send(val);
#else
::SPI.transfer(val);
SPI_OBJ.transfer(val);
#endif
};

View File

@ -30,9 +30,9 @@ class SoundList {
public:
static const uint8_t n;
static inline const char* name(uint8_t val) {
return (const char* ) pgm_read_ptr_near(&list[val].name);
return (const char* ) pgm_read_ptr_far(&list[val].name);
}
static inline FTDI::SoundPlayer::sound_t* data(uint8_t val) {
return (FTDI::SoundPlayer::sound_t*) pgm_read_ptr_near(&list[val].data);
return (FTDI::SoundPlayer::sound_t*) pgm_read_ptr_far(&list[val].data);
}
};

View File

@ -154,3 +154,12 @@
#define CLCD_SPI_EXTRA_CS SDSS
#endif
#endif
#if EITHER(E3_EXP1_PINMAP, GENERIC_EXP2_PINMAP)
#ifndef __MARLIN_FIRMWARE__
#error "This pin mapping requires Marlin."
#endif
#define CLCD_MOD_RESET BTN_EN1
#define CLCD_SPI_CS LCD_PINS_RS
#endif

View File

@ -82,7 +82,7 @@ void AboutScreen::onRedraw(draw_mode_t) {
);
draw_text_box(cmd, FW_VERS_POS, progmem_str(getFirmwareName_str()), OPT_CENTER, font_medium);
draw_text_box(cmd, FW_INFO_POS, about_str, OPT_CENTER, font_medium);
draw_text_box(cmd, INSET_POS(LICENSE_POS), GET_TEXT_F(MSG_LICENSE), OPT_CENTER, font_tiny);
draw_text_box(cmd.tag(3), INSET_POS(LICENSE_POS), GET_TEXT_F(MSG_LICENSE), OPT_CENTER, font_tiny);
cmd.font(font_medium)
.colors(normal_btn)

View File

@ -74,7 +74,9 @@ void InterfaceSettingsScreen::onRedraw(draw_mode_t what) {
#define EDGE_R 30
.font(font_small)
.tag(0)
#if DISABLED(LCD_FYSETC_TFT81050)
.text(BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXT_F(MSG_LCD_BRIGHTNESS), OPT_RIGHTX | OPT_CENTERY)
#endif
.text(BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXT_F(MSG_SOUND_VOLUME), OPT_RIGHTX | OPT_CENTERY)
.text(BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXT_F(MSG_SCREEN_LOCK), OPT_RIGHTX | OPT_CENTERY);
#if DISABLED(TOUCH_UI_NO_BOOTSCREEN)
@ -93,7 +95,9 @@ void InterfaceSettingsScreen::onRedraw(draw_mode_t what) {
cmd.font(font_medium)
#define EDGE_R 30
.colors(ui_slider)
#if DISABLED(LCD_FYSETC_TFT81050)
.tag(2).slider(BTN_POS(3,2), BTN_SIZE(2,1), screen_data.InterfaceSettingsScreen.brightness, 128)
#endif
.tag(3).slider(BTN_POS(3,3), BTN_SIZE(2,1), screen_data.InterfaceSettingsScreen.volume, 0xFF)
.colors(ui_toggle)
.tag(4).toggle2(BTN_POS(3,4), BTN_SIZE(w,1), GET_TEXT_F(MSG_NO), GET_TEXT_F(MSG_YES), LockScreen::is_enabled())