This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit d1326e81bca47617aa253705ca778c7d51f82038
Author: Tiago Medicci Serrano <[email protected]>
AuthorDate: Fri Dec 15 10:29:27 2023 -0300

    drivers/leds/ws2812: Fix WS2812 pixel size
    
    Although the LED might be RGB-only, the LED data is packed in a
    32-bit long variable and, then, this is the default size of a LED
    pixel to define the 'WS2812_RW_PIXEL_SIZE' macro. Please note that
    the lower-half driver will deal with the case of the addressable
    LED being 3 or 4-pixel sized.
---
 drivers/leds/ws2812.c       | 10 +---------
 include/nuttx/leds/ws2812.h |  6 ++++++
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/leds/ws2812.c b/drivers/leds/ws2812.c
index 4d16e5c1c0..850a35c642 100644
--- a/drivers/leds/ws2812.c
+++ b/drivers/leds/ws2812.c
@@ -55,15 +55,7 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#ifdef WS2812_HAS_WHITE
-#  define WS2812_RW_PIXEL_SIZE  4
-#else 
-#  define WS2812_RW_PIXEL_SIZE  3
-#endif
-
-#ifdef CONFIG_WS2812_NON_SPI_DRIVER
-
-#else /* CONFIG_WS2812_NON_SPI_DRIVER */
+#ifndef CONFIG_WS2812_NON_SPI_DRIVER
 
 /* In order to meet the signaling timing requirements, the waveforms required
  * to represent a 0/1 symbol are created by specific SPI bytes defined here.
diff --git a/include/nuttx/leds/ws2812.h b/include/nuttx/leds/ws2812.h
index db7d467c70..f5e5b17c81 100644
--- a/include/nuttx/leds/ws2812.h
+++ b/include/nuttx/leds/ws2812.h
@@ -52,6 +52,12 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
+/* Although the LED might be RGB-only, the LED data is packed in a 32-bit
+ * long variable and, then, this is the default size of a LED pixel.
+ */
+
+#define WS2812_RW_PIXEL_SIZE  4
+
 #ifdef __cplusplus
 #define EXTERN extern "C"
 extern "C"

Reply via email to