diff --git a/README.md b/README.md index 56ab1017..9fa01646 100644 --- a/README.md +++ b/README.md @@ -5,26 +5,4 @@ [travis:image]: https://travis-ci.org/keyboardio/Kaleidoscope-LEDEffect-SolidColor.svg?branch=master [travis:status]: https://travis-ci.org/keyboardio/Kaleidoscope-LEDEffect-SolidColor -This plugin provides tools to build LED effects that set the entire keyboard to -a single color. For show, and for backlighting purposes. - -## Using the extension - -To use the plugin, include the header, declare an effect using the -`LEDSolidColor` class, and tell the firmware to use the new effect: - -```c++ -#include - -static LEDSolidColor solidRed(160, 0, 0); - -KALEIDOSCOPE_INIT_PLUGINS(LEDControl, solidRed); - -void setup() { - Kaleidoscope.setup(); -} -``` - -## Dependencies - -* [Kaleidoscope-LEDControl](https://github.com/keyboardio/Kaleidoscope-LEDControl) +See [doc/plugin/LEDEffect-SolidColor.md](doc/plugin/LEDEffect-SolidColor.md) for documentation. diff --git a/doc/plugin/LEDEffect-SolidColor.md b/doc/plugin/LEDEffect-SolidColor.md new file mode 100644 index 00000000..d5036233 --- /dev/null +++ b/doc/plugin/LEDEffect-SolidColor.md @@ -0,0 +1,33 @@ +# Kaleidoscope-LEDEffect-SolidColor + +This plugin provides tools to build LED effects that set the entire keyboard to +a single color. For show, and for backlighting purposes. + +## Using the extension + +To use the plugin, include the header, declare an effect using the +`kaleidoscope::plugin::LEDSolidColor` class, and tell the firmware to use the +new effect: + +```c++ +#include + +static kaleidoscope::plugin::LEDSolidColor solidRed(160, 0, 0); + +KALEIDOSCOPE_INIT_PLUGINS(LEDControl, solidRed); + +void setup() { + Kaleidoscope.setup(); +} +``` + +## Dependencies + +* [Kaleidoscope-LEDControl](https://github.com/keyboardio/Kaleidoscope-LEDControl) + +## Upgrading + +Previous versions of `LEDEffect-SolidColor` used `kaleidoscope::LEDSolidColor` +as a class for defining solid-color effects. This is called +`kaleidoscope::plugin::LEDSolidColor` now. The old name still works, but is +deprecated, and will be removed by 2019-01-14. diff --git a/src/Kaleidoscope-LEDEffect-SolidColor.h b/src/Kaleidoscope-LEDEffect-SolidColor.h index d91d7553..1fc4259b 100644 --- a/src/Kaleidoscope-LEDEffect-SolidColor.h +++ b/src/Kaleidoscope-LEDEffect-SolidColor.h @@ -16,18 +16,4 @@ #pragma once -#include "Kaleidoscope-LEDControl.h" - -namespace kaleidoscope { -class LEDSolidColor : public LEDMode { - public: - LEDSolidColor(uint8_t r, uint8_t g, uint8_t b); - - protected: - void onActivate(void) final; - void refreshAt(byte row, byte col) final; - - private: - uint8_t r, g, b; -}; -} +#include "kaleidoscope/plugin/LEDEffect-SolidColor.h" diff --git a/src/Kaleidoscope-LEDEffect-SolidColor.cpp b/src/kaleidoscope/plugin/LEDEffect-SolidColor.cpp similarity index 98% rename from src/Kaleidoscope-LEDEffect-SolidColor.cpp rename to src/kaleidoscope/plugin/LEDEffect-SolidColor.cpp index afbece7d..d030e86d 100644 --- a/src/Kaleidoscope-LEDEffect-SolidColor.cpp +++ b/src/kaleidoscope/plugin/LEDEffect-SolidColor.cpp @@ -17,6 +17,7 @@ #include "Kaleidoscope-LEDEffect-SolidColor.h" namespace kaleidoscope { +namespace plugin { LEDSolidColor::LEDSolidColor(uint8_t r, uint8_t g, uint8_t b) { this->r = r; this->g = g; @@ -30,4 +31,6 @@ void LEDSolidColor::onActivate(void) { void LEDSolidColor::refreshAt(byte row, byte col) { ::LEDControl.setCrgbAt(row, col, CRGB(r, g, b)); } + +} } diff --git a/src/kaleidoscope/plugin/LEDEffect-SolidColor.h b/src/kaleidoscope/plugin/LEDEffect-SolidColor.h new file mode 100644 index 00000000..b79bbf72 --- /dev/null +++ b/src/kaleidoscope/plugin/LEDEffect-SolidColor.h @@ -0,0 +1,39 @@ +/* Kaleidoscope-LEDEffect-SolidColor - Solid color LED effects for Kaleidoscope. + * Copyright (C) 2017 Keyboard.io, Inc. + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#pragma once + +#include "Kaleidoscope-LEDControl.h" + +namespace kaleidoscope { +namespace plugin { +class LEDSolidColor : public LEDMode { + public: + LEDSolidColor(uint8_t r, uint8_t g, uint8_t b); + + protected: + void onActivate(void) final; + void refreshAt(byte row, byte col) final; + + private: + uint8_t r, g, b; +}; +} + +// Backwards compatibility +typedef plugin::LEDSolidColor LEDSolidColor; + +}