Pridani stop metody

This commit is contained in:
Pavel Brychta 2021-07-16 11:30:25 +02:00
parent 692a25771a
commit b8e9092035
4 changed files with 21 additions and 4 deletions

View File

@ -1,4 +1,4 @@
MIT License Copyright (c) 2019,2020 xPablo.cz MIT License Copyright (c) 2019-2021 xPablo.cz
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

4
library.json Normal file
View File

@ -0,0 +1,4 @@
{
"name": "WSLed",
"version": "0.0.0+20210128092328"
}

View File

@ -121,7 +121,7 @@ void wsLED::begin(void)
} }
} }
void wsLED::setColor(LEDRGB &color) void wsLED::setColor(LEDRGB color)
{ {
_color[(_order >> 6) & 7] = color.r; _color[(_order >> 6) & 7] = color.r;
@ -241,3 +241,15 @@ ledstate_t wsLED::getState(void)
return _ledState; return _ledState;
} }
void wsLED::stop(void)
{
if (NOT_A_PIN != _pin) {
_handler.detach();
_ledState = LED_STOP;
_scale = 0xff;
setColor(LEDRGB(0, 0, 0));
show();
}
}

View File

@ -141,7 +141,7 @@ protected:
bool canShow(void); bool canShow(void);
void show(void); void show(void);
void setColor(LEDRGB &color); void setColor(LEDRGB color);
#if defined(ARDUINO_ARCH_ESP32) #if defined(ARDUINO_ARCH_ESP32)
portMUX_TYPE _mux = portMUX_INITIALIZER_UNLOCKED; portMUX_TYPE _mux = portMUX_INITIALIZER_UNLOCKED;
#endif #endif
@ -159,6 +159,7 @@ public:
void setOrder(int neworder); void setOrder(int neworder);
ledstate_t getState(void); ledstate_t getState(void);
void pulse(LEDRGB color, uint32_t duration); void pulse(LEDRGB color, uint32_t duration);
void stop(void);
}; };
#endif #endif