From 2e521b509ce0c853b2e62d1d16e0117b900ab9c2 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Mon, 9 Sep 2019 22:03:33 -0700 Subject: [Keyboard] Added a simple 2x5 Keypad with 4 layers (#6699) * Added new 2x5 Keypad with 3 LEDs to indicate the selected layer. By Jonathan Cameron. * Minor refactor from suggestions from qmk team * Added * Moved to 'handwired' directory * Update readme.md * Update readme.md * Update readme.md * Update keyboards/handwired/2x5keypad/readme.md Co-Authored-By: fauxpark * Switch to image offsite * Moved image offsite * Update keyboards/handwired/2x5keypad/keymaps/default/keymap.h Co-Authored-By: fauxpark * Update keyboards/handwired/2x5keypad/2x5keypad.h Co-Authored-By: fauxpark * Moved functions into .c file per suggestions * Cosmetic * Fixed function called, per suggestions. * Update keyboards/handwired/2x5keypad/2x5keypad.h Ok Co-Authored-By: fauxpark * Moved LED functions to the top level since they can be used it various flavors * Declare those moved LED functions! * Update keyboards/handwired/2x5keypad/config.h Co-Authored-By: Drashna Jaelre --- .../handwired/2x5keypad/keymaps/default/keymap.c | 69 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 keyboards/handwired/2x5keypad/keymaps/default/keymap.c (limited to 'keyboards/handwired/2x5keypad/keymaps/default') diff --git a/keyboards/handwired/2x5keypad/keymaps/default/keymap.c b/keyboards/handwired/2x5keypad/keymaps/default/keymap.c new file mode 100644 index 0000000000..808824f3a2 --- /dev/null +++ b/keyboards/handwired/2x5keypad/keymaps/default/keymap.c @@ -0,0 +1,69 @@ +#include QMK_KEYBOARD_H + +#define WIN_TAB LGUI(KC_TAB) +#define WIN_LOCK LGUI(KC_L) + +enum layers { + NORMAL_LAYER = 0, + MEDIA_LAYER, + TBD_LAYER2, + TBD_LAYER3 +}; + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [NORMAL_LAYER]= + LAYOUT(TO(1), WIN_TAB, KC_HOME, KC_UP, KC_END, + WIN_LOCK, KC_MUTE, KC_LEFT, KC_DOWN, KC_RGHT), + + [MEDIA_LAYER]= + LAYOUT(TO(2), KC_CALC, KC_MPRV, KC_MNXT, KC_VOLU, + KC_TRNS, KC_TRNS, KC_MSTP, KC_MPLY, KC_VOLD), + + [TBD_LAYER2]= + LAYOUT(TO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + + [TBD_LAYER3]= + LAYOUT(TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) +}; + + +/* DISABLED +void matrix_init_user(void) { +} + +void matrix_scan_user(void) { +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} +*/ + + +layer_state_t layer_state_set_user(layer_state_t state) +{ + turn_off_leds(); + + switch (biton32(state)) + { + case NORMAL_LAYER: + break; + + case MEDIA_LAYER: + turn_on_led(RED_LED); + break; + + case TBD_LAYER2: + turn_on_led(BLUE_LED); + break; + + case TBD_LAYER3: + turn_on_led(GREEN_LED); + break; + } + return state; +} -- cgit v1.2.3