app: add WS2812B

This commit is contained in:
King Kévin 2022-07-14 19:00:02 +02:00
parent 02f95f55ee
commit af9d0d685a
1 changed files with 8 additions and 0 deletions

View File

@ -35,6 +35,7 @@
#include "terminal.h" // handle the terminal interface
#include "menu.h" // menu utilities
#include "font.h" // to draw text
#include "led_ws2812b.h" // control WS2812b LEDs
/** watchdog period in ms */
#define WATCHDOG_PERIOD 10000
@ -934,6 +935,13 @@ void main(void)
nvic_enable_irq(GPIO_NVIC_EXTI_IRQ(DIAL_SWITCH_PIN)); // enable interrupt
puts_debug("OK\n");
puts_debug("setup WS2812b LED matrix: ");
led_ws2812b_setup(); // configure peripheral for communication with WS2812b LEDs
led_ws2812b_set_rgb(0, 0xff, 0, 0); // set test color
led_ws2812b_set_rgb(1, 0, 0xff, 0); // set test color
led_ws2812b_set_rgb(2, 0, 0, 0xff); // set test color
puts_debug("OK\n");
puts_debug("setup RGB matrix: ");
// configure pin for output enable
rcc_periph_clock_enable(GPIO_RCC(RGBMATRIX_OE_PIN)); // enable clock for GPIO port peripheral