Kaleidoscope Style Guide conformance

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/389/head
Gergely Nagy 7 years ago
parent 31e2151cf7
commit 523cb38ff5

@ -5,9 +5,9 @@
[travis:image]: https://travis-ci.org/keyboardio/Kaleidoscope-Escape-OneShot.svg?branch=master
[travis:status]: https://travis-ci.org/keyboardio/Kaleidoscope-Escape-OneShot
[st:stable]: https://img.shields.io/badge/stable-✔-black.png?style=flat&colorA=44cc11&colorB=494e52
[st:broken]: https://img.shields.io/badge/broken-X-black.png?style=flat&colorA=e05d44&colorB=494e52
[st:experimental]: https://img.shields.io/badge/experimental----black.png?style=flat&colorA=dfb317&colorB=494e52
[st:stable]: https://img.shields.io/badge/stable-✔-black.svg?style=flat&colorA=44cc11&colorB=494e52
[st:broken]: https://img.shields.io/badge/broken-X-black.svg?style=flat&colorA=e05d44&colorB=494e52
[st:experimental]: https://img.shields.io/badge/experimental----black.svg?style=flat&colorA=dfb317&colorB=494e52
Turn the `Esc` key into a special key, that can cancel any active `OneShot`
effect - or act as the normal `Esc` key if none are active. For those times when
@ -24,9 +24,9 @@ configuration is necessary.
#include <Kaleidoscope-Escape-OneShot.h>
void setup () {
Kaleidoscope.setup (KEYMAP_SIZE);
USE_PLUGINS(&OneShot, &EscapeOneShot);
Kaleidoscope.use (&OneShot, &EscapeOneShot, NULL);
Kaleidoscope.setup ();
}
```

@ -62,8 +62,8 @@ const Key keymaps[][ROWS][COLS] PROGMEM = {
};
void setup() {
Kaleidoscope.use(&OneShot, &EscapeOneShot, NULL);
Kaleidoscope.setup(KEYMAP_SIZE);
USE_PLUGINS(&OneShot, &EscapeOneShot);
Kaleidoscope.setup();
}
void loop() {

@ -20,30 +20,29 @@
#include <Kaleidoscope-OneShot.h>
#include <Kaleidoscope-Escape-OneShot.h>
namespace KaleidoscopePlugins {
namespace kaleidoscope {
EscapeOneShot::EscapeOneShot(void) {
}
void
EscapeOneShot::begin(void) {
void EscapeOneShot::begin(void) {
event_handler_hook_use(eventHandlerHook);
}
Key
EscapeOneShot::eventHandlerHook(Key mappedKey, byte row, byte col, uint8_t keyState) {
if (mappedKey.raw != Key_Escape.raw ||
(keyState & INJECTED) ||
!key_toggled_on(keyState))
return mappedKey;
Key EscapeOneShot::eventHandlerHook(Key mapped_key, byte row, byte col, uint8_t key_state) {
if (mapped_key.raw != Key_Escape.raw ||
(key_state & INJECTED) ||
!key_toggled_on(key_state))
return mapped_key;
if (!OneShot::isActive())
return mappedKey;
if (!OneShot.isActive())
return mapped_key;
OneShot::cancel();
OneShot.cancel();
return Key_NoKey;
}
};
KaleidoscopePlugins::EscapeOneShot EscapeOneShot;
}
kaleidoscope::EscapeOneShot EscapeOneShot;

@ -16,9 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <Kaleidoscope.h>
namespace KaleidoscopePlugins {
namespace kaleidoscope {
class EscapeOneShot : public KaleidoscopePlugin {
public:
EscapeOneShot(void);
@ -26,8 +28,8 @@ class EscapeOneShot : public KaleidoscopePlugin {
void begin(void) final;
private:
static Key eventHandlerHook(Key mappedKey, byte row, byte col, uint8_t keyState);
};
static Key eventHandlerHook(Key mapped_key, byte row, byte col, uint8_t key_state);
};
}
extern KaleidoscopePlugins::EscapeOneShot EscapeOneShot;
extern kaleidoscope::EscapeOneShot EscapeOneShot;

Loading…
Cancel
Save