qmk_firmware/keyboards/handwired/2x5keypad/keymaps/default/keymap.c
Jonathan Cameron 2e521b509c [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 <fauxpark@gmail.com>

* Switch to image offsite

* Moved image offsite

* Update keyboards/handwired/2x5keypad/keymaps/default/keymap.h

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/handwired/2x5keypad/2x5keypad.h

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Moved functions into .c file per suggestions

* Cosmetic

* Fixed function called, per suggestions.

* Update keyboards/handwired/2x5keypad/2x5keypad.h

Ok

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* 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 <drashna@live.com>
2019-09-09 22:03:33 -07:00

69 lines
1.2 KiB
C

#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;
}