blinkReady added.
This commit is contained in:
parent
258a0c051f
commit
825f490a90
2 changed files with 10 additions and 2 deletions
|
@ -6,8 +6,15 @@ WS2812::WS2812(uint gpio, PIO pio, uint sm) : m_pio{pio}, m_sm{sm} {
|
||||||
switchColor(Color::OFF);
|
switchColor(Color::OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WS2812::switchColor(Color color) {
|
void WS2812::switchColor(Color color) { putPixel(static_cast<uint32_t>(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); }
|
void WS2812::putPixel(uint32_t pixel_grb) { pio_sm_put_blocking(m_pio, m_sm, pixel_grb << 8u); }
|
|
@ -18,6 +18,7 @@ class WS2812 {
|
||||||
public:
|
public:
|
||||||
WS2812(uint gpio, PIO pio = pio0, uint sm = 0);
|
WS2812(uint gpio, PIO pio = pio0, uint sm = 0);
|
||||||
void switchColor(Color color);
|
void switchColor(Color color);
|
||||||
|
void blinkReady();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void putPixel(uint32_t pixel_rgb);
|
void putPixel(uint32_t pixel_rgb);
|
||||||
|
|
Loading…
Reference in a new issue