You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/07/07 04:33:31 UTC

[incubator-nuttx] branch master updated: Add ws2812 bringup logic to all RP2040 boards.

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/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 178ba6fbb4 Add  ws2812 bringup logic to all RP2040 boards.
178ba6fbb4 is described below

commit 178ba6fbb4cec27418b9892bdedf486678b592d8
Author: curuvar <58...@users.noreply.github.com>
AuthorDate: Wed Jul 6 23:05:01 2022 -0400

    Add  ws2812 bringup logic to all RP2040 boards.
---
 .../arm/rp2040/pimoroni-tiny2040/src/rp2040_bringup.c | 19 +++++++++++++++++++
 .../arm/rp2040/raspberrypi-pico/src/rp2040_bringup.c  | 19 +++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/boards/arm/rp2040/pimoroni-tiny2040/src/rp2040_bringup.c b/boards/arm/rp2040/pimoroni-tiny2040/src/rp2040_bringup.c
index 99e8657d82..cfeb9cc61e 100644
--- a/boards/arm/rp2040/pimoroni-tiny2040/src/rp2040_bringup.c
+++ b/boards/arm/rp2040/pimoroni-tiny2040/src/rp2040_bringup.c
@@ -38,6 +38,16 @@
 #include "rp2040_pwmdev.h"
 #endif
 
+#if defined(CONFIG_RP2040_BOARD_HAS_WS2812) && defined(CONFIG_WS2812)
+#include "rp2040_ws2812.h"
+#endif
+
+#ifdef CONFIG_WS2812_HAS_WHITE
+#define HAS_WHITE true
+#else /* CONFIG_WS2812_HAS_WHITE */
+#define HAS_WHITE false
+#endif /* CONFIG_WS2812_HAS_WHITE */
+
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -398,5 +408,14 @@ int rp2040_bringup(void)
 #  endif
 #endif
 
+  /* Initialize board neo-pixel */
+
+#if defined(CONFIG_RP2040_BOARD_HAS_WS2812) && defined(CONFIG_WS2812)
+  rp2040_ws2812_setup("/dev/leds0",
+                      CONFIG_RP2040_WS2812_GPIO_PIN,
+                      CONFIG_WS2812_LED_COUNT,
+                      HAS_WHITE);
+#endif
+
   return ret;
 }
diff --git a/boards/arm/rp2040/raspberrypi-pico/src/rp2040_bringup.c b/boards/arm/rp2040/raspberrypi-pico/src/rp2040_bringup.c
index 76ff7058c2..23face61e8 100644
--- a/boards/arm/rp2040/raspberrypi-pico/src/rp2040_bringup.c
+++ b/boards/arm/rp2040/raspberrypi-pico/src/rp2040_bringup.c
@@ -64,6 +64,16 @@
 #include "rp2040_pwmdev.h"
 #endif
 
+#if defined(CONFIG_RP2040_BOARD_HAS_WS2812) && defined(CONFIG_WS2812)
+#include "rp2040_ws2812.h"
+#endif
+
+#ifdef CONFIG_WS2812_HAS_WHITE
+#define HAS_WHITE true
+#else /* CONFIG_WS2812_HAS_WHITE */
+#define HAS_WHITE false
+#endif /* CONFIG_WS2812_HAS_WHITE */
+
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -477,5 +487,14 @@ int rp2040_bringup(void)
     }
 #endif
 
+  /* Initialize board neo-pixel */
+
+#if defined(CONFIG_RP2040_BOARD_HAS_WS2812) && defined(CONFIG_WS2812)
+  rp2040_ws2812_setup("/dev/leds0",
+                      CONFIG_RP2040_WS2812_GPIO_PIN,
+                      CONFIG_WS2812_LED_COUNT,
+                      HAS_WHITE);
+#endif
+
   return ret;
 }