From dda89947a7ceace414e29818a7099f47b9fa9bd5 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Wed, 22 Mar 2017 02:26:18 +0200 Subject: [PATCH] Fix writePixels --- cores/esp32/esp32-hal-spi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cores/esp32/esp32-hal-spi.c b/cores/esp32/esp32-hal-spi.c index 9c13fbf5..a26042b0 100644 --- a/cores/esp32/esp32-hal-spi.c +++ b/cores/esp32/esp32-hal-spi.c @@ -687,6 +687,7 @@ void spiTransferBytes(spi_t * spi, uint8_t * data, uint8_t * out, uint32_t size) #define MSB_32_SET(var, val) { uint8_t * d = (uint8_t *)&(val); (var) = d[3] | (d[2] << 8) | (d[1] << 16) | (d[0] << 24); } #define MSB_24_SET(var, val) { uint8_t * d = (uint8_t *)&(val); (var) = d[2] | (d[1] << 8) | (d[0] << 16); } #define MSB_16_SET(var, val) { (var) = (((val) & 0xFF00) >> 8) | (((val) & 0xFF) << 8); } +#define MSB_PIX_SET(var, val) { uint8_t * d = (uint8_t *)&(val); (var) = d[1] | (d[0] << 8) | (d[3] << 16) | (d[2] << 24); } void spiTransaction(spi_t * spi, uint32_t clockDiv, uint8_t dataMode, uint8_t bitOrder) { @@ -973,7 +974,7 @@ void spiWritePixelsNL(spi_t * spi, const void * data_in, size_t len){ spi->dev->data_buf[i] = data[i] & 0xFF; } } else { - MSB_32_SET(spi->dev->data_buf[i], data[i]); + MSB_PIX_SET(spi->dev->data_buf[i], data[i]); } } else { spi->dev->data_buf[i] = data[i];