@@ -1632,6 +1632,51 @@ uint16_t Adafruit_SPITFT::color565(uint8_t red, uint8_t green, uint8_t blue) {
16321632 return ((red & 0xF8 ) << 8 ) | ((green & 0xFC ) << 3 ) | (blue >> 3 );
16331633}
16341634
1635+ /* !
1636+ @brief Adafruit_SPITFT Send Command handles complete sending of commands and data
1637+ @param commandByte The Command Byte
1638+ @param dataBytes A pointer to the Data bytes to send
1639+ @param numDataBytes The number of bytes we should send
1640+ */
1641+ void Adafruit_SPITFT::sendCommand (uint8_t commandByte, uint8_t *dataBytes, uint8_t numDataBytes) {
1642+ SPI_BEGIN_TRANSACTION ();
1643+ if (_cs >= 0 ) SPI_CS_LOW ();
1644+
1645+ SPI_DC_LOW (); // Command mode
1646+ spiWrite (commandByte); // Send the command byte
1647+
1648+ SPI_DC_HIGH ();
1649+ for (int i=0 ; i<numDataBytes; i++) {
1650+ spiWrite (*dataBytes); // Send the data bytes
1651+ dataBytes++;
1652+ }
1653+
1654+ if (_cs >= 0 ) SPI_CS_HIGH ();
1655+ SPI_END_TRANSACTION ();
1656+ }
1657+
1658+ /* !
1659+ @brief Adafruit_SPITFT Send Command handles complete sending of commands and const data
1660+ @param commandByte The Command Byte
1661+ @param dataBytes A pointer to the Data bytes to send
1662+ @param numDataBytes The number of bytes we should send
1663+ */
1664+ void Adafruit_SPITFT::sendCommand (uint8_t commandByte, const uint8_t *dataBytes, uint8_t numDataBytes) {
1665+ SPI_BEGIN_TRANSACTION ();
1666+ if (_cs >= 0 ) SPI_CS_LOW ();
1667+
1668+ SPI_DC_LOW (); // Command mode
1669+ spiWrite (commandByte); // Send the command byte
1670+
1671+ SPI_DC_HIGH ();
1672+ for (int i=0 ; i<numDataBytes; i++) {
1673+ spiWrite (pgm_read_byte (dataBytes++)); // Send the data bytes
1674+ }
1675+
1676+ if (_cs >= 0 ) SPI_CS_HIGH ();
1677+ SPI_END_TRANSACTION ();
1678+ }
1679+
16351680
16361681// -------------------------------------------------------------------------
16371682// Lowest-level hardware-interfacing functions. Many of these are inline and
0 commit comments