Kaleidoscope
LED-Palette-Theme.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*-
2  * Kaleidoscope-LED-Palette-Theme -- Palette-based LED theme foundation
3  * Copyright (C) 2017 Gergely Nagy
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #pragma once
20 
21 #include <Kaleidoscope.h>
23 
24 namespace kaleidoscope {
25 
27  public:
28  LEDPaletteTheme(void);
29 
30  void begin(void) final;
31 
32  static uint16_t reserveThemes(uint8_t max_themes);
33  static void updateHandler(uint16_t theme_base, uint8_t theme);
34 
35  static const uint8_t lookupColorIndexAtPosition(uint16_t theme_base, uint16_t position);
36  static const bool lookupColorAtPosition(uint16_t theme_base, uint16_t position, cRGB *color);
37  static void updateColorIndexAtPosition(uint16_t theme_base, uint16_t position, uint8_t color_index);
38 
39  static const cRGB lookupPaletteColor(uint8_t palette_index);
40 
41  static bool paletteFocusHook(const char *command);
42  static bool themeFocusHandler(const char *command, const char *expected_command,
43  uint16_t theme_base, uint8_t max_themes);
44 
45  static uint8_t transparent_index;
46 
47  private:
48  static uint16_t palette_base_;
49 };
50 
51 }
52 
54 
55 #define FOCUS_HOOK_LEDPALETTETHEME \
56  FOCUS_HOOK(LEDPaletteTheme.paletteFocusHook, \
57  "palette")
static const cRGB lookupPaletteColor(uint8_t palette_index)
Definition: LED-Palette-Theme.cpp:79
Definition: hid.cpp:4
static void updateColorIndexAtPosition(uint16_t theme_base, uint16_t position, uint8_t color_index)
Definition: LED-Palette-Theme.cpp:86
static bool themeFocusHandler(const char *command, const char *expected_command, uint16_t theme_base, uint8_t max_themes)
Definition: LED-Palette-Theme.cpp:131
Definition: LED-Palette-Theme.h:26
static void updateHandler(uint16_t theme_base, uint8_t theme)
Definition: LED-Palette-Theme.cpp:43
Definition: Kaleidoscope-Hardware-Shortcut.h:29
void begin(void) final
Definition: LED-Palette-Theme.cpp:32
static uint16_t reserveThemes(uint8_t max_themes)
Definition: LED-Palette-Theme.cpp:39
static const uint8_t lookupColorIndexAtPosition(uint16_t theme_base, uint16_t position)
Definition: LED-Palette-Theme.cpp:56
Definition: Kaleidoscope.h:40
static bool paletteFocusHook(const char *command)
Definition: LED-Palette-Theme.cpp:100
static uint8_t transparent_index
Definition: LED-Palette-Theme.h:45
LEDPaletteTheme(void)
Definition: LED-Palette-Theme.cpp:29
static const bool lookupColorAtPosition(uint16_t theme_base, uint16_t position, cRGB *color)
Definition: LED-Palette-Theme.cpp:68