Updated const version to use read_pgm_byte and added default args

This commit is contained in:
Melissa LeBlanc-Williams 2019-04-13 11:02:49 -07:00
parent 8b06efa1f4
commit 3f53a83a7b
2 changed files with 3 additions and 15 deletions

View File

@ -1632,15 +1632,6 @@ uint16_t Adafruit_SPITFT::color565(uint8_t red, uint8_t green, uint8_t blue) {
return ((red & 0xF8) << 8) | ((green & 0xFC) << 3) | (blue >> 3); return ((red & 0xF8) << 8) | ((green & 0xFC) << 3) | (blue >> 3);
} }
/*!
@brief Adafruit_SPITFT Send Command handles complete sending of a command
@param commandByte The Command Byte
*/
void Adafruit_SPITFT::sendCommand(uint8_t commandByte) {
uint8_t dataBytes = NULL;
sendCommand(commandByte, &dataBytes, 0);
}
/*! /*!
@brief Adafruit_SPITFT Send Command handles complete sending of commands and data @brief Adafruit_SPITFT Send Command handles complete sending of commands and data
@param commandByte The Command Byte @param commandByte The Command Byte
@ -1675,13 +1666,11 @@ void Adafruit_SPITFT::sendCommand(uint8_t commandByte, const uint8_t *dataBytes,
if(_cs >= 0) SPI_CS_LOW(); if(_cs >= 0) SPI_CS_LOW();
SPI_DC_LOW(); // Command mode SPI_DC_LOW(); // Command mode
// Send the command byte spiWrite(commandByte); // Send the command byte
spiWrite(commandByte);
SPI_DC_HIGH(); SPI_DC_HIGH();
for (int i=0; i<numDataBytes; i++) { for (int i=0; i<numDataBytes; i++) {
// Send the data bytes spiWrite(pgm_read_byte(dataBytes++)); // Send the data bytes
spiWrite(*dataBytes);
} }
if(_cs >= 0) SPI_CS_HIGH(); if(_cs >= 0) SPI_CS_HIGH();

View File

@ -187,8 +187,7 @@ class Adafruit_SPITFT : public Adafruit_GFX {
void startWrite(void); void startWrite(void);
// Chip deselect and/or hardware SPI transaction end as needed: // Chip deselect and/or hardware SPI transaction end as needed:
void endWrite(void); void endWrite(void);
void sendCommand(uint8_t commandByte); void sendCommand(uint8_t commandByte, uint8_t *dataBytes = NULL, uint8_t numDataBytes = 0);
void sendCommand(uint8_t commandByte, uint8_t *dataBytes, uint8_t numDataBytes);
void sendCommand(uint8_t commandByte, const uint8_t *dataBytes, uint8_t numDataBytes); void sendCommand(uint8_t commandByte, const uint8_t *dataBytes, uint8_t numDataBytes);
// These functions require a chip-select and/or SPI transaction // These functions require a chip-select and/or SPI transaction