summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2017-02-11 11:49:00 -0500
committerGitHub <noreply@github.com>2017-02-11 11:49:00 -0500
commit6bb479ea45183cd2d9966ef660f8126cbfd3d849 (patch)
treece8b552f58b3c4887225f4a4b808045252deee0c
parent5bdddb7821a229470d9895ace8686b9fcf37494a (diff)
parent4163a3819ee4cdd49446da612a6ef3f74091ede1 (diff)
downloadqmk_firmware-6bb479ea45183cd2d9966ef660f8126cbfd3d849.tar.gz
qmk_firmware-6bb479ea45183cd2d9966ef660f8126cbfd3d849.zip
Merge pull request #1085 from priyadi/promethium
Promethium keyboard layout update
-rw-r--r--keyboards/handwired/promethium/config.h89
-rw-r--r--keyboards/handwired/promethium/keymaps/priyadi/config.h7
-rw-r--r--keyboards/handwired/promethium/keymaps/priyadi/keymap.c875
-rw-r--r--keyboards/handwired/promethium/promethium.c36
-rw-r--r--keyboards/handwired/promethium/promethium.h9
-rw-r--r--keyboards/handwired/promethium/rgbsps.c51
-rw-r--r--keyboards/handwired/promethium/rgbsps.h3
-rw-r--r--keyboards/handwired/promethium/rules.mk3
8 files changed, 780 insertions, 293 deletions
diff --git a/keyboards/handwired/promethium/config.h b/keyboards/handwired/promethium/config.h
index 23fbfd0b9a..fd45c2bfe3 100644
--- a/keyboards/handwired/promethium/config.h
+++ b/keyboards/handwired/promethium/config.h
@@ -43,38 +43,107 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROW_PINS { D7, C6, D0, D1, F5, F4, F1, F0 }
#define UNUSED_PINS
-/* COL2ROW or ROW2COL */
+/*
+ * Keyboard Matrix Assignments
+ *
+ * Change this to how you wired your keyboard
+ * COLS: AVR pins used for columns, left to right
+ * ROWS: AVR pins used for rows, top to bottom
+ * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
+ * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
+ *
+*/
#define DIODE_DIRECTION COL2ROW
-/* define if matrix has ghost */
+// #define BACKLIGHT_PIN B7
+// #define BACKLIGHT_BREATHING
+// #define BACKLIGHT_LEVELS 3
+
+/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
+#define DEBOUNCING_DELAY 5
+
+/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST
/* number of backlight levels */
-#define BACKLIGHT_LEVELS 3
-
-/* Set 0 if debouncing isn't needed */
-#define DEBOUNCING_DELAY 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
-#define LOCKING_SUPPORT_ENABLE
+// #define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
-#define LOCKING_RESYNC_ENABLE
+// #define LOCKING_RESYNC_ENABLE
+
+/*
+ * Force NKRO
+ *
+ * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
+ * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
+ * makefile for this to work.)
+ *
+ * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
+ * until the next keyboard reset.
+ *
+ * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
+ * fully operational during normal computer usage.
+ *
+ * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
+ * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
+ * bootmagic, NKRO mode will always be enabled until it is toggled again during a
+ * power-up.
+ *
+ */
+//#define FORCE_NKRO
/* key combination for command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT) | MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RCTRL)) \
)
+/* control how magic key switches layers */
+//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
+//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
+//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
+
+/* override magic key keymap */
+//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
+//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
+//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
+//#define MAGIC_KEY_HELP1 H
+//#define MAGIC_KEY_HELP2 SLASH
+//#define MAGIC_KEY_DEBUG D
+//#define MAGIC_KEY_DEBUG_MATRIX X
+//#define MAGIC_KEY_DEBUG_KBD K
+//#define MAGIC_KEY_DEBUG_MOUSE M
+//#define MAGIC_KEY_VERSION V
+//#define MAGIC_KEY_STATUS S
+//#define MAGIC_KEY_CONSOLE C
+//#define MAGIC_KEY_LAYER0_ALT1 ESC
+//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
+//#define MAGIC_KEY_LAYER0 0
+//#define MAGIC_KEY_LAYER1 1
+//#define MAGIC_KEY_LAYER2 2
+//#define MAGIC_KEY_LAYER3 3
+//#define MAGIC_KEY_LAYER4 4
+//#define MAGIC_KEY_LAYER5 5
+//#define MAGIC_KEY_LAYER6 6
+//#define MAGIC_KEY_LAYER7 7
+//#define MAGIC_KEY_LAYER8 8
+//#define MAGIC_KEY_LAYER9 9
+//#define MAGIC_KEY_BOOTLOADER PAUSE
+//#define MAGIC_KEY_LOCK CAPS
+//#define MAGIC_KEY_EEPROM E
+//#define MAGIC_KEY_NKRO N
+//#define MAGIC_KEY_SLEEP_LED Z
+
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
/* disable debug print */
-//#define NO_DEBUG
+// #define NO_DEBUG
/* disable print */
-//#define NO_PRINT
+// #define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
diff --git a/keyboards/handwired/promethium/keymaps/priyadi/config.h b/keyboards/handwired/promethium/keymaps/priyadi/config.h
index 8b78c0dc4f..53059ca7d4 100644
--- a/keyboards/handwired/promethium/keymaps/priyadi/config.h
+++ b/keyboards/handwired/promethium/keymaps/priyadi/config.h
@@ -14,4 +14,11 @@
#define RGB_DI_PIN B5
#define RGBSPS_NUM 57
+#define LAYOUT_DVORAK
+#define LAYOUT_COLEMAK
+#define LAYOUT_NORMAN
+#define LAYOUT_WORKMAN
+
+#define DOUBLESPACE_LAYER_ENABLE
+
#endif
diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c
index 7ae269563f..1ad34612e3 100644
--- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c
+++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c
@@ -3,40 +3,75 @@
#include "promethium.h"
#include "action_layer.h"
-#ifdef AUDIO_ENABLE
- #include "audio.h"
- #include "musical_notes.h"
-#endif
#include "eeconfig.h"
#include "process_unicode.h"
#include "quantum.h"
#include "rgbsps.h"
#include "ps2_mouse.h"
#include "ps2.h"
+#include "outputselect.h"
+#include "led.h"
#define COUNT(x) (sizeof (x) / sizeof (*(x)))
-// #define RGBLED_NUM 5
-// struct cRGB led[RGBLED_NUM];
+// Fillers to make layering clearer
+#define _______ KC_TRNS
+#define XXXXXXX KC_NO
+#define G(x) LGUI(x)
+#define KC_WWWB KC_WWW_BACK
+#define KC_WWWF KC_WWW_FORWARD
+
+// hybrid right-alt & scroll lock (mapped to Compose in OS)
+#undef KC_RALT
+#define KC_RALT MT(MOD_RALT, KC_SLCK)
+
+bool capslock = false;
+#ifdef DOUBLESPACE_LAYER_ENABLE
+bool lspace_active = false;
+bool rspace_active = false;
+bool lspace_emitted = false;
+bool rspace_emitted = false;
+bool space_layer_entered = false;
+#endif
+// glow
+enum glow_modes {
+ GLOW_NONE,
+ GLOW_MIN,
+ GLOW_FULL
+};
+uint8_t glow_mode = GLOW_MIN;
extern keymap_config_t keymap_config;
enum layers {
_QWERTY,
+ _DVORAK,
_COLEMAK,
_WORKMAN,
+ _NORMAN,
+
_PUNC,
_NUM,
_FUNC,
+
+ _GREEKU,
+ _GREEKL,
+
_EMOJI,
_GUI,
+ _SYS,
};
+// double-space layer
+#define _SPACE _GUI
+
enum planck_keycodes {
// layouts
QWERTY = SAFE_RANGE,
+ DVORAK,
COLEMAK,
WORKMAN,
+ NORMAN,
// layer switchers
PUNC,
@@ -44,17 +79,19 @@ enum planck_keycodes {
FUNC,
EMOJI,
GUI,
+ GREEK,
// os switchers
LINUX,
WIN,
OSX,
-};
-// Fillers to make layering clearer
-
-#define _______ KC_TRNS
-#define XXXXXXX KC_NO
+ // others
+ LSPACE,
+ RSPACE,
+ GLOW,
+ AUDIO
+};
// unicode map
@@ -106,6 +143,59 @@ enum unicode_name {
SUN, // sun
MOON, // moon
SKULL, // skull
+
+ // greek letters
+ UALPH,
+ UBETA,
+ UGAMM,
+ UDELT,
+ UEPSI,
+ UZETA,
+ UETA,
+ UTHET,
+ UIOTA,
+ UKAPP,
+ ULAMB,
+ UMU,
+ UNU,
+ UXI,
+ UOMIC,
+ UPI,
+ URHO,
+ USIGM,
+ UTAU,
+ UUPSI,
+ UPHI,
+ UCHI,
+ UPSI,
+ UOMEG,
+
+ LALPH,
+ LBETA,
+ LGAMM,
+ LDELT,
+ LEPSI,
+ LZETA,
+ LETA,
+ LTHET,
+ LIOTA,
+ LKAPP,
+ LLAMB,
+ LMU,
+ LNU,
+ LXI,
+ LOMIC,
+ LPI,
+ LRHO,
+ LSIGM,
+ LTAU,
+ LUPSI,
+ LPHI,
+ LCHI,
+ LPSI,
+ LOMEG,
+
+ FSIGM,
};
const uint32_t PROGMEM unicode_map[] = {
@@ -156,19 +246,58 @@ const uint32_t PROGMEM unicode_map[] = {
[SUN] = 0x2600,
[MOON] = 0x1F314,
[SKULL] = 0x1F480,
-};
-
-// hybrid shift - =
-// #undef KC_LSFT
-// #define KC_LSFT MT(MOD_LSFT, KC_MINS)
-// #undef KC_RSFT
-// #define KC_RSFT MT(MOD_LSFT, KC_EQL)
-
-
-// hybrid right-gui & scroll lock (mapped to Compose in OS)
-#undef KC_RCTL
-#define KC_RCTL MT(MOD_LCTL, KC_SLCK)
+ // greek letters
+ [UALPH] = 0x0391,
+ [UBETA] = 0x0392,
+ [UGAMM] = 0x0393,
+ [UDELT] = 0x0394,
+ [UEPSI] = 0x0395,
+ [UZETA] = 0x0396,
+ [UETA] = 0x0397,
+ [UTHET] = 0x0398,
+ [UIOTA] = 0x0399,
+ [UKAPP] = 0x039A,
+ [ULAMB] = 0x039B,
+ [UMU] = 0x039C,
+ [UNU] = 0x039D,
+ [UXI] = 0x039E,
+ [UOMIC] = 0x039F,
+ [UPI] = 0x03A0,
+ [URHO] = 0x03A1,
+ [USIGM] = 0x03A3,
+ [UTAU] = 0x03A4,
+ [UUPSI] = 0x03A5,
+ [UPHI] = 0x03A6,
+ [UCHI] = 0x03A7,
+ [UPSI] = 0x03A8,
+ [UOMEG] = 0x03A9,
+ [LALPH] = 0x03B1,
+ [LBETA] = 0x03B2,
+ [LGAMM] = 0x03B3,
+ [LDELT] = 0x03B4,
+ [LEPSI] = 0x03B5,
+ [LZETA] = 0x03B6,
+ [LETA] = 0x03B7,
+ [LTHET] = 0x03B8,
+ [LIOTA] = 0x03B9,
+ [LKAPP] = 0x03BA,
+ [LLAMB] = 0x03BB,
+ [LMU] = 0x03BC,
+ [LNU] = 0x03BD,
+ [LXI] = 0x03BE,
+ [LOMIC] = 0x03BF,
+ [LPI] = 0x03C0,
+ [LRHO] = 0x03C1,
+ [LSIGM] = 0x03C3,
+ [LTAU] = 0x03C4,
+ [LUPSI] = 0x03C5,
+ [LPHI] = 0x03C6,
+ [LCHI] = 0x03C7,
+ [LPSI] = 0x03C8,
+ [LOMEG] = 0x03C9,
+ [FSIGM] = 0x03C2,
+};
// RGBSPS
@@ -207,6 +336,17 @@ const uint8_t PROGMEM LED_ALNUM[] = {
LED_RSPC
};
+const uint8_t PROGMEM LED_HOMING[] = {
+ LED_A,
+ LED_S,
+ LED_D,
+ LED_F,
+ LED_J,
+ LED_K,
+ LED_L,
+ LED_SCLN
+};
+
const uint8_t PROGMEM LED_MODS[] = {
LED_TAB,
LED_ESC,
@@ -244,149 +384,105 @@ const uint8_t PROGMEM LED_TRACKPOINT[] = {
LED_TRACKPOINT3,
};
-void led_reset(void) {
+void led_turnoff_keys(void) {
for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) {
- rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 15, 6, 0);
+ rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 0, 0, 0);
}
-
for(uint8_t i = 0; i < COUNT(LED_MODS); i++) {
- rgbsps_set(pgm_read_byte(&LED_MODS[i]), 15, 0, 0);
+ rgbsps_set(pgm_read_byte(&LED_MODS[i]), 0, 0, 0);
}
-
for(uint8_t i = 0; i < COUNT(LED_FN); i++) {
- rgbsps_set(pgm_read_byte(&LED_FN[i]), 15, 15, 15);
+ rgbsps_set(pgm_read_byte(&LED_FN[i]), 0, 0, 0);
}
}
-void led_layer_normal(void) {
- rgbsps_set(LED_IND_FUNC, 0, 0, 0);
- rgbsps_set(LED_IND_NUM, 0, 0, 0);
- rgbsps_set(LED_IND_EMOJI, 0, 0, 0);
-
- led_reset();
-
- rgbsps_send();
-}
-
-void led_layer_func(void) {
- rgbsps_set(LED_IND_FUNC, 0, 15, 0);
- rgbsps_set(LED_IND_NUM, 0, 0, 0);
- rgbsps_set(LED_IND_EMOJI, 0, 0, 0);
-
- led_reset();
-
- for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) {
- rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 0, 0, 0);
+void led_reset(void) {
+ switch (glow_mode) {
+ case GLOW_NONE:
+ led_turnoff_keys();
+ break;
+ case GLOW_MIN:
+ led_turnoff_keys();
+ for(uint8_t i = 0; i < COUNT(LED_HOMING); i++) {
+ rgbsps_set(pgm_read_byte(&LED_HOMING[i]), 8, 8, 8);
+ }
+ rgbsps_set(LED_F, 15, 0, 0);
+ rgbsps_set(LED_J, 15, 0, 0);
+ break;
+ case GLOW_FULL:
+ for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) {
+ rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 8, 8, 8);
+ }
+ for(uint8_t i = 0; i < COUNT(LED_MODS); i++) {
+ rgbsps_set(pgm_read_byte(&LED_MODS[i]), 0, 15, 0);
+ }
+ for(uint8_t i = 0; i < COUNT(LED_FN); i++) {
+ rgbsps_set(pgm_read_byte(&LED_FN[i]), 0, 0, 15);
+ }
+ for(uint8_t i = 0; i < COUNT(LED_HOMING); i++) {
+ rgbsps_set(pgm_read_byte(&LED_HOMING[i]), 15, 0, 0);
+ }
+ rgbsps_set(LED_F, 15, 15, 0);
+ rgbsps_set(LED_J, 15, 15, 0);
+ break;
}
-
- rgbsps_set(LED_I, 15, 0, 15);
- rgbsps_set(LED_J, 15, 0, 15);
- rgbsps_set(LED_K, 15, 0, 15);
- rgbsps_set(LED_L, 15, 0, 15);
-
- rgbsps_set(LED_U, 15, 0, 0);
- rgbsps_set(LED_O, 15, 0, 0);
- rgbsps_set(LED_COMM, 15, 0, 0);
- rgbsps_set(LED_DOT, 15, 0, 0);
- rgbsps_set(LED_SCLN, 15, 0, 0);
- rgbsps_set(LED_P, 15, 0, 0);
-
- rgbsps_set(LED_Q, 0, 15, 0);
- rgbsps_set(LED_W, 0, 15, 0);
- rgbsps_set(LED_E, 0, 15, 0);
- rgbsps_set(LED_R, 0, 15, 0);
- rgbsps_set(LED_A, 0, 15, 0);
- rgbsps_set(LED_S, 0, 15, 0);
- rgbsps_set(LED_D, 0, 15, 0);
- rgbsps_set(LED_F, 0, 15, 0);
- rgbsps_set(LED_Z, 0, 15, 0);
- rgbsps_set(LED_X, 0, 15, 0);
- rgbsps_set(LED_C, 0, 15, 0);
- rgbsps_set(LED_V, 0, 15, 0);
-
- rgbsps_send();
}
-void led_layer_punc(void) {
- rgbsps_set(LED_IND_FUNC, 0, 15, 0);
- rgbsps_set(LED_IND_NUM, 0, 0, 15);
- rgbsps_set(LED_IND_EMOJI, 0, 0, 0);
-
- led_reset();
-
- rgbsps_send();
-}
+void led_set_layer_indicator(void) {
+ static uint8_t oldlayer = 255;
-void led_layer_num(void) {
rgbsps_set(LED_IND_FUNC, 0, 0, 0);
- rgbsps_set(LED_IND_NUM, 0, 0, 15);
+ // rgbsps_set(LED_IND_NUM, 0, 0, 0);
rgbsps_set(LED_IND_EMOJI, 0, 0, 0);
led_reset();
- for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) {
- rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 0, 0, 0);
+ uint8_t layer = biton32(layer_state);
+ if (oldlayer == layer) {
+ return;
}
- rgbsps_set(LED_U, 0, 5, 15);
- rgbsps_set(LED_I, 0, 5, 15);
- rgbsps_set(LED_O, 0, 5, 15);
- rgbsps_set(LED_J, 0, 5, 15);
- rgbsps_set(LED_K, 0, 5, 15);
- rgbsps_set(LED_L, 0, 5, 15);
- rgbsps_set(LED_M, 0, 5, 15);
- rgbsps_set(LED_COMM, 0, 5, 15);
- rgbsps_set(LED_DOT, 0, 5, 15);
- rgbsps_set(LED_FUNC, 0, 5, 15);
-
- rgbsps_set(LED_EMOJI, 0, 10, 15);
- rgbsps_set(LED_RALT, 0, 10, 15);
-
- rgbsps_set(LED_Q, 0, 10, 15);
- rgbsps_set(LED_W, 0, 10, 15);
- rgbsps_set(LED_E, 0, 10, 15);
- rgbsps_set(LED_R, 0, 10, 15);
- rgbsps_set(LED_T, 0, 10, 15);
- rgbsps_set(LED_Y, 0, 10, 15);
- rgbsps_set(LED_P, 0, 10, 15);
-
- rgbsps_set(LED_A, 0, 15, 15);
- rgbsps_set(LED_S, 0, 15, 15);
- rgbsps_set(LED_D, 0, 15, 15);
- rgbsps_set(LED_F, 0, 15, 15);
- rgbsps_set(LED_Z, 0, 15, 15);
- rgbsps_set(LED_X, 0, 15, 15);
- rgbsps_set(LED_C, 0, 15, 15);
- rgbsps_set(LED_V, 0, 15, 15);
-
- rgbsps_send();
-}
+ oldlayer = layer;
-void led_layer_emoji(void) {
- for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) {
- rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 15, 15, 0);
- }
- for(uint8_t i = 0; i < COUNT(LED_MODS); i++) {
- rgbsps_set(pgm_read_byte(&LED_MODS[i]), 15, 15, 0);
+ if (layer <= _NORMAN) {
+ rgbsps_send();
+ return;
}
- for(uint8_t i = 0; i < COUNT(LED_FN); i++) {
- rgbsps_set(pgm_read_byte(&LED_FN[i]), 15, 15, 0);
+
+ switch(layer) {
+ case _FUNC:
+ rgbsps_set(LED_IND_FUNC, 15, 0, 0);
+ break;
+ // case _NUM:
+ // rgbsps_set(LED_IND_NUM, 0, 0, 15);
+ // break;
+ case _EMOJI:
+ rgbsps_set(LED_IND_EMOJI, 15, 15, 0);
+ break;
+ default:
+ rgbsps_set(LED_IND_FUNC, 3, 3, 3);
+ rgbsps_set(LED_IND_NUM, 3, 3, 3);
+ rgbsps_set(LED_IND_EMOJI, 3, 3, 3);
}
- rgbsps_set(LED_IND_FUNC, 0, 0, 0);
- rgbsps_set(LED_IND_NUM, 0, 0, 0);
- rgbsps_set(LED_IND_EMOJI, 15, 15, 0);
+ rgbsps_send();
+}
- rgbsps_set(LED_PUNC, 15, 15, 15);
- rgbsps_set(LED_EMOJI, 15, 15, 15);
+void led_set_output_ble(void) {
+ rgbsps_set(LED_IND_BLUETOOTH, 0, 0, 15);
+ rgbsps_set(LED_IND_USB, 0, 0, 0);
+ rgbsps_send();
+}
+void led_set_output_usb(void) {
+ rgbsps_set(LED_IND_BLUETOOTH, 0, 0, 0);
+ rgbsps_set(LED_IND_USB, 15, 15, 15);
rgbsps_send();
}
-void led_layer_gui(void) {
- rgbsps_set(LED_IND_FUNC, 15, 10, 15);
- rgbsps_set(LED_IND_NUM, 15, 10, 15);
- rgbsps_set(LED_IND_EMOJI, 15, 10, 15);
+void led_set_output_none(void) {
+ rgbsps_set(LED_IND_BLUETOOTH, 0, 0, 0);
+ rgbsps_set(LED_IND_USB, 0, 0, 0);
rgbsps_send();
}
@@ -398,13 +494,6 @@ void led_init(void) {
rgbsps_set(LED_TRACKPOINT1, 15, 0, 0);
rgbsps_set(LED_TRACKPOINT2, 0, 0, 15);
rgbsps_set(LED_TRACKPOINT3, 15, 0, 0);
-
- // // hardcode indicator for now
- rgbsps_set(LED_IND_BLUETOOTH, 0, 0, 15);
- rgbsps_set(LED_IND_USB, 15, 15, 15);
- rgbsps_set(LED_IND_BATTERY, 0, 15, 0);
-
- led_layer_normal();
}
@@ -416,20 +505,40 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
- * | Esc | A | S | D | F | G | H | J | K | L | ; |Enter |
+ * | Esc | A | S | D | F | G | H | J | K | L | ' |Enter |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | N | M | , | . | / |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------|
- * | Ctrl | GUI | Alt | Punc | Num | Space | Func |Emoji |AltGr | GUI | Ctrl |
+ * | Ctrl | Alt | GUI | Punc | Num | Space | Func |Greek | GUI |AltGr | Ctrl |
* `-----------------------------------------------------------------------------------'
*/
[_QWERTY] = KEYMAP(
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_QUOT, KC_ENT ,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
- KC_LCTL, KC_LGUI, KC_LALT, PUNC, NUM, KC_SPC, KC_SPC, FUNC, EMOJI, KC_RALT, KC_RGUI, KC_RCTL
+ KC_LCTL, KC_LALT, KC_LGUI, PUNC, NUM, LSPACE, RSPACE, FUNC, GREEK, KC_RGUI, KC_RALT, KC_RCTL
),
+/* Dvorak
+ * ,-----------------------------------------------------------------------------------.
+ * | Tab | ' | , | . | P | Y | F | G | C | R | L | Bksp |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | Esc | A | O | E | U | I | D | H | T | N | S |Enter |
+ * |------+------+------+------+------+------|------+------+------+------+------+------|
+ * | Shift| / | Q | J | K | X | B | M | W | V | Z |Shift |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | Ctrl | Alt | GUI | Punc | Num | Space | Func |Greek | GUI |AltGr | Ctrl |
+ * `-----------------------------------------------------------------------------------'
+ */
+#ifdef LAYOUT_DVORAK
+[_DVORAK] = KEYMAP(
+ _______, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, _______,
+ _______, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, _______,
+ _______, KC_SLSH, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+),
+#endif
+
/* Colemak
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
@@ -438,15 +547,39 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | K | M | , | . | / |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------|
- * | Ctrl | GUI | Alt | Punc | Num | Space | Func |Emoji |AltGr | GUI | Ctrl |
+ * | Ctrl | Alt | GUI | Punc | Num | Space | Func |Greek | GUI |AltGr | Ctrl |
* `-----------------------------------------------------------------------------------'
*/
+
+#ifdef LAYOUT_COLEMAK
[_COLEMAK] = KEYMAP(
_______, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, _______,
_______, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, _______,
_______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
+#endif
+
+/* Norman
+ * ,-----------------------------------------------------------------------------------.
+ * | Tab | Q | W | D | F | K | J | U | R | L | ; | Bksp |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | Esc | A | S | E | T | G | Y | N | I | O | H |Enter |
+ * |------+------+------+------+------+------|------+------+------+------+------+------|
+ * | Shift| Z | X | C | V | B | P | M | , | . | / |Shift |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | Ctrl | Alt | GUI | Punc | Num | Space | Func |Greek | GUI |AltGr | Ctrl |
+ * `-----------------------------------------------------------------------------------'
+ */
+
+#ifdef LAYOUT_NORMAN
+[_NORMAN] = KEYMAP(
+ _______, KC_Q, KC_W, KC_D, KC_F, KC_K, KC_J, KC_U, KC_R, KC_L, KC_QUOT, _______,
+ _______, KC_A, KC_S, KC_E, KC_T, KC_G, KC_Y, KC_N, KC_I, KC_O, KC_H, _______,
+ _______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+),
+#endif
/* Workman
* ,-----------------------------------------------------------------------------------.
@@ -456,50 +589,53 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | M | C | V | K | K | , | . | / |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------|
- * | Ctrl | GUI | Alt | Punc | Num | Space | Func |Emoji |AltGr | GUI | Ctrl |
+ * | Ctrl | Alt | GUI | Punc | Num | Space | Func |Greek | GUI |AltGr | Ctrl |
* `-----------------------------------------------------------------------------------'
*/
+
+#ifdef LAYOUT_WORKMAN
[_WORKMAN] = KEYMAP(
_______, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_QUOT, _______,
_______, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, _______,
_______, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
+#endif
/* Punc
* ,-----------------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | ` |
* |------+------+------+------+------+-------------+------+------+------+------+------|
- * | | | \ | - | = | < | > | ( | ) | ' | | |
+ * | | * | \ | - | = | / | | ( | ) | < | > | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
- * | | | | | _ | + | { | } | [ | ] | " | | |
+ * | & | ^ | | | _ | + | ? | | [ | ] | { | } | : |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_PUNC] = KEYMAP(
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_GRV ,
- XXXXXXX, XXXXXXX, KC_BSLS, KC_MINS, KC_EQL, KC_LABK, KC_RABK, KC_LPRN, KC_RPRN, KC_QUOT, XXXXXXX, XXXXXXX,
- XXXXXXX, XXXXXXX, KC_PIPE, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_LBRC, KC_RBRC, KC_DQUO, XXXXXXX, XXXXXXX,
+ XXXXXXX, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, KC_SLSH, XXXXXXX, KC_LPRN, KC_RPRN, KC_LABK, KC_RABK, XXXXXXX,
+ KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, XXXXXXX, KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, KC_COLN,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
/* Num
* ,-----------------------------------------------------------------------------------.
- * | ^ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
+ * | ~ | ! | @ | # | $ | % | A | 7 | 8 | 9 | D | ` |
* |------+------+------+------+------+-------------+------+------+------+------+------|
- * | Esc | @ | A | B | C | ( | ) | 4 | 5 | 6 | : |Enter |
+ * | | * | \ | - | = | / | B | 4 | 5 | 6 | E | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
- * | & | # | D | E | F | [ | ] | 1 | 2 | 3 | / | * |
+ * | & | ^ | | | _ | + | ? | C | 1 | 2 | 3 | F | : |
* |------+------+------+------+------+------+------+------+------+------+------+------|
- * | | | | x | | | 0 | , | . | + | - |
+ * | | | | | | | x | 0 | , | . | | |
* `-----------------------------------------------------------------------------------'
*/
[_NUM] = KEYMAP(
- KC_CIRC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
- KC_ESC, KC_AT, S(KC_A), S(KC_B), S(KC_C), KC_LPRN, KC_RPRN, KC_4, KC_5, KC_6, KC_COLN, KC_ENT,
- KC_AMPR, KC_HASH, S(KC_D), S(KC_E), S(KC_F), KC_LBRC, KC_RBRC, KC_1, KC_2, KC_3, KC_SLSH, KC_ASTR,
- _______, _______, _______, KC_X, _______, KC_SPC, KC_SPC, KC_0, KC_COMM, KC_DOT, KC_PLUS, KC_MINS
+ KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, S(KC_A), KC_7, KC_8, KC_9, S(KC_D), KC_GRV,
+ XXXXXXX, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, KC_SLSH, S(KC_B), KC_4, KC_5, KC_6, S(KC_E), _______,
+ KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, S(KC_C), KC_1, KC_2, KC_3, S(KC_F), KC_COLN,
+ _______, _______, _______, _______, _______, _______, _______, KC_0, KC_COMM, KC_DOT, KC_X, _______
),
/* Func
@@ -520,6 +656,42 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
+/* Uppercase Greek
+ * ,-----------------------------------------------------------------------------------.
+ * | | | | | | | | | | | | |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | | | | | | | | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | | | | |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_GREEKU] = KEYMAP(
+ _______, _______, _______,X(UEPSI), X(URHO), X(UTAU),X(UUPSI),X(UTHET),X(UIOTA),X(UOMIC), X(UPI), _______,
+ _______,X(UALPH),X(USIGM),X(UDELT), X(UPHI),X(UGAMM), X(UETA), X(UXI),X(UKAPP),X(ULAMB), _______, _______,
+ _______,X(UZETA), X(UCHI), X(UPSI),X(UOMEG),X(UBETA), X(UNU), X(UMU), _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+),
+
+/* Lowercase Greek
+ * ,-----------------------------------------------------------------------------------.
+ * | | | | | | | | | | | | |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | | | | | | | | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | | | | |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_GREEKL] = KEYMAP(
+ _______, _______,X(FSIGM),X(LEPSI), X(LRHO), X(LTAU),X(LUPSI),X(LTHET),X(LIOTA),X(LOMIC), X(LPI), _______,
+ _______,X(LALPH),X(LSIGM),X(LDELT), X(LPHI),X(LGAMM), X(LETA), X(LXI),X(LKAPP),X(LLAMB), _______, _______,
+ _______,X(LZETA), X(LCHI), X(LPSI),X(LOMEG),X(LBETA), X(LNU), X(LMU), _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+),
+
/* Emoji
* ,-----------------------------------------------------------------------------------.
* | | | | | | | | | | | | |
@@ -535,40 +707,46 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
X(HART2), X(CRY2),X(WEARY),X(EYERT),X(SMIRK), X(TJOY),X(RECYC),X(UNAMU),X(MUSIC),X(OKHND),X(PENSV), X(PHEW),
X(THMUP), X(PRAY),X(SMILE),X(SMIL2),X(FLUSH), X(GRIN),X(HEART), X(BYE), X(KISS),X(CELEB), X(COOL),X(NOEVS),
X(THMDN),X(SLEEP), X(CLAP), X(CRY), X(VIC),X(BHART), X(SUN),X(SMEYE), X(WINK), X(MOON),X(CONFU),X(NOEVH),
- X(POO), X(EYES),X(HUNRD), _______,X(SKULL),X(HORNS), X(HALO), X(FEAR), _______,X(YUMMY),X(DISAP),X(NOEVK)
+ X(POO), X(EYES), _______,X(HUNRD), X(SKULL),X(HORNS), X(HALO), X(FEAR),X(YUMMY),_______,X(DISAP),X(NOEVK)
),
/* GUI
* ,-----------------------------------------------------------------------------------.
* | | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9 | D10 | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
- * |Linux | | Vol- | Mute | Vol+ | | | D- | | D+ | |Qwerty|
+ * | | | Vol- | Mute | Vol+ | | | Prev | | Next | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
- * | Win | | Prev | Play | Next | | | | | | |Colmak|
+ * | | | Prev | Play | Next | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
- * | OSX | | | | | BL- | BL+ | | | | |Workmn|
+ * | | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_GUI] = KEYMAP(
- _______, LGUI(KC_1),LGUI(KC_2),LGUI(KC_3),LGUI(KC_4),LGUI(KC_5),LGUI(KC_6),LGUI(KC_7),LGUI(KC_8),LGUI(KC_9),LGUI(KC_0), _______,
- LINUX, _______, KC_VOLD, KC_MUTE, KC_VOLU,_______,_______,KC_WWW_BACK,_______,KC_WWW_FORWARD,KC_PAUS, QWERTY,
- WIN, _______, KC_MPRV, KC_MPLY, KC_MNXT, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, COLEMAK,
- OSX, _______, _______, _______, _______, BL_DEC, BL_INC, _______, _______, RGB_VAI, RGB_VAD, WORKMAN
+ XXXXXXX, G(KC_1), G(KC_2), G(KC_3), G(KC_4), G(KC_5), G(KC_6), G(KC_7), G(KC_8), G(KC_9), G(KC_0), XXXXXXX,
+ XXXXXXX, XXXXXXX, KC_VOLD, KC_MUTE, KC_VOLU, XXXXXXX, XXXXXXX, KC_WWWB, XXXXXXX, KC_WWWF, XXXXXXX, XXXXXXX,
+ XXXXXXX, XXXXXXX, KC_MPRV, KC_MPLY, KC_MNXT, KC_SPC, KC_SPC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
+ XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX
),
-};
+/* Sys
+ * ,-----------------------------------------------------------------------------------.
+ * | |Qwerty| Win | |Reset | | | USB | | | | |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | |Audio | |Dvorak| | Glow | | |WorkMn|Linux | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | |Colmak| | BLE |Norman|MacOS | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | | | | |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_SYS] = KEYMAP(
+ XXXXXXX, QWERTY, WIN, XXXXXXX, RESET, XXXXXXX, XXXXXXX, OUT_USB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
+ XXXXXXX, AUDIO, XXXXXXX, DVORAK, XXXXXXX, GLOW, XXXXXXX, XXXXXXX, WORKMAN, LINUX, XXXXXXX, XXXXXXX,
+ XXXXXXX, XXXXXXX, XXXXXXX, COLEMAK, XXXXXXX, OUT_BLE, NORMAN, OSX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
+ _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______
+),
-#ifdef AUDIO_ENABLE
-float tone_startup[][2] = SONG(STARTUP_SOUND);
-float tone_qwerty[][2] = SONG(QWERTY_SOUND);
-float tone_colemak[][2] = SONG(COLEMAK_SOUND);
-float tone_workman[][2] = SONG(DVORAK_SOUND);
-float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
-float tone_linux[][2] = SONG(CAPS_LOCK_ON_SOUND);
-float tone_windows[][2] = SONG(SCROLL_LOCK_ON_SOUND);
-float tone_osx[][2] = SONG(NUM_LOCK_ON_SOUND);
-float tone_click[][2] = SONG(MUSICAL_NOTE(_F3, 2));
-#endif
+};
void persistant_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
@@ -576,24 +754,140 @@ void persistant_default_layer_set(uint16_t default_layer) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- #ifdef AUDIO_ENABLE
- // faux clicky
- if (record->event.pressed) PLAY_NOTE_ARRAY(tone_click, false, 0);
- #endif
+ bool lshift = keyboard_report->mods & MOD_BIT(KC_LSFT);
+ bool rshift = keyboard_report->mods & MOD_BIT(KC_RSFT);
+
+#ifdef DOUBLESPACE_LAYER_ENABLE
+ // double-space: send space immediately if any other key depressed before space is released
+ if ((lspace_active ^ rspace_active)
+ && keycode != LSPACE
+ && keycode != RSPACE
+ && record->event.pressed)
+ {
+ if (lspace_active) {
+ if (!lspace_emitted) {
+ register_code(KC_SPC);
+ unregister_code(KC_SPC);
+ }
+ lspace_emitted = true;
+ }
+ if (rspace_active) {
+ if (!rspace_emitted) {
+ register_code(KC_SPC);
+ unregister_code(KC_SPC);
+ }
+ rspace_emitted = true;
+ }
+ }
+#endif
switch (keycode) {
+
+#ifdef DOUBLESPACE_LAYER_ENABLE
+ // double-space enter space layer
+ case LSPACE:
+ if (record->event.pressed) {
+ lspace_active = true;
+ if (rspace_active) {
+ layer_on(_SPACE);
+ space_layer_entered = true;
+ }
+ } else {
+ lspace_active = false;
+ if (space_layer_entered) {
+ layer_off(_SPACE);
+ if (!rspace_active) {
+ space_layer_entered = false;
+ }
+ } else {
+ if (!lspace_emitted) {
+ register_code(KC_SPC);
+ unregister_code(KC_SPC);
+ }
+ lspace_emitted = false;
+ }
+ }
+ return false;
+ break;
+ case RSPACE:
+ if (record->event.pressed) {
+ rspace_active = true;
+ if (lspace_active) {
+ layer_on(_SPACE);
+ space_layer_entered = true;
+ }
+ } else {
+ rspace_active = false;
+ if (space_layer_entered) {
+ layer_off(_SPACE);
+ if (!lspace_active) {
+ space_layer_entered = false;
+ }
+ } else {
+ if (!rspace_emitted) {
+ register_code(KC_SPC);
+ unregister_code(KC_SPC);
+ }
+ rspace_emitted = false;
+ }
+ }
+ return false;
+ break;
+#endif
+
+ // handle greek layer shift
+ // handle both shift = capslock
+ case KC_LSFT:
+ case KC_RSFT:
+ ;
+ uint8_t layer = biton32(layer_state);
+ if (layer == _GREEKU || layer == _GREEKL) {
+ if (record->event.pressed) {
+ layer_on(_GREEKU);
+ layer_off(_GREEKL);
+ } else {
+ if (lshift ^ rshift) { // if only one shift was pressed
+ layer_on(_GREEKL);
+ layer_off(_GREEKU);
+ }
+ }
+ } else {
+ if (record->event.pressed) {
+ if (lshift ^ rshift) { // if only one shift was pressed
+ register_code(KC_CAPS);
+ unregister_code(KC_CAPS);
+ }
+ }
+ }
+ return true;
+ break;
+
+ // press both ctrls to activate SYS layer
+ case KC_LCTL:
+ case KC_RCTL:
+ ;
+ bool lctrl = keyboard_report->mods & MOD_BIT(KC_LCTL);
+ bool rctrl = keyboard_report->mods & MOD_BIT(KC_RCTL);
+ if (record->event.pressed) {
+ if (lctrl ^ rctrl) { // if only one ctrl was pressed
+ layer_on(_SYS);
+ }
+ } else {
+ layer_off(_SYS);
+ }
+ return true;
+ break;
+
// QWERTZ style comma and dot: semicolon and colon when shifted
case KC_COMM:
if (record->event.pressed) {
- bool lshifted = keyboard_report->mods & MOD_BIT(KC_LSFT);
- bool rshifted = keyboard_report->mods & MOD_BIT(KC_RSFT);
- if (lshifted || rshifted) {
- if (lshifted) unregister_code(KC_LSFT);
- if (rshifted) unregister_code(KC_RSFT);
+ if (lshift || rshift) {
+ if (lshift) unregister_code(KC_LSFT);
+ if (rshift) unregister_code(KC_RSFT);
register_code(KC_SCLN);
unregister_code(KC_SCLN);
- if (lshifted) register_code(KC_LSFT);
- if (rshifted) register_code(KC_RSFT);
+ if (lshift) register_code(KC_LSFT);
+ if (rshift) register_code(KC_RSFT);
} else {
register_code(KC_COMM);
unregister_code(KC_COMM);
@@ -617,90 +911,88 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// layout switchers
case QWERTY:
if (record->event.pressed) {
- #ifdef AUDIO_ENABLE
- PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
- #endif
persistant_default_layer_set(1UL<<_QWERTY);
}
return false;
break;
+#ifdef LAYOUT_DVORAK
+ case DVORAK:
+ if (record->event.pressed) {
+ persistant_default_layer_set(1UL<<_DVORAK);
+ }
+ return false;
+ break;
+#endif
+#ifdef LAYOUT_COLEMAK
case COLEMAK:
if (record->event.pressed) {
- #ifdef AUDIO_ENABLE
- PLAY_NOTE_ARRAY(tone_colemak, false, 0);
- #endif
persistant_default_layer_set(1UL<<_COLEMAK);
}
return false;
break;
+#endif
+#ifdef LAYOUT_WORKMAN
case WORKMAN:
if (record->event.pressed) {
- #ifdef AUDIO_ENABLE
- PLAY_NOTE_ARRAY(tone_workman, false, 0);
- #endif
persistant_default_layer_set(1UL<<_WORKMAN);
}
return false;
break;
+#endif
+#ifdef LAYOUT_NORMAN
+ case NORMAN:
+ if (record->event.pressed) {
+ persistant_default_layer_set(1UL<<_NORMAN);
+ }
+ return false;
+ break;
+#endif
// layer switcher
case PUNC:
if (record->event.pressed) {
layer_on(_PUNC);
- update_tri_layer(_PUNC, _EMOJI, _GUI);
- if (IS_LAYER_ON(_GUI)) {
- led_layer_gui();
- } else {
- led_layer_punc();;
- }
+ update_tri_layer(_PUNC, _GREEKL, _EMOJI);
} else {
layer_off(_PUNC);
- update_tri_layer(_PUNC, _EMOJI, _GUI);
- if (IS_LAYER_ON(_EMOJI)) {
- led_layer_emoji();
- } else {
- led_layer_normal();;
- }
+ update_tri_layer(_PUNC, _GREEKL, _EMOJI);
}
return false;
break;
- case EMOJI:
+
+ case GREEK:
if (record->event.pressed) {
- layer_on(_EMOJI);
- update_tri_layer(_PUNC, _EMOJI, _GUI);
- if (IS_LAYER_ON(_GUI)) {
- led_layer_gui();
+ if (lshift || rshift) {
+ layer_on(_GREEKU);
+ layer_off(_GREEKL);
} else {
- led_layer_emoji();;
+ layer_on(_GREEKL);
+ layer_off(_GREEKU);
+ update_tri_layer(_PUNC, _GREEKL, _EMOJI);
}
} else {
- layer_off(_EMOJI);
- update_tri_layer(_PUNC, _EMOJI, _GUI);
- if (IS_LAYER_ON(_PUNC)) {
- led_layer_punc();
- } else {
- led_layer_normal();;
- }
+ layer_off(_GREEKU);
+ layer_off(_GREEKL);
+ update_tri_layer(_PUNC, _GREEKL, _EMOJI);
}
return false;
break;
+
case NUM:
if (record->event.pressed) {
+ turn_off_capslock();
layer_on(_NUM);
- led_layer_num();
} else {
layer_off(_NUM);
- led_layer_normal();
}
return false;
break;
+
case FUNC:
if (record->event.pressed) {
layer_on(_FUNC);
- led_layer_func();
} else {
layer_off(_FUNC);
- led_layer_normal();
}
return false;
break;
@@ -708,86 +1000,115 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// OS switchers
case LINUX:
set_unicode_input_mode(UC_LNX);
- #ifdef AUDIO_ENABLE
- PLAY_NOTE_ARRAY(tone_linux, false, 0);
- #endif
return false;
break;
case WIN:
set_unicode_input_mode(UC_WINC);
- #ifdef AUDIO_ENABLE
- PLAY_NOTE_ARRAY(tone_windows, false, 0);
- #endif
return false;
break;
case OSX:
set_unicode_input_mode(UC_OSX);
- #ifdef AUDIO_ENABLE
- PLAY_NOTE_ARRAY(tone_osx, false, 0);
- #endif
+ return false;
+ break;
+
+ // glow mode changer
+ case GLOW:
+ if (record->event.pressed) {
+ glow_mode++;
+ if (glow_mode > GLOW_FULL) {
+ glow_mode = GLOW_NONE;
+ }
+ led_reset();
+ rgbsps_send();
+ }
+ return false;
+ break;
+
+ // faux clicky toggle, TBD
+ case AUDIO:
return false;
break;
}
return true;
}
-void matrix_init_user(void) {
- #ifdef AUDIO_ENABLE
- startup_user();
- #endif
- set_unicode_input_mode(UC_LNX);
- led_init();
+void set_output_user(uint8_t output) {
+ switch(output) {
+ case OUTPUT_USB:
+ led_set_output_usb();
+ break;
+ case OUTPUT_ADAFRUIT_BLE:
+ led_set_output_ble();
+ break;
+ default:
+ led_set_output_none();
+ }
}
-// void init_rgblight(void) {
-// for (uint8_t i = 0; i < RGBLED_NUM; i++) {
-// led[i].r = 255;
-// led[i].g = 85;
-// led[i].b = 0;
-// }
-// ws2812_setleds(led, RGBLED_NUM);
-// }
+void matrix_init_user(void) {
+ _delay_ms(500); // give time for usb to initialize
+ set_unicode_input_mode(UC_LNX);
+ led_init();
-#ifdef AUDIO_ENABLE
+ // auto detect output on init
+ uint8_t output = auto_detect_output();
+ if (output == OUTPUT_USB) {
+ set_output(OUTPUT_USB);
+ } else {
+ set_output(OUTPUT_ADAFRUIT_BLE);
+ }
+}
-void startup_user()
-{
- _delay_ms(20); // gets rid of tick
- PLAY_NOTE_ARRAY(tone_startup, false, 0);
+void matrix_scan_user(void) {
+ led_set_layer_indicator();
}
-void shutdown_user()
-{
- PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
- _delay_ms(150);
- stop_all_notes();
+void battery_poll(uint8_t level) {
+ rgbsps_sethsv(LED_IND_BATTERY, level * 120/255, 255, 15);
+ rgbsps_send();
}
-#endif
+void led_set_user(uint8_t usb_led) {
+ bool new_capslock = usb_led & (1<<USB_LED_CAPS_LOCK);
+ if (new_capslock ^ capslock) { // capslock state is different
+ if (capslock = new_capslock) {
+ rgbsps_set(LED_IND_NUM, 15, 0, 0);
+ } else {
+ rgbsps_set(LED_IND_NUM, 0, 0, 0);
+ }
+ rgbsps_send();
+ }
+}
+void turn_off_capslock() {
+ if (capslock) {
+ register_code(KC_CAPS);
+ unregister_code(KC_CAPS);
+ }
+}
void ps2_mouse_init_user() {
uint8_t rcv;
// set TrackPoint sensitivity
- PS2_MOUSE_SEND(0xE2, "set trackpoint sensitivity: 0xE2");
- PS2_MOUSE_SEND(0x81, "set trackpoint sensitivity: 0x81");
- PS2_MOUSE_SEND(0x4A, "set trackpoint sensitivity: 0x4A");
- PS2_MOUSE_SEND(0x49, "set trackpoint sensitivity: 0x59");
+ PS2_MOUSE_SEND(0xE2, "tpsens: 0xE2");
+ PS2_MOUSE_SEND(0x81, "tpsens: 0x81");
+ PS2_MOUSE_SEND(0x4A, "tpsens: 0x4A");
+ PS2_MOUSE_SEND(0x49, "tpsens: 0x59");
// set TrackPoint Negative Inertia factor
- PS2_MOUSE_SEND(0xE2, "set negative inertia factor: 0xE2");
- PS2_MOUSE_SEND(0x81, "set negative inertia factor: 0x81");
- PS2_MOUSE_SEND(0x4D, "set negative inertia factor: 0x4D");
- PS2_MOUSE_SEND(0x06, "set negative inertia factor: 0x06");
+ PS2_MOUSE_SEND(0xE2, "tpnegin: 0xE2");
+ PS2_MOUSE_SEND(0x81, "tpnegin: 0x81");
+ PS2_MOUSE_SEND(0x4D, "tpnegin: 0x4D");
+ PS2_MOUSE_SEND(0x06, "tpnegin: 0x06");
// set TrackPoint speed
// (transfer function upper plateau speed)
- PS2_MOUSE_SEND(0xE2, "set trackpoint speed: 0xE2");
- PS2_MOUSE_SEND(0x81, "set trackpoint speed: 0x81");
- PS2_MOUSE_SEND(0x60, "set trackpoint speed: 0x60");
- PS2_MOUSE_SEND(0x61, "set trackpoint speed: 0x61");
+ PS2_MOUSE_SEND(0xE2, "tpsp: 0xE2");
+ PS2_MOUSE_SEND(0x81, "tpsp: 0x81");
+ PS2_MOUSE_SEND(0x60, "tpsp: 0x60");
+ PS2_MOUSE_SEND(0x61, "tpsp: 0x61");
// inquire pts status
rcv = ps2_host_send(0xE2);
diff --git a/keyboards/handwired/promethium/promethium.c b/keyboards/handwired/promethium/promethium.c
index a0035cce1a..62e2281fac 100644
--- a/keyboards/handwired/promethium/promethium.c
+++ b/keyboards/handwired/promethium/promethium.c
@@ -1,6 +1,38 @@
#include "promethium.h"
+#include "analog.h"
+#include "timer.h"
+#include "matrix.h"
-void matrix_init_kb(void) {
+// cubic fit {3.3, 0}, {3.5, 2.9}, {3.6, 5}, {3.7, 8.6}, {3.8, 36}, {3.9, 62}, {4.0, 73}, {4.05, 83}, {4.1, 89}, {4.15, 94}, {4.2, 100}
+
+uint8_t battery_level(void) {
+ float voltage = analogRead(BATTERY_PIN) * 2 * 3.3 / 1024;
+ if (voltage < MIN_VOLTAGE) return 0;
+ if (voltage > MAX_VOLTAGE) return 255;
+ return (voltage - MIN_VOLTAGE) / (MAX_VOLTAGE - MIN_VOLTAGE) * 255;
+}
+
+__attribute__ ((weak))
+void battery_poll(uint8_t level) {
+}
+void matrix_init_kb(void) {
matrix_init_user();
-} \ No newline at end of file
+}
+
+void matrix_scan_kb(void) {
+ static uint16_t counter = BATTERY_POLL;
+ counter++;
+
+ if (counter > BATTERY_POLL) {
+ counter = 0;
+ battery_poll(battery_level());
+ }
+
+ matrix_scan_user();
+}
+
+void led_set_kb(uint8_t usb_led) {
+ led_set_user(usb_led);
+}
+
diff --git a/keyboards/handwired/promethium/promethium.h b/keyboards/handwired/promethium/promethium.h
index 662eeab990..da37e5c560 100644
--- a/keyboards/handwired/promethium/promethium.h
+++ b/keyboards/handwired/promethium/promethium.h
@@ -4,6 +4,11 @@
#include "quantum.h"
#define PS2_INIT_DELAY 2000
+#define UNICODE_TYPE_DELAY 0
+#define BATTERY_PIN 9
+#define BATTERY_POLL 30000
+#define MAX_VOLTAGE 4.2
+#define MIN_VOLTAGE 3.2
#define KEYMAP( \
k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \
@@ -22,6 +27,8 @@
{k47, k48, k49, k4a, k4b, k4c} \
}
+
+
enum led_sequence {
LED_IND_BLUETOOTH,
LED_IND_USB,
@@ -98,4 +105,4 @@ enum led_sequence {
#endif
-
+void battery_poll(uint8_t level); \ No newline at end of file
diff --git a/keyboards/handwired/promethium/rgbsps.c b/keyboards/handwired/promethium/rgbsps.c
index ea922ec3fd..f30badd356 100644
--- a/keyboards/handwired/promethium/rgbsps.c
+++ b/keyboards/handwired/promethium/rgbsps.c
@@ -21,4 +21,53 @@ void rgbsps_turnoff(void) {
void rgbsps_send(void) {
ws2812_setleds(led, RGBSPS_NUM);
-} \ No newline at end of file
+}
+
+void rgbsps_sethsv(uint8_t index, uint16_t hue, uint8_t sat, uint8_t val) {
+ uint8_t r = 0, g = 0, b = 0, base, color;
+
+ if (sat == 0) { // Acromatic color (gray). Hue doesn't mind.
+ r = val;
+ g = val;
+ b = val;
+ } else {
+ base = ((255 - sat) * val) >> 8;
+ color = (val - base) * (hue % 60) / 60;
+
+ switch (hue / 60) {
+ case 0:
+ r = val;
+ g = base + color;
+ b = base;
+ break;
+ case 1:
+ r = val - color;
+ g = val;
+ b = base;
+ break;
+ case 2:
+ r = base;
+ g = val;
+ b = base + color;
+ break;
+ case 3:
+ r = base;
+ g = val - color;
+ b = val;
+ break;
+ case 4:
+ r = base + color;
+ g = base;
+ b = val;
+ break;
+ case 5:
+ r = val;
+ g = base;
+ b = val - color;
+ break;
+ }
+ }
+
+ rgbsps_set(index, r, g, b);
+}
+
diff --git a/keyboards/handwired/promethium/rgbsps.h b/keyboards/handwired/promethium/rgbsps.h
index 6da197f75d..72612a7a82 100644
--- a/keyboards/handwired/promethium/rgbsps.h
+++ b/keyboards/handwired/promethium/rgbsps.h
@@ -1,4 +1,5 @@
void rgbsps_set(uint8_t index, uint8_t r, uint8_t g, uint8_t b);
void rgbsps_setall(uint8_t r, uint8_t g, uint8_t b);
void rgbsps_turnoff(void);
-void rgbsps_send(void); \ No newline at end of file
+void rgbsps_send(void);
+void rgbsps_sethsv(uint8_t index, uint16_t hue, uint8_t sat, uint8_t val); \ No newline at end of file
diff --git a/keyboards/handwired/promethium/rules.mk b/keyboards/handwired/promethium/rules.mk
index 465ef3359a..e75cf4dde4 100644
--- a/keyboards/handwired/promethium/rules.mk
+++ b/keyboards/handwired/promethium/rules.mk
@@ -72,4 +72,5 @@ API_SYSEX_ENABLE ?= no
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
SRC += $(QUANTUM_DIR)/light_ws2812.c
-SRC += rgbsps.c \ No newline at end of file
+SRC += rgbsps.c
+SRC += $(QUANTUM_DIR)/analog.c \ No newline at end of file