Pridani stop metody
This commit is contained in:
@ -55,7 +55,7 @@ void wsLED::show(void)
|
||||
uint32_t mask = 1 << (BITS_PER_LED_CMD - 1);
|
||||
for (uint32_t bit = 0; bit < BITS_PER_LED_CMD; bit++) {
|
||||
uint32_t bit_is_set = bits_to_send & mask;
|
||||
led_data_buffer[bit] = bit_is_set ? (rmt_item32_t) {{{T1H, 1, TL, 0}}} : (rmt_item32_t) {{{T0H, 1, TL, 0}}};
|
||||
led_data_buffer[bit] = bit_is_set ? (rmt_item32_t) {{{T1H, 1, TL, 0}}} : (rmt_item32_t) {{{T0H, 1, TL, 0}}};
|
||||
mask >>= 1;
|
||||
}
|
||||
ESP_ERROR_CHECK(rmt_write_items(LED_RMT_TX_CHANNEL, led_data_buffer, LED_BUFFER_ITEMS, false));
|
||||
@ -121,7 +121,7 @@ void wsLED::begin(void)
|
||||
}
|
||||
}
|
||||
|
||||
void wsLED::setColor(LEDRGB &color)
|
||||
void wsLED::setColor(LEDRGB color)
|
||||
{
|
||||
|
||||
_color[(_order >> 6) & 7] = color.r;
|
||||
@ -241,3 +241,15 @@ ledstate_t wsLED::getState(void)
|
||||
|
||||
return _ledState;
|
||||
}
|
||||
|
||||
void wsLED::stop(void)
|
||||
{
|
||||
|
||||
if (NOT_A_PIN != _pin) {
|
||||
_handler.detach();
|
||||
_ledState = LED_STOP;
|
||||
_scale = 0xff;
|
||||
setColor(LEDRGB(0, 0, 0));
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ protected:
|
||||
|
||||
bool canShow(void);
|
||||
void show(void);
|
||||
void setColor(LEDRGB &color);
|
||||
void setColor(LEDRGB color);
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
portMUX_TYPE _mux = portMUX_INITIALIZER_UNLOCKED;
|
||||
#endif
|
||||
@ -159,6 +159,7 @@ public:
|
||||
void setOrder(int neworder);
|
||||
ledstate_t getState(void);
|
||||
void pulse(LEDRGB color, uint32_t duration);
|
||||
void stop(void);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user