diff options
| author | Joel Challis <git@zvecr.com> | 2020-11-21 19:11:24 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-21 19:11:24 +0000 |
| commit | 23222625c201cd960a5b4a99ee52e74d4c13bba9 (patch) | |
| tree | 0fc0f24d2a60fb9e327debaca0b9fac72716487a /keyboards/kinesis | |
| parent | 4368611bfd87a544689ed10bb4450a39314bf1a1 (diff) | |
| download | qmk_firmware-23222625c201cd960a5b4a99ee52e74d4c13bba9.tar.gz qmk_firmware-23222625c201cd960a5b4a99ee52e74d4c13bba9.zip | |
Refactor to use led config - Part 5 (#10975)
* Refactor to use led config
* Refactor to use led config
* Refactor to use led config
Diffstat (limited to 'keyboards/kinesis')
| -rw-r--r-- | keyboards/kinesis/stapelberg/config.h | 7 | ||||
| -rw-r--r-- | keyboards/kinesis/stapelberg/stapelberg.c | 60 |
2 files changed, 6 insertions, 61 deletions
diff --git a/keyboards/kinesis/stapelberg/config.h b/keyboards/kinesis/stapelberg/config.h index 992480195..5037baebd 100644 --- a/keyboards/kinesis/stapelberg/config.h +++ b/keyboards/kinesis/stapelberg/config.h | |||
| @@ -27,7 +27,12 @@ | |||
| 27 | 27 | ||
| 28 | /* COL2ROW or ROW2COL */ | 28 | /* COL2ROW or ROW2COL */ |
| 29 | #define DIODE_DIRECTION COL2ROW | 29 | #define DIODE_DIRECTION COL2ROW |
| 30 | 30 | ||
| 31 | #define LED_NUM_LOCK_PIN F2 | ||
| 32 | #define LED_CAPS_LOCK_PIN F3 | ||
| 33 | #define LED_SCROLL_LOCK_PIN F1 | ||
| 34 | #define LED_COMPOSE_PIN F0 | ||
| 35 | #define LED_PIN_ON_STATE 0 | ||
| 31 | 36 | ||
| 32 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | 37 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ |
| 33 | #define DEBOUNCE 5 | 38 | #define DEBOUNCE 5 |
diff --git a/keyboards/kinesis/stapelberg/stapelberg.c b/keyboards/kinesis/stapelberg/stapelberg.c index af407ac4f..a69679eef 100644 --- a/keyboards/kinesis/stapelberg/stapelberg.c +++ b/keyboards/kinesis/stapelberg/stapelberg.c | |||
| @@ -1,61 +1 @@ | |||
| 1 | #include "stapelberg.h" | #include "stapelberg.h" | |
| 2 | |||
| 3 | void matrix_init_kb(void) { | ||
| 4 | // put your keyboard start-up code here | ||
| 5 | // runs once when the firmware starts up | ||
| 6 | // * Set our LED pins as output | ||
| 7 | DDRF |= (1<<0); // Keypad LED | ||
| 8 | DDRF |= (1<<1); // ScrLock LED | ||
| 9 | DDRF |= (1<<2); // NumLock LED | ||
| 10 | DDRF |= (1<<3); // CapsLock LED | ||
| 11 | |||
| 12 | matrix_init_user(); | ||
| 13 | } | ||
| 14 | |||
| 15 | void matrix_scan_kb(void) { | ||
| 16 | // put your looping keyboard code here | ||
| 17 | // runs every cycle (a lot) | ||
| 18 | |||
| 19 | matrix_scan_user(); | ||
| 20 | } | ||
| 21 | |||
| 22 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 23 | // put your per-action keyboard code here | ||
| 24 | // runs for every action, just before processing by the firmware | ||
| 25 | |||
| 26 | return process_record_user(keycode, record); | ||
| 27 | } | ||
| 28 | |||
| 29 | void led_init_ports() { | ||
| 30 | // * Set our LED pins as output | ||
| 31 | DDRF |= (1<<0); // Keypad LED | ||
| 32 | DDRF |= (1<<1); // ScrLock LED | ||
| 33 | DDRF |= (1<<2); // NumLock LED | ||
| 34 | DDRF |= (1<<3); // CapsLock LED | ||
| 35 | } | ||
| 36 | |||
| 37 | void led_set_kb(uint8_t usb_led) { | ||
| 38 | if (usb_led & (1<<USB_LED_COMPOSE)) { | ||
| 39 | PORTF &= ~(1<<0); | ||
| 40 | } else { | ||
| 41 | PORTF |= (1<<0); | ||
| 42 | } | ||
| 43 | |||
| 44 | if (usb_led & (1<<USB_LED_SCROLL_LOCK)) { | ||
| 45 | PORTF &= ~(1<<1); | ||
| 46 | } else { | ||
| 47 | PORTF |= (1<<1); | ||
| 48 | } | ||
| 49 | |||
| 50 | if (usb_led & (1<<USB_LED_NUM_LOCK)) { | ||
| 51 | PORTF &= ~(1<<2); | ||
| 52 | } else { | ||
| 53 | PORTF |= (1<<2); | ||
| 54 | } | ||
| 55 | |||
| 56 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | ||
| 57 | PORTF &= ~(1<<3); | ||
| 58 | } else { | ||
| 59 | PORTF |= (1<<3); | ||
| 60 | } | ||
| 61 | } | ||
