Kaleidoscope
EEPROM-Keymap-Programmer.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*-
2  * Kaleidoscope-EEPROM-Keymap-Programmer -- On-the-fly reprogrammable keymap.
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 {
26  public:
27  typedef enum {
30  } mode_t;
31  static mode_t mode;
32 
34 
35  void begin(void) final;
36 
37  static void activate(void) {
38  nextState();
39  }
40  static void nextState(void);
41  static void cancel(void);
42 
43  static bool focusHook(const char *command);
44 
45  private:
46  typedef enum {
47  INACTIVE,
48  WAIT_FOR_KEY,
49  WAIT_FOR_CODE,
50  WAIT_FOR_SOURCE_KEY,
51  } state_t;
52  static state_t state_;
53 
54  static uint16_t update_position_; // layer, row, col
55  static Key new_key_;
56 
57  static Key eventHandlerHook(Key mapped_key, byte row, byte col, uint8_t key_state);
58 };
59 }
60 
62 
63 #define FOCUS_HOOK_KEYMAP_PROGRAMMER FOCUS_HOOK(EEPROMKeymapProgrammer.focusHook, \
64  "keymap.toggleProgrammer")
Definition: EEPROM-Keymap-Programmer.h:28
Definition: hid.cpp:4
byte byte col
Definition: TapDance.cpp:229
static void activate(void)
Definition: EEPROM-Keymap-Programmer.h:37
Definition: key_defs.h:13
static bool focusHook(const char *command)
Definition: EEPROM-Keymap-Programmer.cpp:104
void begin(void) final
Definition: EEPROM-Keymap-Programmer.cpp:30
Definition: Kaleidoscope.h:40
static mode_t mode
Definition: EEPROM-Keymap-Programmer.h:31
EEPROMKeymapProgrammer(void)
Definition: EEPROM-Keymap-Programmer.cpp:27
Definition: EEPROM-Keymap-Programmer.h:25
byte row
Definition: TapDance.cpp:229
static void nextState(void)
Definition: EEPROM-Keymap-Programmer.cpp:34
static void cancel(void)
Definition: EEPROM-Keymap-Programmer.cpp:53
Definition: EEPROM-Keymap-Programmer.h:29
mode_t
Definition: EEPROM-Keymap-Programmer.h:27