fixed defaulf keymap, added my own keymap

now the LEDs are working like they should
pull/683/head
René Werner 8 years ago
parent 6a61c89477
commit 1bbd3c1eea

@ -69,7 +69,7 @@ BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE ?= no # Audio output on port C6 AUDIO_ENABLE ?= no # Audio output on port C6
CUSTOM_MATRIX = yes CUSTOM_MATRIX = yes
SRC += matrix.c led.c SRC += matrix.c
ifndef QUANTUM_DIR ifndef QUANTUM_DIR
include ../../Makefile include ../../Makefile

@ -3,8 +3,14 @@
#define _______ KC_TRNS #define _______ KC_TRNS
#define XXXXXXX KC_NO #define XXXXXXX KC_NO
#define LC LCTL #define C(kc) LCTL(KC_##kc)
#define RA(kc) RALT(KC_##kc)
#define KC_SLCT KC_SELECT #define KC_SLCT KC_SELECT
#define MEDAPP LT(MEDIA, KC_APP)
#undef S
#define S(kc) LSFT(KC_##kc)
uint8_t current_layer_global = 255;
enum layers { enum layers {
DEFAULT, DEFAULT,
@ -34,29 +40,29 @@ enum macro_id {
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[DEFAULT] = KEYMAP(\ [DEFAULT] = KEYMAP(\
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,KC_SLCK,KC_PAUS, \ KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,KC_SLCK,KC_PAUS, \
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL,KC_BSPC, KC_INS,KC_HOME,KC_PGUP, KC_NLCK,KC_PSLS,KC_PAST,KC_PMNS, \ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,KC_MINS, KC_EQL,KC_BSPC, KC_INS,KC_HOME,KC_PGUP, KC_NLCK,KC_PSLS,KC_PAST,KC_PMNS, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,KC_BSLS, KC_DEL, KC_END,KC_PGDN, KC_P7, KC_P8, KC_P9,KC_PPLS, \ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,KC_LBRC,KC_RBRC,KC_BSLS, KC_DEL, KC_END,KC_PGDN, KC_P7, KC_P8, KC_P9,KC_PPLS, \
F(0), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, \ F(0), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L,KC_SCLN,KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, \
F(8),KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT, KC_SLSH, F(9), KC_UP, KC_P1, KC_P2, KC_P3,KC_PENT, \ F(8),KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_SLSH, F(9), KC_UP, KC_P1, KC_P2, KC_P3,KC_PENT, \
F(1),KC_LGUI, F(3), LT(MISC, KC_SPC), F(4), F(5), LT(MEDIA, KC_APP), F(2), KC_LEFT,KC_DOWN,KC_RGHT, KC_P0,KC_PDOT), F(1),KC_LGUI, F(3), LT(MISC, KC_SPC), F(4), F(5), MEDAPP, F(2), KC_LEFT,KC_DOWN,KC_RGHT, KC_P0,KC_PDOT),
/* Layer 1: Programming Layer 1, emulating US layout */ /* Layer 1: Programming Layer 1, emulating US l ayout */
[PROG1] = KEYMAP(\ [PROG1] = KEYMAP(\
KC_ESC,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, _______, _______, _______,_______,_______, \ KC_ESC,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, \
M(GRV),_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, KC_SLSH, S(KC_0), _______, _______,_______,_______, _______,_______,_______,_______, \ M(GRV),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,KC_SLSH, S(0),_______, _______,_______,_______, _______,_______,_______,_______, \
_______,_______,_______,_______,_______,_______, KC_Z,_______,_______,_______, _______,RALT(KC_8),RALT(KC_9),RALT(KC_MINS), _______,_______,_______, _______,_______,_______,_______, \ _______,_______,_______,_______,_______,_______, KC_Z,_______,_______,_______,_______, RA(8), RA(9),RA(MINS), _______,_______,_______, _______,_______,_______,_______, \
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,S(KC_COMM),S(KC_BSLS), _______, _______,_______,_______, \ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,S(COMM),S(BSLS), _______, _______,_______,_______, \
MO(PROG2),_______, KC_Y,_______,_______,_______,_______,_______,_______,_______, _______, S(KC_7), MO(PROG2), _______, _______,_______,_______,_______, \ MO(PROG2),_______, KC_Y,_______,_______,_______,_______,_______,_______,_______,_______, S(7), MO(PROG2), _______, _______,_______,_______,_______, \
_______,_______,_______, _______, _______, _______, _______, _______, _______,_______,_______, _______,_______), _______,_______,_______, _______, _______,_______,_______,_______, _______,_______,_______, _______,_______),
/* Layer 2: programming layer 2 /* Layer 2: programming layer 2
all keys that are not FN keys are sent as LSFT+key on this layer all keys that are not FN keys are sent as LSFT+key on this layer
*/ */
[PROG2] = KEYMAP(\ [PROG2] = KEYMAP(\
_______, _______, _______,_______,_______,_______, _______,_______, _______,_______, _______, _______, _______, _______,_______,_______, \ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, \
RALT(KC_RBRC), _______,RALT(KC_Q),KC_BSLS,_______,_______,M(CFLEX),S(KC_6),S(KC_RBRC),S(KC_8), S(KC_9), S(KC_SLSH), KC_RBRC, _______, _______,_______,_______, _______,_______,_______,_______, \ RA(RBRC),_______, RA(Q),KC_BSLS,_______,_______,M(CFLEX), S(6),S(RBRC), S(8), S(9),S(SLSH),KC_RBRC,_______, _______,_______,_______, _______,_______,_______,_______, \
_______, _______, _______,_______,_______,_______, _______,_______, _______,_______, _______, RALT(KC_7),RALT(KC_0),RALT(KC_NUBS), _______,_______,_______, _______,_______,_______,_______, \ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, RA(7), RA(0),RA(NUBS), _______,_______,_______, _______,_______,_______,_______, \
_______, _______, _______,_______,_______,_______, _______,_______, _______,_______, S(KC_DOT), S(KC_2), _______, _______,_______,_______, \ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______, S(DOT), S(2), _______, _______,_______,_______, \
_______,S(KC_NUBS), _______,_______,_______,_______, _______,_______, _______,KC_NUBS,S(KC_NUBS), S(KC_MINS), _______, _______, _______,_______,_______,_______, \ _______,S(NUBS),_______,_______,_______,_______,_______,_______,_______,KC_NUBS,S(NUBS),S(MINS), _______, _______, _______,_______,_______,_______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______,_______,_______, _______,_______), \ _______,_______,_______, _______, _______,_______,_______,_______, _______,_______,_______, _______,_______),
/* Layer 3: media layer */ /* Layer 3: media layer */
[MEDIA] = KEYMAP(\ [MEDIA] = KEYMAP(\
KC_PWR,KC_SLEP,KC_WAKE,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX, \ KC_PWR,KC_SLEP,KC_WAKE,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX, \
@ -67,37 +73,37 @@ RALT(KC_RBRC), _______,RALT(KC_Q),KC_BSLS,_______,_______,M(CFLEX),S(KC_6),S(K
XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX, XXXXXXX,XXXXXXX,_______,XXXXXXX, KC_MRWD,KC_MSTP,KC_MFFD, XXXXXXX,XXXXXXX), XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX, XXXXXXX,XXXXXXX,_______,XXXXXXX, KC_MRWD,KC_MSTP,KC_MFFD, XXXXXXX,XXXXXXX),
/* Layer 4: Mouse layer */ /* Layer 4: Mouse layer */
[MOUSE1] = KEYMAP(\ [MOUSE1] = KEYMAP(\
F(6),XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX, \ F(6),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, \
XXXXXXX,KC_ACL0, KC_ACL1, KC_ACL2, XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX,KC_BSPC, KC_INS,KC_HOME,KC_PGUP, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, \ _______,KC_ACL0,KC_ACL1,KC_ACL2,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \
XXXXXXX,KC_BTN4, KC_WH_D, KC_MS_U, KC_WH_U, XXXXXXX, KC_Y,XXXXXXX,XXXXXXX, XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, KC_DEL, KC_END,KC_PGDN, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, \ _______,KC_BTN4,KC_WH_D,KC_MS_U,KC_WH_U,_______, C(Z),_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \
F(0),KC_BTN5, KC_MS_L, KC_MS_D, KC_MS_R, F(7),KC_WH_L,KC_WH_D,KC_WH_U, KC_WH_R, XXXXXXX,XXXXXXX, KC_BTN1, XXXXXXX,XXXXXXX,XXXXXXX, \ _______,KC_BTN5,KC_MS_L,KC_MS_D,KC_MS_R, F(7),KC_WH_L,KC_WH_D,KC_WH_U,KC_WH_R,_______,_______, _______, _______,_______,_______, \
MO(MOUSE2),XXXXXXX,LC(KC_Y),LC(KC_X),LC(KC_C),LC(KC_V),XXXXXXX,KC_BTN2,KC_BTN3,LC(KC_PGUP),LC(KC_PGDN),XXXXXXX, KC_RSFT, KC_UP, XXXXXXX,XXXXXXX,XXXXXXX,KC_PENT, \ MO(MOUSE2),_______, C(Y), C(X), C(C), C(V),_______,KC_BTN2,KC_BTN3,C(PGUP),C(PGDN),_______, KC_RSFT, _______, _______,_______,_______,_______, \
KC_LCTL,KC_LGUI,KC_LALT, KC_BTN1, KC_RALT,KC_RGUI, KC_APP,KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT, XXXXXXX,XXXXXXX), KC_LCTL,_______,KC_LALT, KC_BTN1, KC_RALT,KC_RGUI, KC_APP,KC_RCTL, _______,_______,_______, _______,_______),
/* Layer 5: Mouse layer 2*/ /* Layer 5: Mouse layer 2*/
[MOUSE2] = KEYMAP(\ [MOUSE2] = KEYMAP(\
_______,_______,_______, _______, _______, _______,_______,_______,_______, _______, _______,_______,_______, _______,_______,_______, \ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, \
_______,_______,_______, _______, _______, _______,_______,_______,_______, _______, _______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \
_______,_______,KC_BTN2, KC_WH_U, KC_BTN3, _______,_______,_______,_______, _______, _______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \ _______,_______,KC_BTN2,KC_WH_U,KC_BTN3,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \
_______,_______,KC_WH_L, KC_WH_D, KC_WH_R, _______,KC_MS_L,KC_MS_D,KC_MS_U, KC_MS_R, _______,_______, _______, _______,_______,_______, \ _______,_______,KC_WH_L,KC_WH_D,KC_WH_R,_______,KC_MS_L,KC_MS_D,KC_MS_U,KC_MS_R,_______,_______, _______, _______,_______,_______, \
_______,_______,_______, _______, _______, _______,_______,_______,_______, _______, _______,_______, _______, _______, _______,_______,_______,_______, \ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, _______, _______,_______,_______,_______, \
_______,_______,_______, _______, _______,_______,_______,_______, _______,_______,_______, _______,_______), _______,_______,_______, _______, _______,_______,_______,_______, _______,_______,_______, _______,_______),
/* Layer 6: Misc layer */ /* Layer 6: Misc layer */
[MISC] = KEYMAP(\ [MISC] = KEYMAP(\
XXXXXXX, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, XXXXXXX,XXXXXXX,XXXXXXX, \ _______, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, _______,_______,_______, \
XXXXXXX,XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, \ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \
XXXXXXX,KC_SLCT,LC(KC_W), KC_UP, XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX,KC_BSPC, KC_DEL, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, \ _______,KC_SLCT, C(W), KC_UP,_______,_______,_______,_______,KC_BSPC, KC_DEL,_______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \
XXXXXXX,XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX,KC_HOME,KC_PGDN,KC_PGUP, XXXXXXX, XXXXXXX,XXXXXXX, XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX, \ _______,_______,KC_LEFT,KC_DOWN,KC_RGHT,_______,KC_HOME,KC_PGDN,KC_PGUP,_______,_______,_______, _______, _______,_______,_______, \
KC_LSFT,XXXXXXX,LC(KC_Y),LC(KC_X),LC(KC_C),LC(KC_V), KC_SPC, KC_END,XXXXXXX,LC(KC_PGUP),LC(KC_PGDN),XXXXXXX, KC_RSFT, XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, \ KC_LSFT,_______, C(Y), C(X), C(C), C(V), KC_SPC, KC_END,_______,C(PGUP),C(PGDN),_______, _______, _______, _______,_______,_______,_______, \
KC_LCTL,KC_LGUI, KC_LALT, LT(MISC, KC_SPC), KC_RALT,KC_RGUI, KC_APP,KC_RCTL, XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX,XXXXXXX), _______,_______,_______, LT(MISC, KC_SPC), _______,_______,_______,_______, _______,_______,_______, _______,_______),
}; };
const uint16_t PROGMEM fn_actions[] = { const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_TAP_TOGGLE(MOUSE1), // toggle enable mouse layer (4) [0] = ACTION_LAYER_TAP_TOGGLE(MOUSE1), // tap-toggle mouse layer (4)
[1] = ACTION_FUNCTION_TAP(LCTRL_BRACKET), // tap to print [ [1] = ACTION_FUNCTION_TAP(LCTRL_BRACKET), // tap to print [
[2] = ACTION_FUNCTION_TAP(RCTRL_BRACKET), // tap to print ] [2] = ACTION_FUNCTION_TAP(RCTRL_BRACKET), // tap to print ]
[3] = ACTION_FUNCTION_TAP(LALT_CURLY), // tap to print { [3] = ACTION_FUNCTION_TAP(LALT_CURLY), // tap to print {
[4] = ACTION_FUNCTION_TAP(RALT_CURLY), // tap to print } [4] = ACTION_FUNCTION_TAP(RALT_CURLY), // tap to print }
[5] = ACTION_LAYER_TAP_TOGGLE(PROG1), // toggle programming layer 1 (1) [5] = ACTION_LAYER_TAP_TOGGLE(PROG1), // tap-toggle programming layer 1
[6] = ACTION_LAYER_SET_CLEAR(DEFAULT), [6] = ACTION_LAYER_SET_CLEAR(DEFAULT),
[7] = ACTION_FUNCTION_TAP(CTRL_CLICK), [7] = ACTION_FUNCTION_TAP(CTRL_CLICK),
[8] = ACTION_FUNCTION_TAP(LSHFT_PAREN), // tap to print ( [8] = ACTION_FUNCTION_TAP(LSHFT_PAREN), // tap to print (
@ -126,7 +132,22 @@ void matrix_init_user(void) {
} }
void matrix_scan_user(void) { void matrix_scan_user(void) {
uint8_t layer;
layer = biton32(layer_state);
if (current_layer_global != layer) {
current_layer_global = layer;
// unset CAPSLOCK and SCROLL LOCK LEDs
led_set_kb(host_keyboard_leds() & ~(1<<USB_LED_CAPS_LOCK));
led_set_kb(host_keyboard_leds() & ~(1<<USB_LED_SCROLL_LOCK));
// set SCROLL LOCK LED when the mouse layer is active, CAPS LOCK when PROG layer is active
if (layer == MOUSE1 || layer == MOUSE2) {
led_set_kb(host_keyboard_leds() | (1<<USB_LED_SCROLL_LOCK));
} else if (layer == PROG1 || layer == PROG2) {
led_set_kb(host_keyboard_leds() | (1<<USB_LED_CAPS_LOCK));
}
}
} }
void led_set_user(uint8_t usb_led) { void led_set_user(uint8_t usb_led) {
@ -209,6 +230,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
keycode == KC_BSLS || keycode == KC_BSLS ||
keycode == KC_GRV keycode == KC_GRV
)) { )) {
// LSFT is the modifier for this layer, so we set LSFT for every key to get the expected behavior
if (record->event.pressed) { if (record->event.pressed) {
register_mods(MOD_LSFT); register_mods(MOD_LSFT);
} else { } else {

@ -0,0 +1,18 @@
# My personal keymap for the Kitten Paw controller
This keymap only works correctly when you have your OS configured with a German keymap. Use the keymap however you like. It's most likely a living thing that will never be quite finished.
## Description of the layers
Layer 0 (DEFAULT) works just like you would expect a keyboard to work, mostly, except:
Caps Lock switches to the mouse layer, RGUI and APP are switches to the programming layer and media layer.
Mouse and programming layer switches can be held or double-tapped to lock.
Holding space switches to the MISC layer where I currently accumulate useful shortcuts.
Tapping left and right Shift, Ctrl and Alt will send (), [] and {} respectively.
Layers 1 and 2 (PROG1 and PROG2) emulate the US layout while still using a German OS keymap setting. I was annoyed of having to change the OS settings every time I wanted to use the US layout for coding, so I made these layers to behave just like the US layout even though the OS still uses German. The shift keys were a bit tricky, I had to use them as MO(PROG2) switches, so to get the actual expected behavior I enable LSFT for almost every keypress on PROG2 in ```process_record_user```. Since the shift keys are MO() function keys, they do not print () at the moment, which sucks. I'm working on it.
Layer 3 (MEDIA) just has a couple of media keys on it, mainly around the cursor keys and nav key cluster.
Layers 4 and 5 (MOUSE1 and MOUSE2) are mouse layers. Move the cursor using ESDF, scroll using HJKL, Space for left click, N and M for right and middle click. There's more, look at the keymap.
Layer 6 is a layer I don't have a good name for, so I call it MISC. You'll find cursor keys at ESDF, other navigation keys around the HJKL cluster and F12 to F24 on the F-keys. For now.

@ -4,7 +4,6 @@ void matrix_init_kb(void) {
// put your keyboard start-up code here // put your keyboard start-up code here
// runs once when the firmware starts up // runs once when the firmware starts up
matrix_init_quantum();
matrix_init_user(); matrix_init_user();
} }
@ -12,7 +11,6 @@ void matrix_scan_kb(void) {
// put your looping keyboard code here // put your looping keyboard code here
// runs every cycle (a lot) // runs every cycle (a lot)
matrix_scan_quantum();
matrix_scan_user(); matrix_scan_user();
} }
@ -25,6 +23,21 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
void led_set_kb(uint8_t usb_led) { void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
CONFIG_LED_IO;
CONFIG_LED_IO;
print_dec(usb_led);
if (usb_led & (1<<USB_LED_CAPS_LOCK))
USB_LED_CAPS_LOCK_ON;
else
USB_LED_CAPS_LOCK_OFF;
if (usb_led & (1<<USB_LED_NUM_LOCK))
USB_LED_NUM_LOCK_ON;
else
USB_LED_NUM_LOCK_OFF;
if (usb_led & (1<<USB_LED_SCROLL_LOCK))
USB_LED_SCROLL_LOCK_ON;
else
USB_LED_SCROLL_LOCK_OFF;
led_set_user(usb_led); led_set_user(usb_led);
} }

@ -3,6 +3,17 @@
#include "quantum.h" #include "quantum.h"
#define CONFIG_LED_IO \
DDRB |= (1<<7); \
DDRC |= (1<<5) | (1<<6);
#define USB_LED_CAPS_LOCK_ON PORTC &= ~(1<<6)
#define USB_LED_CAPS_LOCK_OFF PORTC |= (1<<6)
#define USB_LED_NUM_LOCK_ON PORTB &= ~(1<<7)
#define USB_LED_NUM_LOCK_OFF PORTB |= (1<<7)
#define USB_LED_SCROLL_LOCK_ON PORTC &= ~(1<<5)
#define USB_LED_SCROLL_LOCK_OFF PORTC |= (1<<5)
// This a shortcut to help you visually see your layout. // This a shortcut to help you visually see your layout.
// The first section contains all of the arguements // The first section contains all of the arguements
// The second converts the arguments into a two-dimensional array // The second converts the arguments into a two-dimensional array

@ -1,47 +0,0 @@
/*
Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <avr/io.h>
#include "stdint.h"
#include "led.h"
/* LED pin configuration
*
* Scroll Lock PC5
* Caps Lock PC6
* Num Lock PB7
*
*/
void led_set(uint8_t usb_led) {
DDRB |= (1<<7);
DDRC |= (1<<5) | (1<<6);
if (usb_led & (1<<USB_LED_CAPS_LOCK))
PORTC &= ~(1<<6);
else
PORTC |= (1<<6);
if (usb_led & (1<<USB_LED_NUM_LOCK))
PORTB &= ~(1<<7);
else
PORTB |= (1<<7);
if (usb_led & (1<<USB_LED_SCROLL_LOCK))
PORTC &= ~(1<<5);
else
PORTC |= (1<<5);
}

@ -67,6 +67,7 @@ void matrix_init(void) {
matrix[i] = 0; matrix[i] = 0;
matrix_debouncing[i] = 0; matrix_debouncing[i] = 0;
} }
matrix_init_quantum();
} }
uint8_t matrix_scan(void) { uint8_t matrix_scan(void) {
@ -94,7 +95,7 @@ uint8_t matrix_scan(void) {
} }
} }
} }
matrix_scan_quantum();
return 1; return 1;
} }

Loading…
Cancel
Save