aboutsummaryrefslogtreecommitdiff
path: root/drivers
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
parentbd2764cccc3986e71d182b2cf2ead5ef04f0da41 (diff)
parent3d70766327422bcd918b6940298f7557ab10d248 (diff)
downloadqmk_firmware-296552e358b857efa40e87f45f3ff177a1f527a7.tar.gz
qmk_firmware-296552e358b857efa40e87f45f3ff177a1f527a7.zip
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'drivers')
-rw-r--r--drivers/chibios/ws2812.c4
-rw-r--r--drivers/chibios/ws2812_pwm.c37
-rw-r--r--drivers/chibios/ws2812_spi.c4
3 files changed, 45 insertions, 0 deletions
diff --git a/drivers/chibios/ws2812.c b/drivers/chibios/ws2812.c
index 59ed90374..0d12e2fb7 100644
--- a/drivers/chibios/ws2812.c
+++ b/drivers/chibios/ws2812.c
@@ -97,6 +97,10 @@ void ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) {
97 sendByte(ledarray[i].r); 97 sendByte(ledarray[i].r);
98 sendByte(ledarray[i].g); 98 sendByte(ledarray[i].g);
99 sendByte(ledarray[i].b); 99 sendByte(ledarray[i].b);
100#elif (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_BGR)
101 sendByte(ledarray[i].b);
102 sendByte(ledarray[i].g);
103 sendByte(ledarray[i].r);
100#endif 104#endif
101 105
102#ifdef RGBW 106#ifdef RGBW
diff --git a/drivers/chibios/ws2812_pwm.c b/drivers/chibios/ws2812_pwm.c
index 3af922c06..140120d48 100644
--- a/drivers/chibios/ws2812_pwm.c
+++ b/drivers/chibios/ws2812_pwm.c
@@ -180,6 +180,43 @@
180 * @return The bit index 180 * @return The bit index
181 */ 181 */
182# define WS2812_BLUE_BIT(led, bit) WS2812_BIT((led), 2, (bit)) 182# define WS2812_BLUE_BIT(led, bit) WS2812_BIT((led), 2, (bit))
183
184#elif (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_BGR)
185/**
186 * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given red bit
187 *
188 * @note The red byte is the middle byte in the color packet
189 *
190 * @param[in] led: The led index [0, @ref RGBLED_NUM)
191 * @param[in] bit: The bit number [0, 7]
192 *
193 * @return The bit index
194 */
195# define WS2812_RED_BIT(led, bit) WS2812_BIT((led), 2, (bit))
196
197/**
198 * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given green bit
199 *
200 * @note The red byte is the first byte in the color packet
201 *
202 * @param[in] led: The led index [0, @ref RGBLED_NUM)
203 * @param[in] bit: The bit number [0, 7]
204 *
205 * @return The bit index
206 */
207# define WS2812_GREEN_BIT(led, bit) WS2812_BIT((led), 1, (bit))
208
209/**
210 * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given blue bit
211 *
212 * @note The red byte is the last byte in the color packet
213 *
214 * @param[in] led: The led index [0, @ref RGBLED_NUM)
215 * @param[in] bit: The bit index [0, 7]
216 *
217 * @return The bit index
218 */
219# define WS2812_BLUE_BIT(led, bit) WS2812_BIT((led), 0, (bit))
183#endif 220#endif
184 221
185/* --- PRIVATE VARIABLES ---------------------------------------------------- */ 222/* --- PRIVATE VARIABLES ---------------------------------------------------- */
diff --git a/drivers/chibios/ws2812_spi.c b/drivers/chibios/ws2812_spi.c
index a93342436..89df2987b 100644
--- a/drivers/chibios/ws2812_spi.c
+++ b/drivers/chibios/ws2812_spi.c
@@ -70,6 +70,10 @@ static void set_led_color_rgb(LED_TYPE color, int pos) {
70 for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + j] = get_protocol_eq(color.r, j); 70 for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + j] = get_protocol_eq(color.r, j);
71 for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE + j] = get_protocol_eq(color.g, j); 71 for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE + j] = get_protocol_eq(color.g, j);
72 for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 2 + j] = get_protocol_eq(color.b, j); 72 for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 2 + j] = get_protocol_eq(color.b, j);
73#elif (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_BGR)
74 for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + j] = get_protocol_eq(color.b, j);
75 for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE + j] = get_protocol_eq(color.g, j);
76 for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 2 + j] = get_protocol_eq(color.r, j);
73#endif 77#endif
74} 78}
75 79