137 lines
4.1 KiB
C++
137 lines
4.1 KiB
C++
// -*- mode: c++ -*-
|
|
// Copyright 2016 Keyboardio, inc. <jesse@keyboard.io>
|
|
// See "LICENSE" for license details
|
|
|
|
#ifndef BUILD_INFORMATION
|
|
#define BUILD_INFORMATION "wxcafe"
|
|
#endif
|
|
|
|
|
|
#include "Kaleidoscope.h"
|
|
#include "Kaleidoscope-Steno.h"
|
|
#include "Kaleidoscope-Ranges.h"
|
|
#include "Kaleidoscope-Macros.h"
|
|
#include "Kaleidoscope-Unicode.h"
|
|
#include "Kaleidoscope-LEDControl.h"
|
|
#include "Kaleidoscope-MouseKeys.h"
|
|
#include "LED-Off.h"
|
|
#include "Kaleidoscope-LEDEffect-BootGreeting.h"
|
|
#include "Kaleidoscope-LEDEffect-SolidColor.h"
|
|
#include "Kaleidoscope-LEDEffect-Rainbow.h"
|
|
|
|
/* Macro Enum */
|
|
enum {
|
|
MACRO_ANY,
|
|
MACRO_CLAP,
|
|
MACRO_ACK,
|
|
};
|
|
|
|
enum {QWERTY, FUNCTION, STENO}; // layers
|
|
|
|
// *INDENT-OFF*
|
|
|
|
|
|
KEYMAPS(
|
|
|
|
[QWERTY] = KEYMAP_STACKED
|
|
(___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext,
|
|
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
|
|
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G,
|
|
Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
|
|
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
|
|
ShiftToLayer(FUNCTION),
|
|
|
|
M(MACRO_ANY), Key_6, Key_7, Key_8, Key_9, Key_0, ___,
|
|
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals,
|
|
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
|
|
Key_LeftAlt, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
|
|
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
|
|
ShiftToLayer(FUNCTION)),
|
|
|
|
[FUNCTION] = KEYMAP_STACKED
|
|
(LockLayer(STENO), Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, XXX,
|
|
M(MACRO_CLAP), M(MACRO_ACK), Key_UpArrow, ___, ___, ___, ___,
|
|
Key_Home, Key_LeftArrow, Key_DownArrow, Key_RightArrow, ___, ___,
|
|
Key_End, Key_PrintScreen, Key_Insert, ___, Key_mouseBtnM, ___, ___,
|
|
___, Key_Delete, ___, ___,
|
|
___,
|
|
|
|
Consumer_ScanPreviousTrack, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10, Key_F11,
|
|
Consumer_PlaySlashPause, Consumer_ScanNextTrack, Key_LeftCurlyBracket, Key_RightCurlyBracket, Key_LeftBracket, Key_RightBracket, Key_F12,
|
|
Key_LeftArrow, Key_DownArrow, Key_UpArrow, Key_RightArrow, Key_PageUp, Key_PageDown,
|
|
___ , Consumer_Mute, Consumer_VolumeDecrement, Consumer_VolumeIncrement, ___, Key_Backslash, Key_Pipe,
|
|
___, ___, Key_Enter, ___,
|
|
___),
|
|
|
|
|
|
[STENO] = KEYMAP_STACKED
|
|
(UnlockLayer(STENO), ___, ___, ___, ___, ___, S(N6),
|
|
___, S(N1), S(N2), S(N3), S(N4), S(N5), S(ST1),
|
|
___, S(FN), S(S1), S(TL), S(PL), S(HL),
|
|
___, S(PWR), S(S2), S(KL), S(WL), S(RL), S(ST2),
|
|
|
|
S(RE1), ___, S(A), S(O),
|
|
___,
|
|
|
|
S(N7), ___, ___, ___, ___, ___, ___,
|
|
S(ST3), S(N8), S(N9), S(NA), S(NB), S(NC), ___,
|
|
S(FR), S(PR), S(LR), S(TR), S(DR), ___,
|
|
S(ST4), S(RR), S(BR), S(GR), S(SR), S(ZR), ___,
|
|
|
|
S(E), S(U), ___, S(RE2),
|
|
___)
|
|
)
|
|
|
|
/* Re-enable astyle's indent enforcement */
|
|
// *INDENT-ON*
|
|
|
|
static void anyKeyMacro(uint8_t keyState) {
|
|
static Key lastKey;
|
|
bool toggledOn = false;
|
|
if (keyToggledOn(keyState)) {
|
|
lastKey.keyCode = Key_A.keyCode + (uint8_t)(millis() % 36);
|
|
toggledOn = true;
|
|
}
|
|
|
|
if (keyIsPressed(keyState)) {
|
|
kaleidoscope::hid::pressKey(lastKey, toggledOn);
|
|
}
|
|
}
|
|
|
|
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
|
|
switch (macroIndex) {
|
|
|
|
case MACRO_ANY:
|
|
anyKeyMacro(keyState);
|
|
break;
|
|
|
|
case MACRO_CLAP:
|
|
if (keyToggledOn(keyState))
|
|
Unicode.type(0x1F44F);
|
|
break;
|
|
|
|
case MACRO_ACK:
|
|
if (keyToggledOn(keyState))
|
|
Macros.type(PSTR("ack"));
|
|
break;
|
|
}
|
|
|
|
return MACRO_NONE;
|
|
}
|
|
|
|
static kaleidoscope::LEDSolidColor solidWhite(120, 120, 120);
|
|
|
|
KALEIDOSCOPE_INIT_PLUGINS(LEDControl, LEDOff, BootGreetingEffect, LEDRainbowWaveEffect, solidWhite, Macros, GeminiPR);
|
|
|
|
void setup() {
|
|
Serial.begin(9600);
|
|
Kaleidoscope.setup();
|
|
|
|
LEDRainbowWaveEffect.brightness(100);
|
|
//LEDOff.activate();
|
|
}
|
|
|
|
void loop() {
|
|
Kaleidoscope.loop();
|
|
}
|