summaryrefslogtreecommitdiff
path: root/drivers/chibios/ws2812_pwm.c
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2021-01-15 21:43:07 +0000
committerQMK Bot <hello@qmk.fm>2021-01-15 21:43:07 +0000
commit296552e358b857efa40e87f45f3ff177a1f527a7 (patch)
treee00d93b5baa9b6099bd6194851d27b55ef683e03 /drivers/chibios/ws2812_pwm.c
parentbd2764cccc3986e71d182b2cf2ead5ef04f0da41 (diff)
parent3d70766327422bcd918b6940298f7557ab10d248 (diff)
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'drivers/chibios/ws2812_pwm.c')
-rw-r--r--drivers/chibios/ws2812_pwm.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/chibios/ws2812_pwm.c b/drivers/chibios/ws2812_pwm.c
index 3af922c063..140120d488 100644
--- a/drivers/chibios/ws2812_pwm.c
+++ b/drivers/chibios/ws2812_pwm.c
@@ -180,6 +180,43 @@
* @return The bit index
*/
# define WS2812_BLUE_BIT(led, bit) WS2812_BIT((led), 2, (bit))
+
+#elif (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_BGR)
+/**
+ * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given red bit
+ *
+ * @note The red byte is the middle byte in the color packet
+ *
+ * @param[in] led: The led index [0, @ref RGBLED_NUM)
+ * @param[in] bit: The bit number [0, 7]
+ *
+ * @return The bit index
+ */
+# define WS2812_RED_BIT(led, bit) WS2812_BIT((led), 2, (bit))
+
+/**
+ * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given green bit
+ *
+ * @note The red byte is the first byte in the color packet
+ *
+ * @param[in] led: The led index [0, @ref RGBLED_NUM)
+ * @param[in] bit: The bit number [0, 7]
+ *
+ * @return The bit index
+ */
+# define WS2812_GREEN_BIT(led, bit) WS2812_BIT((led), 1, (bit))
+
+/**
+ * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given blue bit
+ *
+ * @note The red byte is the last byte in the color packet
+ *
+ * @param[in] led: The led index [0, @ref RGBLED_NUM)
+ * @param[in] bit: The bit index [0, 7]
+ *
+ * @return The bit index
+ */
+# define WS2812_BLUE_BIT(led, bit) WS2812_BIT((led), 0, (bit))
#endif
/* --- PRIVATE VARIABLES ---------------------------------------------------- */