blinkReady added.

This commit is contained in:
Martin Brodbeck 2023-01-03 12:04:30 +01:00
parent 258a0c051f
commit 825f490a90
2 changed files with 10 additions and 2 deletions

View file

@ -6,8 +6,15 @@ WS2812::WS2812(uint gpio, PIO pio, uint sm) : m_pio{pio}, m_sm{sm} {
switchColor(Color::OFF);
}
void WS2812::switchColor(Color color) {
putPixel(static_cast<uint32_t>(color));
void WS2812::switchColor(Color color) { putPixel(static_cast<uint32_t>(color)); }
void WS2812::blinkReady() {
for (int i = 0; i < 2; i++) {
switchColor(Color::WHITE);
sleep_ms(250);
switchColor(Color::OFF);
sleep_ms(250);
}
}
void WS2812::putPixel(uint32_t pixel_grb) { pio_sm_put_blocking(m_pio, m_sm, pixel_grb << 8u); }

View file

@ -18,6 +18,7 @@ class WS2812 {
public:
WS2812(uint gpio, PIO pio = pio0, uint sm = 0);
void switchColor(Color color);
void blinkReady();
private:
void putPixel(uint32_t pixel_rgb);