From 6b2263cfa7b116750f5d8c0d8d04640198700da0 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sun, 4 Jun 2017 10:09:51 +0200 Subject: [PATCH] Add an .activate() method To make things friendlier to the end-user, add an `.activate()` alias to `.nextState()`, and document that. Fixes #3. Signed-off-by: Gergely Nagy --- README.md | 9 ++++----- .../EEPROM-Keymap-Programmer.ino | 2 +- src/Kaleidoscope/EEPROM-Keymap-Programmer.h | 1 + 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 22ae6de9..4668040a 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ to use a macro, as in the example below: const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { if (macroIndex == 0 && key_toggled_off(keyState)) { - EEPROMKeymapProgrammer.nextState(); + EEPROMKeymapProgrammer.activate(); } return MACRO_NONE; @@ -93,11 +93,10 @@ take over. The plugin provides the `EEPROMKeymapProgrammer` object, which has the following methods: -### `.nextState()` +### `.activate()` -> Puts the programmer into the next appropriate state. When the programmer is -> inactive, this activates it. One usually does not have to call this function -> in any other case. +> Activates the keymap programmer. This is the function one needs to call from - +> say - a macro, to enter the edit state. ### `.mode` diff --git a/examples/EEPROM-Keymap-Programmer/EEPROM-Keymap-Programmer.ino b/examples/EEPROM-Keymap-Programmer/EEPROM-Keymap-Programmer.ino index 71bf1ad2..ffd8e7e6 100644 --- a/examples/EEPROM-Keymap-Programmer/EEPROM-Keymap-Programmer.ino +++ b/examples/EEPROM-Keymap-Programmer/EEPROM-Keymap-Programmer.ino @@ -43,7 +43,7 @@ const Key keymaps[][ROWS][COLS] PROGMEM = { const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { if (macroIndex == 0 && key_toggled_off(keyState)) { - EEPROMKeymapProgrammer.nextState(); + EEPROMKeymapProgrammer.activate(); } return MACRO_NONE; diff --git a/src/Kaleidoscope/EEPROM-Keymap-Programmer.h b/src/Kaleidoscope/EEPROM-Keymap-Programmer.h index 5c15b188..8032c6a9 100644 --- a/src/Kaleidoscope/EEPROM-Keymap-Programmer.h +++ b/src/Kaleidoscope/EEPROM-Keymap-Programmer.h @@ -34,6 +34,7 @@ class EEPROMKeymapProgrammer : public KaleidoscopePlugin { void begin(void) final; + static void activate(void) { nextState(); } static void nextState(void); static void cancel(void);