Rearrange the file layout in preparation of becoming a monorepo

Move the documentation to `doc/plugin/Colormap.md`, sources under
`src/kaleidoscope/plugin/` (appropriately namespaced). This is in preparation of
merging plugins into a single monorepo.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/389/head
Gergely Nagy 6 years ago
parent e0bd1c18f9
commit ee3ddd5047
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -5,70 +5,4 @@
[travis:image]: https://travis-ci.org/keyboardio/Kaleidoscope-Colormap.svg?branch=master
[travis:status]: https://travis-ci.org/keyboardio/Kaleidoscope-Colormap
The `Colormap` extension provides an easier way to set up a different - static -
color map per-layer. This means that we can set up a map of colors for each key,
on a per-layer basis, and whenever a layer becomes active, the color map for
that layer is applied. Colors are picked from a 16-color palette, provided by
the [LED-Palette-Theme][plugin:l-p-t] plugin. The color map is stored in
`EEPROM`, and can be easily changed via the [FocusSerial][plugin:focusserial]
plugin, which also provides palette editing capabilities.
[plugin:focusserial]: https://github.com/keyboardio/Kaleidoscope-FocusSerial
[plugin:l-p-t]: https://github.com/keyboardio/Kaleidoscope-LED-Palette-Theme
## Using the extension
To use the extension, include the header, tell it the number of layers you have,
register the `Focus` hooks, and it will do the rest.
```c++
#include <Kaleidoscope.h>
#include <Kaleidoscope-EEPROM-Settings.h>
#include <Kaleidoscope-Colormap.h>
#include <Kaleidoscope-FocusSerial.h>
#include <Kaleidoscope-LED-Palette-Theme.h>
KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings,
LEDPaletteTheme,
ColormapEffect,
Focus);
void setup(void) {
Kaleidoscope.setup();
ColormapEffect.max_layers(1);
}
```
## Plugin methods
The extension provides an `ColormapEffect` singleton object, with a single method:
### `.max_layers(max)`
> Tells the extension to reserve space in EEPROM for up to `max` layers. Can
> only be called once, any subsequent call will be a no-op.
## Focus commands
### `colormap.map`
> Without arguments, prints the color map: palette indexes for all layers.
>
> With arguments, updates the color map with new indexes. One does not need to
> give the full map, the plugin will process as many arguments as available, and
> ignore anything past the last key on the last layer (as set by the
> `.max_layers()` method).
## Dependencies
* [Kaleidoscope-EEPROM-Settings](https://github.com/keyboardio/Kaleidoscope-EEPROM-Settings)
* [Kaleidoscope-FocusSerial](https://github.com/keyboardio/Kaleidoscope-FocusSerial)
* [Kaleidoscope-LED-Palette-Theme](https://github.com/keyboardio/Kaleidoscope-LED-Palette-Theme)
## Further reading
Starting from the [example][plugin:example] is the recommended way of getting
started with the plugin.
[plugin:example]: https://github.com/keyboardio/Kaleidoscope-Colormap/blob/master/examples/Colormap/Colormap.ino
See [doc/plugin/Colormap.md](doc/plugin/Colormap.md) for documentation.

@ -0,0 +1,69 @@
# Kaleidoscope-Colormap
The `Colormap` extension provides an easier way to set up a different - static -
color map per-layer. This means that we can set up a map of colors for each key,
on a per-layer basis, and whenever a layer becomes active, the color map for
that layer is applied. Colors are picked from a 16-color palette, provided by
the [LED-Palette-Theme][plugin:l-p-t] plugin. The color map is stored in
`EEPROM`, and can be easily changed via the [FocusSerial][plugin:focusserial]
plugin, which also provides palette editing capabilities.
[plugin:focusserial]: https://github.com/keyboardio/Kaleidoscope-FocusSerial
[plugin:l-p-t]: https://github.com/keyboardio/Kaleidoscope-LED-Palette-Theme
## Using the extension
To use the extension, include the header, tell it the number of layers you have,
register the `Focus` hooks, and it will do the rest.
```c++
#include <Kaleidoscope.h>
#include <Kaleidoscope-EEPROM-Settings.h>
#include <Kaleidoscope-Colormap.h>
#include <Kaleidoscope-FocusSerial.h>
#include <Kaleidoscope-LED-Palette-Theme.h>
KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings,
LEDPaletteTheme,
ColormapEffect,
Focus);
void setup(void) {
Kaleidoscope.setup();
ColormapEffect.max_layers(1);
}
```
## Plugin methods
The extension provides an `ColormapEffect` singleton object, with a single method:
### `.max_layers(max)`
> Tells the extension to reserve space in EEPROM for up to `max` layers. Can
> only be called once, any subsequent call will be a no-op.
## Focus commands
### `colormap.map`
> Without arguments, prints the color map: palette indexes for all layers.
>
> With arguments, updates the color map with new indexes. One does not need to
> give the full map, the plugin will process as many arguments as available, and
> ignore anything past the last key on the last layer (as set by the
> `.max_layers()` method).
## Dependencies
* [Kaleidoscope-EEPROM-Settings](https://github.com/keyboardio/Kaleidoscope-EEPROM-Settings)
* [Kaleidoscope-FocusSerial](https://github.com/keyboardio/Kaleidoscope-FocusSerial)
* [Kaleidoscope-LED-Palette-Theme](https://github.com/keyboardio/Kaleidoscope-LED-Palette-Theme)
## Further reading
Starting from the [example][plugin:example] is the recommended way of getting
started with the plugin.
[plugin:example]: https://github.com/keyboardio/Kaleidoscope-Colormap/blob/master/examples/Colormap/Colormap.ino

@ -17,4 +17,4 @@
#pragma once
#include <Kaleidoscope/Colormap.h>
#include <kaleidoscope/plugin/Colormap.h>

@ -24,6 +24,7 @@
#include <Kaleidoscope-FocusSerial.h>
namespace kaleidoscope {
namespace plugin {
uint16_t ColormapEffect::map_base_;
uint8_t ColormapEffect::max_layers_;
@ -60,6 +61,7 @@ EventHandlerResult ColormapEffect::onFocusEvent(const char *command) {
map_base_, max_layers_);
}
}
}
kaleidoscope::ColormapEffect ColormapEffect;
kaleidoscope::plugin::ColormapEffect ColormapEffect;

@ -21,6 +21,7 @@
#include <Kaleidoscope-LED-Palette-Theme.h>
namespace kaleidoscope {
namespace plugin {
class ColormapEffect : public LEDMode {
public:
ColormapEffect(void) {}
@ -40,5 +41,6 @@ class ColormapEffect : public LEDMode {
static uint16_t map_base_;
};
}
}
extern kaleidoscope::ColormapEffect ColormapEffect;
extern kaleidoscope::plugin::ColormapEffect ColormapEffect;
Loading…
Cancel
Save