From 663b2bb2f1941fa91fbc3853fc8c87d875eb73b6 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sun, 14 Oct 2018 12:27:46 +0200 Subject: [PATCH] Rearrange the file layout in preparation of becoming a monorepo Move the documentation to `doc/plugin/LEDEffect-Chase.md`, sources under `src/kaleidoscope/plugin/` (appropriately namespaced). This is in preparation of merging plugins into a single monorepo. Signed-off-by: Gergely Nagy --- README.md | 28 +------------ doc/plugin/LEDEffect-Chase.md | 29 ++++++++++++++ src/Kaleidoscope-LEDEffect-Chase.h | 22 +--------- .../plugin/LEDEffect-Chase.cpp} | 5 ++- src/kaleidoscope/plugin/LEDEffect-Chase.h | 40 +++++++++++++++++++ 5 files changed, 75 insertions(+), 49 deletions(-) create mode 100644 doc/plugin/LEDEffect-Chase.md rename src/{Kaleidoscope-LEDEffect-Chase.cpp => kaleidoscope/plugin/LEDEffect-Chase.cpp} (97%) create mode 100644 src/kaleidoscope/plugin/LEDEffect-Chase.h diff --git a/README.md b/README.md index 86e16cb0..82971e4b 100644 --- a/README.md +++ b/README.md @@ -5,30 +5,4 @@ [travis:image]: https://travis-ci.org/keyboardio/Kaleidoscope-LEDEffect-Chase.svg?branch=master [travis:status]: https://travis-ci.org/keyboardio/Kaleidoscope-LEDEffect-Chase -A simple LED effect where one color chases another across the keyboard and back, -over and over again. Playful colors they are. - -## Using the extension - -To use the plugin, include the header, and tell the firmware to use it: - -```c++ -#include -#include - -KALEIDOSCOPE_INIT_PLUGINS(LEDControl, - LEDEffect-Chase); - -void setup() { - Kaleidoscope.setup(); -} -``` - -## Plugin methods - -The plugin provides the `LEDChaseEffect` object, which has no public methods or -properties, outside of those provided by all LED modes. - -## Dependencies - -* [Kaleidoscope-LEDControl](https://github.com/keyboardio/Kaleidoscope-LEDControl) +See [doc/plugin/LEDEffect-Chase.md](doc/plugin/LEDEffect-Chase.md) for documentation. diff --git a/doc/plugin/LEDEffect-Chase.md b/doc/plugin/LEDEffect-Chase.md new file mode 100644 index 00000000..61a6cbf4 --- /dev/null +++ b/doc/plugin/LEDEffect-Chase.md @@ -0,0 +1,29 @@ +# Kaleidoscope-LEDEffect-Chase + +A simple LED effect where one color chases another across the keyboard and back, +over and over again. Playful colors they are. + +## Using the extension + +To use the plugin, include the header, and tell the firmware to use it: + +```c++ +#include +#include + +KALEIDOSCOPE_INIT_PLUGINS(LEDControl, + LEDEffect-Chase); + +void setup() { + Kaleidoscope.setup(); +} +``` + +## Plugin methods + +The plugin provides the `LEDChaseEffect` object, which has no public methods or +properties, outside of those provided by all LED modes. + +## Dependencies + +* [Kaleidoscope-LEDControl](https://github.com/keyboardio/Kaleidoscope-LEDControl) diff --git a/src/Kaleidoscope-LEDEffect-Chase.h b/src/Kaleidoscope-LEDEffect-Chase.h index 1f3c2bcd..e755e738 100644 --- a/src/Kaleidoscope-LEDEffect-Chase.h +++ b/src/Kaleidoscope-LEDEffect-Chase.h @@ -16,24 +16,4 @@ #pragma once -#include "Kaleidoscope-LEDControl.h" -#include "LEDUtils.h" - -namespace kaleidoscope { -class LEDChaseEffect : public LEDMode { - public: - LEDChaseEffect(void) {} - - protected: - void update(void) final; - - private: - uint8_t pos = 0; - int8_t chase_sign = 1; //negative values when it's going backwar - uint8_t chase_pixels = 5; - uint8_t current_chase_counter = 0; - static const uint8_t chase_threshold = 150; -}; -} - -extern kaleidoscope::LEDChaseEffect LEDChaseEffect; +#include "kaleidoscope/plugin/LEDEffect-Chase.h" diff --git a/src/Kaleidoscope-LEDEffect-Chase.cpp b/src/kaleidoscope/plugin/LEDEffect-Chase.cpp similarity index 97% rename from src/Kaleidoscope-LEDEffect-Chase.cpp rename to src/kaleidoscope/plugin/LEDEffect-Chase.cpp index b2dfd7c9..ae8426e1 100644 --- a/src/Kaleidoscope-LEDEffect-Chase.cpp +++ b/src/kaleidoscope/plugin/LEDEffect-Chase.cpp @@ -17,6 +17,7 @@ #include "Kaleidoscope-LEDEffect-Chase.h" namespace kaleidoscope { +namespace plugin { void LEDChaseEffect::update(void) { // Check to see if it's time to change the positions of the red and blue lights if (current_chase_counter++ < chase_threshold) { @@ -58,6 +59,8 @@ void LEDChaseEffect::update(void) { if (pos2 < LED_COUNT) ::LEDControl.setCrgbAt(pos2, {255, 0, 0}); } + +} } -kaleidoscope::LEDChaseEffect LEDChaseEffect; +kaleidoscope::plugin::LEDChaseEffect LEDChaseEffect; diff --git a/src/kaleidoscope/plugin/LEDEffect-Chase.h b/src/kaleidoscope/plugin/LEDEffect-Chase.h new file mode 100644 index 00000000..6174eae5 --- /dev/null +++ b/src/kaleidoscope/plugin/LEDEffect-Chase.h @@ -0,0 +1,40 @@ +/* Kaleidoscope-LEDEffect-Chase - A Chase LED effect for Kaleidoscope. + * Copyright (C) 2017-2018 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 LEDChaseEffect : public LEDMode { + public: + LEDChaseEffect(void) {} + + protected: + void update(void) final; + + private: + uint8_t pos = 0; + int8_t chase_sign = 1; //negative values when it's going backwar + uint8_t chase_pixels = 5; + uint8_t current_chase_counter = 0; + static const uint8_t chase_threshold = 150; +}; +} +} + +extern kaleidoscope::plugin::LEDChaseEffect LEDChaseEffect;