Add helper for sending 16bit color buffers

This commit is contained in:
me-no-dev 2017-02-14 11:58:04 +02:00
parent d0232d126a
commit 3cbc405edf
2 changed files with 15 additions and 6 deletions

View File

@ -189,9 +189,6 @@ void SPIClass::transferBits(uint32_t data, uint32_t * out, uint8_t bits)
} }
/** /**
* Note:
* data need to be aligned to 32Bit
* or you get an Fatal exception (9)
* @param data uint8_t * * @param data uint8_t *
* @param size uint32_t * @param size uint32_t
*/ */
@ -205,6 +202,20 @@ void SPIClass::writeBytes(uint8_t * data, uint32_t size)
spiEndTransaction(_spi); spiEndTransaction(_spi);
} }
/**
* @param data void *
* @param size uint32_t
*/
void SPIClass::writePixels(const void * data, uint32_t size)
{
if(_inTransaction){
return spiWritePixelsNL(_spi, data, size);
}
spiSimpleTransaction(_spi);
spiWritePixelsNL(_spi, data, size);
spiEndTransaction(_spi);
}
/** /**
* @param data uint8_t * data buffer. can be NULL for Read Only operation * @param data uint8_t * data buffer. can be NULL for Read Only operation
* @param out uint8_t * output buffer. can be NULL for Write Only operation * @param out uint8_t * output buffer. can be NULL for Write Only operation
@ -219,9 +230,6 @@ void SPIClass::transferBytes(uint8_t * data, uint8_t * out, uint32_t size)
} }
/** /**
* Note:
* data need to be aligned to 32Bit
* or you get an Fatal exception (9)
* @param data uint8_t * * @param data uint8_t *
* @param size uint8_t max for size is 64Byte * @param size uint8_t max for size is 64Byte
* @param repeat uint32_t * @param repeat uint32_t

View File

@ -73,6 +73,7 @@ public:
void write16(uint16_t data); void write16(uint16_t data);
void write32(uint32_t data); void write32(uint32_t data);
void writeBytes(uint8_t * data, uint32_t size); void writeBytes(uint8_t * data, uint32_t size);
void writePixels(const void * data, uint32_t size);//ili9341 compatible
void writePattern(uint8_t * data, uint8_t size, uint32_t repeat); void writePattern(uint8_t * data, uint8_t size, uint32_t repeat);
spi_t * bus(){ return _spi; } spi_t * bus(){ return _spi; }