mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-20 09:16:30 +00:00
optimized ra8876 pushpixels
This commit is contained in:
parent
95976a21fc
commit
b3e69e71e5
@ -939,35 +939,44 @@ void RA8876::setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) {
|
|||||||
SPI.endTransaction();
|
SPI.endTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void lvgl_color_swap1(uint16_t *data, uint16_t len) { for (uint32_t i = 0; i < len; i++) (data[i] = data[i] << 8 | data[i] >> 8); }
|
// pixel color is swapped in contrast to other controllers
|
||||||
|
|
||||||
void RA8876::pushColors(uint16_t *data, uint16_t len, boolean not_swapped) {
|
void RA8876::pushColors(uint16_t *data, uint16_t len, boolean not_swapped) {
|
||||||
|
|
||||||
if (not_swapped == false) {
|
if (not_swapped == false) {
|
||||||
lvgl_color_swap1(data, len);
|
// coming from LVGL
|
||||||
}
|
#ifdef ESP32
|
||||||
|
|
||||||
SPI.beginTransaction(m_spiSettings);
|
SPI.beginTransaction(m_spiSettings);
|
||||||
//RA8876_CS_LOW
|
RA8876_CS_LOW
|
||||||
while (len--) {
|
SPI.write(RA8876_DATA_WRITE);
|
||||||
|
if (lvgl_param.use_dma) {
|
||||||
uint16_t color = *data++;
|
// will need swapping !
|
||||||
|
pushPixelsDMA(data, len);
|
||||||
#if 0
|
} else {
|
||||||
SPI.transfer(RA8876_DATA_WRITE);
|
SPI.writePixels(data, len * 2);
|
||||||
SPI.transfer(color&0xff);
|
|
||||||
SPI.transfer(RA8876_DATA_WRITE);
|
|
||||||
SPI.transfer(color>>8);
|
|
||||||
#else
|
|
||||||
|
|
||||||
//waitWriteFifo();
|
|
||||||
writeData(color&0xff);
|
|
||||||
//waitWriteFifo();
|
|
||||||
writeData(color>>8);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
//RA8876_CS_HIGH
|
RA8876_CS_HIGH
|
||||||
SPI.endTransaction();
|
SPI.endTransaction();
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
// coming from displaytext
|
||||||
|
SPI.beginTransaction(m_spiSettings);
|
||||||
|
RA8876_CS_LOW
|
||||||
|
SPI.transfer(RA8876_DATA_WRITE);
|
||||||
|
|
||||||
|
#ifdef ESP32
|
||||||
|
SPI.writeBytes((uint8_t*)data, len * 2);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ESP8266
|
||||||
|
while (len--) {
|
||||||
|
uint16_t color = *data++;
|
||||||
|
SPI.write(color&0xff);
|
||||||
|
SPI.write(color>>8);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
RA8876_CS_HIGH
|
||||||
|
SPI.endTransaction();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RA8876::drawPixel(int16_t x, int16_t y, uint16_t color) {
|
void RA8876::drawPixel(int16_t x, int16_t y, uint16_t color) {
|
||||||
@ -1501,7 +1510,7 @@ bool RA8876::initDMA()
|
|||||||
.cs_ena_posttrans = 0,
|
.cs_ena_posttrans = 0,
|
||||||
.clock_speed_hz = RA8876_SPI_SPEED,
|
.clock_speed_hz = RA8876_SPI_SPEED,
|
||||||
.input_delay_ns = 0,
|
.input_delay_ns = 0,
|
||||||
.spics_io_num = m_csPin,
|
.spics_io_num = -1,
|
||||||
.flags = SPI_DEVICE_NO_DUMMY, //0,
|
.flags = SPI_DEVICE_NO_DUMMY, //0,
|
||||||
.queue_size = 1,
|
.queue_size = 1,
|
||||||
.pre_cb = 0, //dc_callback, //Callback to handle D/C line
|
.pre_cb = 0, //dc_callback, //Callback to handle D/C line
|
||||||
|
Loading…
x
Reference in New Issue
Block a user