diff options
author | Nicholas Shaff <nick@shadedream.com> | 2018-12-05 11:35:26 -0600 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-12-05 09:35:26 -0800 |
commit | d0da43fbdcb78603b34bcf6c0718e104b593c5ce (patch) | |
tree | 46d72e36f794b90f57642efbcaf209a849872590 | |
parent | 7d4955b2c453828ab8ba315720ce73e4dae0a0c3 (diff) | |
download | qmk_firmware-d0da43fbdcb78603b34bcf6c0718e104b593c5ce.tar.gz qmk_firmware-d0da43fbdcb78603b34bcf6c0718e104b593c5ce.zip |
Keyboard: Updated sixshooter keyboard to move LED macros into the default keymap. (#4428)
-rw-r--r-- | keyboards/sixshooter/keymaps/default/keymap.c | 39 | ||||
-rw-r--r-- | keyboards/sixshooter/sixshooter.c | 19 | ||||
-rw-r--r-- | keyboards/sixshooter/sixshooter.h | 11 |
3 files changed, 35 insertions, 34 deletions
diff --git a/keyboards/sixshooter/keymaps/default/keymap.c b/keyboards/sixshooter/keymaps/default/keymap.c index ca0973c60..51f115d93 100644 --- a/keyboards/sixshooter/keymaps/default/keymap.c +++ b/keyboards/sixshooter/keymaps/default/keymap.c | |||
@@ -18,10 +18,16 @@ | |||
18 | #define _BL 0 | 18 | #define _BL 0 |
19 | #define _FN 1 | 19 | #define _FN 1 |
20 | 20 | ||
21 | // Define keyboard specific keycodes for controlling on/off for all LEDs as they | ||
22 | // are all on different pins with this PCB, rather than a single backlight pin | ||
23 | enum custom_keycodes { | ||
24 | SS_LON = SAFE_RANGE, | ||
25 | SS_LOFF | ||
26 | }; | ||
21 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 27 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
22 | /* Keymap 0: Media Keys | 28 | /* Base Layer: Media Keys |
23 | * ,-----------. | 29 | * ,-----------. |
24 | * |Mut| V-| V+| | 30 | * |FN | V-| V+| |
25 | * |---+---+---| | 31 | * |---+---+---| |
26 | * |Prv|Ply|Nxt| | 32 | * |Prv|Ply|Nxt| |
27 | * `-----------' | 33 | * `-----------' |
@@ -30,13 +36,38 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
30 | MO(_FN), KC_VOLD, KC_VOLU, \ | 36 | MO(_FN), KC_VOLD, KC_VOLU, \ |
31 | KC_MPRV, KC_MPLY, KC_MNXT \ | 37 | KC_MPRV, KC_MPLY, KC_MNXT \ |
32 | ), | 38 | ), |
39 | /* FN Layer: LED control | ||
40 | * ,-----------. | ||
41 | * |FN | V-| V+| | ||
42 | * |---+---+---| | ||
43 | * |Prv|Ply|Nxt| | ||
44 | * `-----------' | ||
45 | */ | ||
33 | [_FN] = LAYOUT( | 46 | [_FN] = LAYOUT( |
34 | KC_TRNS, SS_LON, SS_LOFF, \ | 47 | KC_TRNS, SS_LON, SS_LOFF, \ |
35 | KC_TRNS, KC_TRNS, KC_TRNS | 48 | KC_NO, KC_NO, KC_NO |
36 | ), | 49 | ), |
37 | }; | 50 | }; |
38 | 51 | ||
52 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
53 | // Put your per-action keyboard code here. | ||
54 | // Runs for every action, just before processing by the firmware. | ||
55 | if (record->event.pressed) { | ||
56 | |||
57 | // Check for custom keycodes for turning on and off LEDs | ||
58 | switch(keycode) { | ||
59 | case SS_LON: | ||
60 | sixshooter_led_all_on(); | ||
61 | return false; | ||
62 | case SS_LOFF: | ||
63 | sixshooter_led_all_off(); | ||
64 | return false; | ||
65 | } | ||
66 | } | ||
67 | return true; | ||
68 | }; | ||
69 | |||
39 | void matrix_init_user(void) { | 70 | void matrix_init_user(void) { |
40 | /* Default all LEDs to on */ | 71 | // Default all LEDs to on |
41 | sixshooter_led_all_on(); | 72 | sixshooter_led_all_on(); |
42 | } | 73 | } |
diff --git a/keyboards/sixshooter/sixshooter.c b/keyboards/sixshooter/sixshooter.c index 814d219a2..87a739454 100644 --- a/keyboards/sixshooter/sixshooter.c +++ b/keyboards/sixshooter/sixshooter.c | |||
@@ -31,25 +31,6 @@ void matrix_scan_kb(void) { | |||
31 | matrix_scan_user(); | 31 | matrix_scan_user(); |
32 | } | 32 | } |
33 | 33 | ||
34 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
35 | // put your per-action keyboard code here | ||
36 | // runs for every action, just before processing by the firmware | ||
37 | if (record->event.pressed) { | ||
38 | |||
39 | /* Check for custom keycodes for turning on and off LEDs */ | ||
40 | switch(keycode) { | ||
41 | case SS_LON: | ||
42 | sixshooter_led_all_on(); | ||
43 | return false; | ||
44 | case SS_LOFF: | ||
45 | sixshooter_led_all_off(); | ||
46 | return false; | ||
47 | } | ||
48 | } | ||
49 | |||
50 | return process_record_user(keycode, record); | ||
51 | } | ||
52 | |||
53 | void led_set_kb(uint8_t usb_led) { | 34 | void led_set_kb(uint8_t usb_led) { |
54 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | 35 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here |
55 | 36 | ||
diff --git a/keyboards/sixshooter/sixshooter.h b/keyboards/sixshooter/sixshooter.h index d27b1e419..490d562d0 100644 --- a/keyboards/sixshooter/sixshooter.h +++ b/keyboards/sixshooter/sixshooter.h | |||
@@ -10,17 +10,6 @@ | |||
10 | { K00, K01, K02, K03, K04, K05 }, \ | 10 | { K00, K01, K02, K03, K04, K05 }, \ |
11 | } | 11 | } |
12 | 12 | ||
13 | |||
14 | /* | ||
15 | * Define keyboard specific keycodes for controlling on/off for all LEDs as they | ||
16 | * are all on different pins with this PCB, rather than a single backlight pin | ||
17 | */ | ||
18 | enum keyboard_keycode { | ||
19 | SS_LON = SAFE_RANGE, | ||
20 | SS_LOFF, | ||
21 | SAFE_RANGE_KB | ||
22 | }; | ||
23 | |||
24 | inline void sixshooter_led_0_on(void) { DDRB |= (1<<6); PORTB |= (1<<6); } | 13 | inline void sixshooter_led_0_on(void) { DDRB |= (1<<6); PORTB |= (1<<6); } |
25 | inline void sixshooter_led_1_on(void) { DDRC |= (1<<7); PORTC |= (1<<7); } | 14 | inline void sixshooter_led_1_on(void) { DDRC |= (1<<7); PORTC |= (1<<7); } |
26 | inline void sixshooter_led_2_on(void) { DDRD |= (1<<0); PORTD |= (1<<0); } | 15 | inline void sixshooter_led_2_on(void) { DDRD |= (1<<0); PORTD |= (1<<0); } |