Add getters for brightness and update_delay

Makes it easier to implement #8 as a macro.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/365/head
Gergely Nagy 7 years ago
parent 4dbb601cdb
commit 95789d3777

@ -41,16 +41,17 @@ void setup() {
The plugin provides two objects: `LEDRainbowEffect`, and `LEDRainbowWaveEffect`, The plugin provides two objects: `LEDRainbowEffect`, and `LEDRainbowWaveEffect`,
both of which provide the following methods: both of which provide the following methods:
### `.brightness(brightness)` ### `.brightness([brightness])`
> Sets the LED brightness for the effect. > Sets (or gets, if called without an argument) the LED brightness for the
> effect.
> >
> Defaults to 50. > Defaults to 50.
### `.update_delay(delay)` ### `.update_delay([delay])`
> Sets the number of miliseconds between effect updates. Smaller number results > Sets (or gets, if called without an argument) the number of milliseconds
> in faster rainbows. > between effect updates. Smaller number results in faster rainbows.
> >
> Defaults to 40. > Defaults to 40.

@ -9,7 +9,9 @@ class LEDRainbowEffect : public LEDMode {
LEDRainbowEffect(void) {} LEDRainbowEffect(void) {}
void brightness(byte); void brightness(byte);
byte brightness(void) { return rainbow_value; }
void update_delay(byte); void update_delay(byte);
byte update_delay(void) { return rainbow_update_delay; }
void update(void) final; void update(void) final;
private: private:
@ -29,7 +31,9 @@ class LEDRainbowWaveEffect : public LEDMode {
LEDRainbowWaveEffect(void) {} LEDRainbowWaveEffect(void) {}
void brightness(byte); void brightness(byte);
byte brightness(void) { return rainbow_value; }
void update_delay(byte); void update_delay(byte);
byte update_delay(void) { return rainbow_update_delay; }
void update(void) final; void update(void) final;
private: private:

Loading…
Cancel
Save