This commit is contained in:
ladyada 2021-05-26 17:50:22 -04:00
parent 4c87f9a048
commit f9af48ba13
2 changed files with 115 additions and 115 deletions

View File

@ -87,7 +87,7 @@ static const struct {
#endif
};
#define NUM_TIMERS (sizeof tcList / sizeof tcList[0]) ///< # timer/counters
#endif // end __SAMD51__
#endif // end __SAMD51__
#endif // end USE_SPI_DMA
@ -157,7 +157,7 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t cs, int8_t dc,
} else {
swspi.misoPort = portInputRegister(dc);
}
#else // !CORE_TEENSY
#else // !CORE_TEENSY
dcPinMask = digitalPinToBitMask(dc);
swspi.sckPinMask = digitalPinToBitMask(sck);
swspi.mosiPinMask = digitalPinToBitMask(mosi);
@ -188,7 +188,7 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t cs, int8_t dc,
swspi.misoPort = (PORTreg_t)portInputRegister(digitalPinToPort(dc));
}
#endif // end !CORE_TEENSY
#else // !HAS_PORT_SET_CLR
#else // !HAS_PORT_SET_CLR
dcPort = (PORTreg_t)portOutputRegister(digitalPinToPort(dc));
dcPinMaskSet = digitalPinToBitMask(dc);
swspi.sckPort = (PORTreg_t)portOutputRegister(digitalPinToPort(sck));
@ -241,7 +241,7 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t cs, int8_t dc,
_dc(dc) {
hwspi._spi = &SPI;
}
#else // !ESP8266
#else // !ESP8266
Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t cs, int8_t dc,
int8_t rst)
: Adafruit_SPITFT(w, h, &SPI, cs, dc, rst) {
@ -304,7 +304,7 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, SPIClass *spiClass,
csPortSet = dcPortSet;
csPortClr = dcPortClr;
}
#else // !CORE_TEENSY
#else // !CORE_TEENSY
dcPinMask = digitalPinToBitMask(dc);
dcPortSet = &(PORT->Group[g_APinDescription[dc].ulPort].OUTSET.reg);
dcPortClr = &(PORT->Group[g_APinDescription[dc].ulPort].OUTCLR.reg);
@ -322,7 +322,7 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, SPIClass *spiClass,
csPinMask = 0;
}
#endif // end !CORE_TEENSY
#else // !HAS_PORT_SET_CLR
#else // !HAS_PORT_SET_CLR
dcPort = (PORTreg_t)portOutputRegister(digitalPinToPort(dc));
dcPinMaskSet = digitalPinToBitMask(dc);
if (cs >= 0) {
@ -425,7 +425,7 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, tftBusWidth busWidth,
tft8.readPort = portInputRegister(d0);
tft8.dirSet = portModeRegister(d0);
tft8.dirClr = portModeRegister(d0);
#else // !CORE_TEENSY
#else // !CORE_TEENSY
tft8.wrPinMask = digitalPinToBitMask(wr);
tft8.wrPortSet = &(PORT->Group[g_APinDescription[wr].ulPort].OUTSET.reg);
tft8.wrPortClr = &(PORT->Group[g_APinDescription[wr].ulPort].OUTCLR.reg);
@ -467,7 +467,7 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, tftBusWidth busWidth,
tft8.dirSet = (volatile uint8_t *)&(p->DIRSET.reg) + offset;
tft8.dirClr = (volatile uint8_t *)&(p->DIRCLR.reg) + offset;
#endif // end !CORE_TEENSY
#else // !HAS_PORT_SET_CLR
#else // !HAS_PORT_SET_CLR
tft8.wrPort = (PORTreg_t)portOutputRegister(digitalPinToPort(wr));
tft8.wrPinMaskSet = digitalPinToBitMask(wr);
dcPort = (PORTreg_t)portOutputRegister(digitalPinToPort(dc));
@ -616,7 +616,7 @@ void Adafruit_SPITFT::initSPI(uint32_t freq, uint8_t spiMode) {
*(volatile uint16_t *)tft8.dirSet = 0xFFFF;
*(volatile uint16_t *)tft8.writePort = 0x0000;
}
#else // !CORE_TEENSY
#else // !CORE_TEENSY
uint8_t portNum = g_APinDescription[tft8._d0].ulPort, // d0 PORT #
dBit = g_APinDescription[tft8._d0].ulPin, // d0 bit in PORT
lastBit = dBit + (tft8.wide ? 15 : 7);
@ -870,7 +870,7 @@ void Adafruit_SPITFT::initSPI(uint32_t freq, uint8_t spiMode) {
DMA_ADDRESS_INCREMENT_STEP_SIZE_1;
descriptor[d].DSTADDR.reg = (uint32_t)tft8.writePort;
}
#endif // __SAMD51
#endif // __SAMD51
} // end parallel-specific DMA setup
lastFillColor = 0x0000;
@ -1216,7 +1216,7 @@ void Adafruit_SPITFT::writeColor(uint16_t color, uint32_t len) {
rtos_free(pixbuf);
return;
}
#else // !ESP32
#else // !ESP32
#if defined(USE_SPI_DMA) && (defined(__SAMD51__) || defined(ARDUINO_SAMD_ZERO))
if (((connection == TFT_HARD_SPI) || (connection == TFT_PARALLEL)) &&
(len >= 16)) { // Don't bother with DMA on short pixel runs
@ -1381,7 +1381,7 @@ void Adafruit_SPITFT::writeColor(uint16_t color, uint32_t len) {
SPI_SCK_LOW();
x <<= 1;
}
#else // !__AVR__
#else // !__AVR__
for (uint16_t bit = 0, x = color; bit < 16; bit++) {
if (x & 0x8000)
SPI_MOSI_HIGH();
@ -1391,9 +1391,9 @@ void Adafruit_SPITFT::writeColor(uint16_t color, uint32_t len) {
x <<= 1;
SPI_SCK_LOW();
}
#endif // end !__AVR__
#endif // end !__AVR__
}
#endif // end !ESP8266
#endif // end !ESP8266
} else { // PARALLEL
if (hi == lo) {
#if defined(__AVR__)
@ -1999,12 +1999,12 @@ uint16_t Adafruit_SPITFT::readcommand16(uint16_t addr) {
*(volatile uint16_t *)tft8.dirClr = 0xFFFF; // Input state
result = *(volatile uint16_t *)tft8.readPort; // 16-bit read
*(volatile uint16_t *)tft8.dirSet = 0xFFFF; // Output state
#else // !HAS_PORT_SET_CLR
*(volatile uint16_t *)tft8.portDir = 0x0000; // Input state
result = *(volatile uint16_t *)tft8.readPort; // 16-bit read
*(volatile uint16_t *)tft8.portDir = 0xFFFF; // Output state
#endif // end !HAS_PORT_SET_CLR
TFT_RD_HIGH(); // Read line HIGH
#else // !HAS_PORT_SET_CLR
*(volatile uint16_t *)tft8.portDir = 0x0000; // Input state
result = *(volatile uint16_t *)tft8.readPort; // 16-bit read
*(volatile uint16_t *)tft8.portDir = 0xFFFF; // Output state
#endif // end !HAS_PORT_SET_CLR
TFT_RD_HIGH(); // Read line HIGH
endWrite();
}
return result;
@ -2153,31 +2153,31 @@ uint8_t Adafruit_SPITFT::spiRead(void) {
*tft8.portDir = 0x00; // Set port to input state
w = *tft8.readPort; // Read value from port
*tft8.portDir = 0xFF; // Restore port to output
#else // !__AVR__
if (!tft8.wide) { // 8-bit TFT connection
#else // !__AVR__
if (!tft8.wide) { // 8-bit TFT connection
#if defined(HAS_PORT_SET_CLR)
*tft8.dirClr = 0xFF; // Set port to input state
w = *tft8.readPort; // Read value from port
*tft8.dirSet = 0xFF; // Restore port to output
#else // !HAS_PORT_SET_CLR
*tft8.portDir = 0x00; // Set port to input state
w = *tft8.readPort; // Read value from port
*tft8.portDir = 0xFF; // Restore port to output
*tft8.dirClr = 0xFF; // Set port to input state
w = *tft8.readPort; // Read value from port
*tft8.dirSet = 0xFF; // Restore port to output
#else // !HAS_PORT_SET_CLR
*tft8.portDir = 0x00; // Set port to input state
w = *tft8.readPort; // Read value from port
*tft8.portDir = 0xFF; // Restore port to output
#endif // end HAS_PORT_SET_CLR
} else { // 16-bit TFT connection
} else { // 16-bit TFT connection
#if defined(HAS_PORT_SET_CLR)
*(volatile uint16_t *)tft8.dirClr = 0xFFFF; // Input state
w = *(volatile uint16_t *)tft8.readPort; // 16-bit read
*(volatile uint16_t *)tft8.dirSet = 0xFFFF; // Output state
#else // !HAS_PORT_SET_CLR
#else // !HAS_PORT_SET_CLR
*(volatile uint16_t *)tft8.portDir = 0x0000; // Input state
w = *(volatile uint16_t *)tft8.readPort; // 16-bit read
*(volatile uint16_t *)tft8.portDir = 0xFFFF; // Output state
#endif // end !HAS_PORT_SET_CLR
}
TFT_RD_HIGH(); // Read line HIGH
TFT_RD_HIGH(); // Read line HIGH
#endif // end !__AVR__
#else // !USE_FAST_PINIO
#else // !USE_FAST_PINIO
w = 0; // Parallel TFT is NOT SUPPORTED without USE_FAST_PINIO
#endif // end !USE_FAST_PINIO
}
@ -2237,16 +2237,16 @@ uint16_t Adafruit_SPITFT::read16(void) {
*(volatile uint16_t *)tft8.dirClr = 0xFFFF; // Input state
w = *(volatile uint16_t *)tft8.readPort; // 16-bit read
*(volatile uint16_t *)tft8.dirSet = 0xFFFF; // Output state
#else // !HAS_PORT_SET_CLR
#else // !HAS_PORT_SET_CLR
*(volatile uint16_t *)tft8.portDir = 0x0000; // Input state
w = *(volatile uint16_t *)tft8.readPort; // 16-bit read
*(volatile uint16_t *)tft8.portDir = 0xFFFF; // Output state
#endif // end !HAS_PORT_SET_CLR
#endif // end !HAS_PORT_SET_CLR
}
TFT_RD_HIGH(); // Read line HIGH
#else // !USE_FAST_PINIO
#else // !USE_FAST_PINIO
w = 0; // Parallel TFT is NOT SUPPORTED without USE_FAST_PINIO
#endif // end !USE_FAST_PINIO
#endif // end !USE_FAST_PINIO
}
}
return w;
@ -2263,10 +2263,10 @@ inline void Adafruit_SPITFT::SPI_MOSI_HIGH(void) {
#else // !KINETISK
*swspi.mosiPortSet = swspi.mosiPinMask;
#endif
#else // !HAS_PORT_SET_CLR
#else // !HAS_PORT_SET_CLR
*swspi.mosiPort |= swspi.mosiPinMaskSet;
#endif // end !HAS_PORT_SET_CLR
#else // !USE_FAST_PINIO
#else // !USE_FAST_PINIO
digitalWrite(swspi._mosi, HIGH);
#if defined(ESP32)
for (volatile uint8_t i = 0; i < 1; i++)
@ -2286,10 +2286,10 @@ inline void Adafruit_SPITFT::SPI_MOSI_LOW(void) {
#else // !KINETISK
*swspi.mosiPortClr = swspi.mosiPinMask;
#endif
#else // !HAS_PORT_SET_CLR
#else // !HAS_PORT_SET_CLR
*swspi.mosiPort &= swspi.mosiPinMaskClr;
#endif // end !HAS_PORT_SET_CLR
#else // !USE_FAST_PINIO
#else // !USE_FAST_PINIO
digitalWrite(swspi._mosi, LOW);
#if defined(ESP32)
for (volatile uint8_t i = 0; i < 1; i++)
@ -2306,17 +2306,17 @@ inline void Adafruit_SPITFT::SPI_SCK_HIGH(void) {
#if defined(HAS_PORT_SET_CLR)
#if defined(KINETISK)
*swspi.sckPortSet = 1;
#else // !KINETISK
#else // !KINETISK
*swspi.sckPortSet = swspi.sckPinMask;
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) // Teensy 4.x
for (volatile uint8_t i = 0; i < 1; i++)
;
#endif
#endif
#else // !HAS_PORT_SET_CLR
#else // !HAS_PORT_SET_CLR
*swspi.sckPort |= swspi.sckPinMaskSet;
#endif // end !HAS_PORT_SET_CLR
#else // !USE_FAST_PINIO
#else // !USE_FAST_PINIO
digitalWrite(swspi._sck, HIGH);
#if defined(ESP32)
for (volatile uint8_t i = 0; i < 1; i++)
@ -2333,17 +2333,17 @@ inline void Adafruit_SPITFT::SPI_SCK_LOW(void) {
#if defined(HAS_PORT_SET_CLR)
#if defined(KINETISK)
*swspi.sckPortClr = 1;
#else // !KINETISK
#else // !KINETISK
*swspi.sckPortClr = swspi.sckPinMask;
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) // Teensy 4.x
for (volatile uint8_t i = 0; i < 1; i++)
;
#endif
#endif
#else // !HAS_PORT_SET_CLR
#else // !HAS_PORT_SET_CLR
*swspi.sckPort &= swspi.sckPinMaskClr;
#endif // end !HAS_PORT_SET_CLR
#else // !USE_FAST_PINIO
#else // !USE_FAST_PINIO
digitalWrite(swspi._sck, LOW);
#if defined(ESP32)
for (volatile uint8_t i = 0; i < 1; i++)
@ -2360,10 +2360,10 @@ inline bool Adafruit_SPITFT::SPI_MISO_READ(void) {
#if defined(USE_FAST_PINIO)
#if defined(KINETISK)
return *swspi.misoPort;
#else // !KINETISK
#else // !KINETISK
return *swspi.misoPort & swspi.misoPinMask;
#endif // end !KINETISK
#else // !USE_FAST_PINIO
#else // !USE_FAST_PINIO
return digitalRead(swspi._miso);
#endif // end !USE_FAST_PINIO
}
@ -2491,15 +2491,15 @@ inline void Adafruit_SPITFT::TFT_WR_STROBE(void) {
#if defined(KINETISK)
*tft8.wrPortClr = 1;
*tft8.wrPortSet = 1;
#else // !KINETISK
#else // !KINETISK
*tft8.wrPortClr = tft8.wrPinMask;
*tft8.wrPortSet = tft8.wrPinMask;
#endif // end !KINETISK
#else // !HAS_PORT_SET_CLR
#else // !HAS_PORT_SET_CLR
*tft8.wrPort &= tft8.wrPinMaskClr;
*tft8.wrPort |= tft8.wrPinMaskSet;
#endif // end !HAS_PORT_SET_CLR
#else // !USE_FAST_PINIO
#else // !USE_FAST_PINIO
digitalWrite(tft8._wr, LOW);
digitalWrite(tft8._wr, HIGH);
#endif // end !USE_FAST_PINIO
@ -2513,10 +2513,10 @@ inline void Adafruit_SPITFT::TFT_RD_HIGH(void) {
#if defined(USE_FAST_PINIO)
#if defined(HAS_PORT_SET_CLR)
*tft8.rdPortSet = tft8.rdPinMask;
#else // !HAS_PORT_SET_CLR
#else // !HAS_PORT_SET_CLR
*tft8.rdPort |= tft8.rdPinMaskSet;
#endif // end !HAS_PORT_SET_CLR
#else // !USE_FAST_PINIO
#else // !USE_FAST_PINIO
digitalWrite(tft8._rd, HIGH);
#endif // end !USE_FAST_PINIO
}
@ -2529,10 +2529,10 @@ inline void Adafruit_SPITFT::TFT_RD_LOW(void) {
#if defined(USE_FAST_PINIO)
#if defined(HAS_PORT_SET_CLR)
*tft8.rdPortClr = tft8.rdPinMask;
#else // !HAS_PORT_SET_CLR
#else // !HAS_PORT_SET_CLR
*tft8.rdPort &= tft8.rdPinMaskClr;
#endif // end !HAS_PORT_SET_CLR
#else // !USE_FAST_PINIO
#else // !USE_FAST_PINIO
digitalWrite(tft8._rd, LOW);
#endif // end !USE_FAST_PINIO
}

View File

@ -28,16 +28,16 @@
// HARDWARE CONFIG ---------------------------------------------------------
#if defined(__AVR__)
typedef uint8_t ADAGFX_PORT_t; ///< PORT values are 8-bit
#define USE_FAST_PINIO ///< Use direct PORT register access
typedef uint8_t ADAGFX_PORT_t; ///< PORT values are 8-bit
#define USE_FAST_PINIO ///< Use direct PORT register access
#elif defined(ARDUINO_STM32_FEATHER) // WICED
typedef class HardwareSPI SPIClass; ///< SPI is a bit odd on WICED
typedef uint32_t ADAGFX_PORT_t; ///< PORT values are 32-bit
typedef class HardwareSPI SPIClass; ///< SPI is a bit odd on WICED
typedef uint32_t ADAGFX_PORT_t; ///< PORT values are 32-bit
#elif defined(__arm__)
#if defined(ARDUINO_ARCH_SAMD)
// Adafruit M0, M4
typedef uint32_t ADAGFX_PORT_t; ///< PORT values are 32-bit
#define USE_FAST_PINIO ///< Use direct PORT register access
#define USE_FAST_PINIO ///< Use direct PORT register access
#define HAS_PORT_SET_CLR ///< PORTs have set & clear registers
#elif defined(CORE_TEENSY)
// PJRC Teensy 4.x
@ -47,7 +47,7 @@ typedef uint32_t ADAGFX_PORT_t; ///< PORT values are 32-bit
#else
typedef uint8_t ADAGFX_PORT_t; ///< PORT values are 8-bit
#endif
#define USE_FAST_PINIO ///< Use direct PORT register access
#define USE_FAST_PINIO ///< Use direct PORT register access
#define HAS_PORT_SET_CLR ///< PORTs have set & clear registers
#else
// Arduino Due?
@ -56,13 +56,13 @@ typedef uint32_t ADAGFX_PORT_t; ///< PORT values are 32-bit
// GPIO register set and will require some changes elsewhere (e.g. in
// constructors especially).
#endif
#else // !ARM
#else // !ARM
// Probably ESP8266 or ESP32. USE_FAST_PINIO is not available here (yet)
// but don't worry about it too much...the digitalWrite() implementation
// on these platforms is reasonably efficient and already RAM-resident,
// only gotcha then is no parallel connection support for now.
typedef uint32_t ADAGFX_PORT_t; ///< PORT values are 32-bit
#endif // end !ARM
#endif // end !ARM
typedef volatile ADAGFX_PORT_t *PORTreg_t; ///< PORT register type
#if defined(__AVR__)
@ -292,13 +292,13 @@ public:
#if defined(HAS_PORT_SET_CLR)
#if defined(KINETISK)
*csPortSet = 1;
#else // !KINETISK
#else // !KINETISK
*csPortSet = csPinMask;
#endif // end !KINETISK
#else // !HAS_PORT_SET_CLR
#else // !HAS_PORT_SET_CLR
*csPort |= csPinMaskSet;
#endif // end !HAS_PORT_SET_CLR
#else // !USE_FAST_PINIO
#else // !USE_FAST_PINIO
digitalWrite(_cs, HIGH);
#endif // end !USE_FAST_PINIO
}
@ -314,13 +314,13 @@ public:
#if defined(HAS_PORT_SET_CLR)
#if defined(KINETISK)
*csPortClr = 1;
#else // !KINETISK
#else // !KINETISK
*csPortClr = csPinMask;
#endif // end !KINETISK
#else // !HAS_PORT_SET_CLR
#else // !HAS_PORT_SET_CLR
*csPort &= csPinMaskClr;
#endif // end !HAS_PORT_SET_CLR
#else // !USE_FAST_PINIO
#else // !USE_FAST_PINIO
digitalWrite(_cs, LOW);
#endif // end !USE_FAST_PINIO
}
@ -333,13 +333,13 @@ public:
#if defined(HAS_PORT_SET_CLR)
#if defined(KINETISK)
*dcPortSet = 1;
#else // !KINETISK
#else // !KINETISK
*dcPortSet = dcPinMask;
#endif // end !KINETISK
#else // !HAS_PORT_SET_CLR
#else // !HAS_PORT_SET_CLR
*dcPort |= dcPinMaskSet;
#endif // end !HAS_PORT_SET_CLR
#else // !USE_FAST_PINIO
#else // !USE_FAST_PINIO
digitalWrite(_dc, HIGH);
#endif // end !USE_FAST_PINIO
}
@ -352,13 +352,13 @@ public:
#if defined(HAS_PORT_SET_CLR)
#if defined(KINETISK)
*dcPortClr = 1;
#else // !KINETISK
#else // !KINETISK
*dcPortClr = dcPinMask;
#endif // end !KINETISK
#else // !HAS_PORT_SET_CLR
#else // !HAS_PORT_SET_CLR
*dcPort &= dcPinMaskClr;
#endif // end !HAS_PORT_SET_CLR
#else // !USE_FAST_PINIO
#else // !USE_FAST_PINIO
digitalWrite(_dc, LOW);
#endif // end !USE_FAST_PINIO
}
@ -394,11 +394,11 @@ protected:
PORTreg_t csPortClr; ///< PORT register for chip select CLEAR
PORTreg_t dcPortSet; ///< PORT register for data/command SET
PORTreg_t dcPortClr; ///< PORT register for data/command CLEAR
#else // !HAS_PORT_SET_CLR
PORTreg_t csPort; ///< PORT register for chip select
PORTreg_t dcPort; ///< PORT register for data/command
#endif // end HAS_PORT_SET_CLR
#endif // end USE_FAST_PINIO
#else // !HAS_PORT_SET_CLR
PORTreg_t csPort; ///< PORT register for chip select
PORTreg_t dcPort; ///< PORT register for data/command
#endif // end HAS_PORT_SET_CLR
#endif // end USE_FAST_PINIO
#if defined(__cplusplus) && (__cplusplus >= 201100)
union {
#endif
@ -422,32 +422,32 @@ protected:
#if !defined(KINETISK)
ADAGFX_PORT_t mosiPinMask; ///< Bitmask for MOSI
ADAGFX_PORT_t sckPinMask; ///< Bitmask for SCK
#endif // end !KINETISK
#else // !HAS_PORT_SET_CLR
#endif // end !KINETISK
#else // !HAS_PORT_SET_CLR
PORTreg_t mosiPort; ///< PORT register for MOSI
PORTreg_t sckPort; ///< PORT register for SCK
ADAGFX_PORT_t mosiPinMaskSet; ///< Bitmask for MOSI SET (OR)
ADAGFX_PORT_t mosiPinMaskClr; ///< Bitmask for MOSI CLEAR (AND)
ADAGFX_PORT_t sckPinMaskSet; ///< Bitmask for SCK SET (OR bitmask)
ADAGFX_PORT_t sckPinMaskClr; ///< Bitmask for SCK CLEAR (AND)
#endif // end HAS_PORT_SET_CLR
#endif // end HAS_PORT_SET_CLR
#if !defined(KINETISK)
ADAGFX_PORT_t misoPinMask; ///< Bitmask for MISO
#endif // end !KINETISK
#endif // end USE_FAST_PINIO
int8_t _mosi; ///< MOSI pin #
int8_t _miso; ///< MISO pin #
int8_t _sck; ///< SCK pin #
} swspi; ///< Software SPI values
struct { // Values specific to 8-bit parallel:
#endif // end !KINETISK
#endif // end USE_FAST_PINIO
int8_t _mosi; ///< MOSI pin #
int8_t _miso; ///< MISO pin #
int8_t _sck; ///< SCK pin #
} swspi; ///< Software SPI values
struct { // Values specific to 8-bit parallel:
#if defined(USE_FAST_PINIO)
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) // Teensy 4.x
volatile uint32_t *writePort; ///< PORT register for DATA WRITE
volatile uint32_t *readPort; ///< PORT (PIN) register for DATA READ
#else
volatile uint8_t *writePort; ///< PORT register for DATA WRITE
volatile uint8_t *readPort; ///< PORT (PIN) register for DATA READ
volatile uint8_t *writePort; ///< PORT register for DATA WRITE
volatile uint8_t *readPort; ///< PORT (PIN) register for DATA READ
#endif
#if defined(HAS_PORT_SET_CLR)
// Port direction register pointers are always 8-bit regardless of
@ -465,9 +465,9 @@ protected:
PORTreg_t rdPortClr; ///< PORT register for read strobe CLEAR
#if !defined(KINETISK)
ADAGFX_PORT_t wrPinMask; ///< Bitmask for write strobe
#endif // end !KINETISK
#endif // end !KINETISK
ADAGFX_PORT_t rdPinMask; ///< Bitmask for read strobe
#else // !HAS_PORT_SET_CLR
#else // !HAS_PORT_SET_CLR
// Port direction register pointer is always 8-bit regardless of
// PORTreg_t -- even if 32-bit port, we modify a byte-aligned 8 bits.
volatile uint8_t *portDir; ///< PORT direction register
@ -477,19 +477,19 @@ protected:
ADAGFX_PORT_t wrPinMaskClr; ///< Bitmask for write strobe CLEAR (AND)
ADAGFX_PORT_t rdPinMaskSet; ///< Bitmask for read strobe SET (OR)
ADAGFX_PORT_t rdPinMaskClr; ///< Bitmask for read strobe CLEAR (AND)
#endif // end HAS_PORT_SET_CLR
#endif // end USE_FAST_PINIO
int8_t _d0; ///< Data pin 0 #
int8_t _wr; ///< Write strobe pin #
int8_t _rd; ///< Read strobe pin # (or -1)
bool wide = 0; ///< If true, is 16-bit interface
} tft8; ///< Parallel interface settings
#endif // end HAS_PORT_SET_CLR
#endif // end USE_FAST_PINIO
int8_t _d0; ///< Data pin 0 #
int8_t _wr; ///< Write strobe pin #
int8_t _rd; ///< Read strobe pin # (or -1)
bool wide = 0; ///< If true, is 16-bit interface
} tft8; ///< Parallel interface settings
#if defined(__cplusplus) && (__cplusplus >= 201100)
}; ///< Only one interface is active
#endif
#if defined(USE_SPI_DMA) && \
(defined(__SAMD51__) || \
defined(ARDUINO_SAMD_ZERO)) // Used by hardware SPI and tft8
defined(ARDUINO_SAMD_ZERO)) // Used by hardware SPI and tft8
Adafruit_ZeroDMA dma; ///< DMA instance
DmacDescriptor *dptr = NULL; ///< 1st descriptor
DmacDescriptor *descriptor = NULL; ///< Allocated descriptor list
@ -504,18 +504,18 @@ protected:
#if !defined(KINETISK)
ADAGFX_PORT_t csPinMask; ///< Bitmask for chip select
ADAGFX_PORT_t dcPinMask; ///< Bitmask for data/command
#endif // end !KINETISK
#else // !HAS_PORT_SET_CLR
ADAGFX_PORT_t csPinMaskSet; ///< Bitmask for chip select SET (OR)
ADAGFX_PORT_t csPinMaskClr; ///< Bitmask for chip select CLEAR (AND)
ADAGFX_PORT_t dcPinMaskSet; ///< Bitmask for data/command SET (OR)
ADAGFX_PORT_t dcPinMaskClr; ///< Bitmask for data/command CLEAR (AND)
#endif // end HAS_PORT_SET_CLR
#endif // end USE_FAST_PINIO
uint8_t connection; ///< TFT_HARD_SPI, TFT_SOFT_SPI, etc.
int8_t _rst; ///< Reset pin # (or -1)
int8_t _cs; ///< Chip select pin # (or -1)
int8_t _dc; ///< Data/command pin #
#endif // end !KINETISK
#else // !HAS_PORT_SET_CLR
ADAGFX_PORT_t csPinMaskSet; ///< Bitmask for chip select SET (OR)
ADAGFX_PORT_t csPinMaskClr; ///< Bitmask for chip select CLEAR (AND)
ADAGFX_PORT_t dcPinMaskSet; ///< Bitmask for data/command SET (OR)
ADAGFX_PORT_t dcPinMaskClr; ///< Bitmask for data/command CLEAR (AND)
#endif // end HAS_PORT_SET_CLR
#endif // end USE_FAST_PINIO
uint8_t connection; ///< TFT_HARD_SPI, TFT_SOFT_SPI, etc.
int8_t _rst; ///< Reset pin # (or -1)
int8_t _cs; ///< Chip select pin # (or -1)
int8_t _dc; ///< Data/command pin #
int16_t _xstart = 0; ///< Internal framebuffer X offset
int16_t _ystart = 0; ///< Internal framebuffer Y offset