diff options
| author | Joel Challis <git@zvecr.com> | 2020-11-17 17:06:30 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-17 17:06:30 +0000 |
| commit | ddcb1794fa83e62e5e48536f4bc02ada63da411a (patch) | |
| tree | db5df8970f8ed22c77bdd021b781a429a5f05b49 /keyboards | |
| parent | adfd34c4512f6215a49a8f705ce408d6c82fb8cc (diff) | |
| download | qmk_firmware-ddcb1794fa83e62e5e48536f4bc02ada63da411a.tar.gz qmk_firmware-ddcb1794fa83e62e5e48536f4bc02ada63da411a.zip | |
Refactor to use led config - Part 1 (#10905)
* Refactor to use led config
* Refactor to use led config
* Refactor to use led config
* Refactor to use led config
* Refactor to use led config
Diffstat (limited to 'keyboards')
35 files changed, 82 insertions, 627 deletions
diff --git a/keyboards/1upkeyboards/1up60hte/1up60hte.c b/keyboards/1upkeyboards/1up60hte/1up60hte.c index 3af0e9d40..460e42a0e 100644 --- a/keyboards/1upkeyboards/1up60hte/1up60hte.c +++ b/keyboards/1upkeyboards/1up60hte/1up60hte.c | |||
| @@ -16,19 +16,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include "1up60hte.h" | 18 | #include "1up60hte.h" |
| 19 | |||
| 20 | void keyboard_pre_init_kb(void) { | ||
| 21 | // put your keyboard start-up code here | ||
| 22 | // runs once when the firmware starts up | ||
| 23 | setPinOutput(B6); | ||
| 24 | keyboard_pre_init_user(); | ||
| 25 | } | ||
| 26 | |||
| 27 | void led_set_kb(uint8_t usb_led) { | ||
| 28 | if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { | ||
| 29 | writePinLow(B6); | ||
| 30 | } else { | ||
| 31 | writePinHigh(B6); | ||
| 32 | } | ||
| 33 | led_set_user(usb_led); | ||
| 34 | } \ No newline at end of file | ||
diff --git a/keyboards/1upkeyboards/1up60hte/config.h b/keyboards/1upkeyboards/1up60hte/config.h index 8c4d2fc30..c3ba030de 100644 --- a/keyboards/1upkeyboards/1up60hte/config.h +++ b/keyboards/1upkeyboards/1up60hte/config.h | |||
| @@ -40,6 +40,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 40 | /* COL2ROW or ROW2COL */ | 40 | /* COL2ROW or ROW2COL */ |
| 41 | #define DIODE_DIRECTION COL2ROW | 41 | #define DIODE_DIRECTION COL2ROW |
| 42 | 42 | ||
| 43 | #define LED_CAPS_LOCK_PIN B6 | ||
| 44 | #define LED_PIN_ON_STATE 0 | ||
| 45 | |||
| 43 | /* number of backlight levels */ | 46 | /* number of backlight levels */ |
| 44 | #define BACKLIGHT_PIN B7 | 47 | #define BACKLIGHT_PIN B7 |
| 45 | #ifdef BACKLIGHT_PIN | 48 | #ifdef BACKLIGHT_PIN |
diff --git a/keyboards/alf/dc60/config.h b/keyboards/alf/dc60/config.h index b4cff82d4..098891eee 100644 --- a/keyboards/alf/dc60/config.h +++ b/keyboards/alf/dc60/config.h | |||
| @@ -48,6 +48,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 48 | /* COL2ROW, ROW2COL*/ | 48 | /* COL2ROW, ROW2COL*/ |
| 49 | #define DIODE_DIRECTION COL2ROW | 49 | #define DIODE_DIRECTION COL2ROW |
| 50 | 50 | ||
| 51 | #define LED_CAPS_LOCK_PIN B7 | ||
| 52 | #define LED_PIN_ON_STATE 0 | ||
| 53 | |||
| 51 | #define BACKLIGHT_PIN B6 | 54 | #define BACKLIGHT_PIN B6 |
| 52 | #define BACKLIGHT_BREATHING | 55 | #define BACKLIGHT_BREATHING |
| 53 | #define BACKLIGHT_LEVELS 5 | 56 | #define BACKLIGHT_LEVELS 5 |
diff --git a/keyboards/alf/dc60/dc60.c b/keyboards/alf/dc60/dc60.c index 70979adf4..4096d10a6 100644 --- a/keyboards/alf/dc60/dc60.c +++ b/keyboards/alf/dc60/dc60.c | |||
| @@ -14,36 +14,3 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | #include "dc60.h" | 16 | #include "dc60.h" |
| 17 | |||
| 18 | void matrix_init_kb(void) { | ||
| 19 | // put your keyboard start-up code here | ||
| 20 | // runs once when the firmware starts up | ||
| 21 | |||
| 22 | matrix_init_user(); | ||
| 23 | } | ||
| 24 | |||
| 25 | void matrix_scan_kb(void) { | ||
| 26 | // put your looping keyboard code here | ||
| 27 | // runs every cycle (a lot) | ||
| 28 | |||
| 29 | matrix_scan_user(); | ||
| 30 | } | ||
| 31 | |||
| 32 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 33 | // put your per-action keyboard code here | ||
| 34 | // runs for every action, just before processing by the firmware | ||
| 35 | |||
| 36 | return process_record_user(keycode, record); | ||
| 37 | } | ||
| 38 | |||
| 39 | void led_set_kb(uint8_t usb_led) { | ||
| 40 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | ||
| 41 | DDRB |= (1 << 7); | ||
| 42 | PORTB &= ~(1 << 7); | ||
| 43 | } else { | ||
| 44 | DDRB &= ~(1 << 7); | ||
| 45 | PORTB &= ~(1 << 7); | ||
| 46 | } | ||
| 47 | |||
| 48 | led_set_user(usb_led); | ||
| 49 | } | ||
diff --git a/keyboards/alf/x11/config.h b/keyboards/alf/x11/config.h index fcf4e85a9..cd9893509 100644 --- a/keyboards/alf/x11/config.h +++ b/keyboards/alf/x11/config.h | |||
| @@ -48,10 +48,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 48 | /* COL2ROW, ROW2COL*/ | 48 | /* COL2ROW, ROW2COL*/ |
| 49 | #define DIODE_DIRECTION COL2ROW | 49 | #define DIODE_DIRECTION COL2ROW |
| 50 | 50 | ||
| 51 | /* | 51 | #define LED_NUM_LOCK_PIN E6 |
| 52 | * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. | 52 | #define LED_CAPS_LOCK_PIN C6 |
| 53 | */ | 53 | #define LED_SCROLL_LOCK_PIN C7 |
| 54 | #define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6 | 54 | #define LED_PIN_ON_STATE 0 |
| 55 | 55 | ||
| 56 | #define BACKLIGHT_PIN B7 | 56 | #define BACKLIGHT_PIN B7 |
| 57 | #define BACKLIGHT_BREATHING | 57 | #define BACKLIGHT_BREATHING |
diff --git a/keyboards/alf/x11/x11.c b/keyboards/alf/x11/x11.c index 9699918d5..28e77ecd3 100644 --- a/keyboards/alf/x11/x11.c +++ b/keyboards/alf/x11/x11.c | |||
| @@ -14,51 +14,3 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | #include "x11.h" | 16 | #include "x11.h" |
| 17 | |||
| 18 | void matrix_init_kb(void) { | ||
| 19 | // put your keyboard start-up code here | ||
| 20 | // runs once when the firmware starts up | ||
| 21 | |||
| 22 | setPinOutput(C6); | ||
| 23 | setPinOutput(E6); | ||
| 24 | setPinOutput(C7); | ||
| 25 | matrix_init_user(); | ||
| 26 | } | ||
| 27 | |||
| 28 | void matrix_scan_kb(void) { | ||
| 29 | // put your looping keyboard code here | ||
| 30 | // runs every cycle (a lot) | ||
| 31 | |||
| 32 | matrix_scan_user(); | ||
| 33 | } | ||
| 34 | |||
| 35 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 36 | // put your per-action keyboard code here | ||
| 37 | // runs for every action, just before processing by the firmware | ||
| 38 | |||
| 39 | return process_record_user(keycode, record); | ||
| 40 | } | ||
| 41 | |||
| 42 | void led_set_kb(uint8_t usb_led) { | ||
| 43 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | ||
| 44 | |||
| 45 | if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { | ||
| 46 | writePinLow(C6); | ||
| 47 | } else { | ||
| 48 | writePinHigh(C6); | ||
| 49 | } | ||
| 50 | |||
| 51 | if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) { | ||
| 52 | writePinLow(E6); | ||
| 53 | } else { | ||
| 54 | writePinHigh(E6); | ||
| 55 | } | ||
| 56 | |||
| 57 | if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) { | ||
| 58 | writePinLow(C7); | ||
| 59 | } else { | ||
| 60 | writePinHigh(C7); | ||
| 61 | } | ||
| 62 | |||
| 63 | led_set_user(usb_led); | ||
| 64 | } | ||
diff --git a/keyboards/amj60/amj60.c b/keyboards/amj60/amj60.c index 993a5917d..02aa116d5 100644 --- a/keyboards/amj60/amj60.c +++ b/keyboards/amj60/amj60.c | |||
| @@ -1,30 +1 @@ | |||
| 1 | #include "amj60.h" | #include "amj60.h" | |
| 2 | #include "led.h" | ||
| 3 | |||
| 4 | void matrix_init_kb(void) { | ||
| 5 | // put your keyboard start-up code here | ||
| 6 | // runs once when the firmware starts up | ||
| 7 | matrix_init_user(); | ||
| 8 | led_init_ports(); | ||
| 9 | }; | ||
| 10 | |||
| 11 | void matrix_scan_kb(void) { | ||
| 12 | // put your looping keyboard code here | ||
| 13 | // runs every cycle (a lot) | ||
| 14 | matrix_scan_user(); | ||
| 15 | }; | ||
| 16 | |||
| 17 | void led_init_ports(void) { | ||
| 18 | // * Set our LED pins as output | ||
| 19 | DDRB |= (1<<2); | ||
| 20 | } | ||
| 21 | |||
| 22 | void led_set_kb(uint8_t usb_led) { | ||
| 23 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | ||
| 24 | // Turn capslock on | ||
| 25 | PORTB &= ~(1<<2); | ||
| 26 | } else { | ||
| 27 | // Turn capslock off | ||
| 28 | PORTB |= (1<<2); | ||
| 29 | } | ||
| 30 | } | ||
diff --git a/keyboards/amj60/config.h b/keyboards/amj60/config.h index 81b70111b..79cfbe59e 100644 --- a/keyboards/amj60/config.h +++ b/keyboards/amj60/config.h | |||
| @@ -38,11 +38,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 38 | #define MATRIX_COL_PINS { F1, F0, E6, C7, C6, B0, D4, B1, B7, B5, B4, D7, D6, B3} | 38 | #define MATRIX_COL_PINS { F1, F0, E6, C7, C6, B0, D4, B1, B7, B5, B4, D7, D6, B3} |
| 39 | #define UNUSED_PINS | 39 | #define UNUSED_PINS |
| 40 | 40 | ||
| 41 | #define BACKLIGHT_PIN B6 | ||
| 42 | |||
| 43 | /* COL2ROW or ROW2COL */ | 41 | /* COL2ROW or ROW2COL */ |
| 44 | #define DIODE_DIRECTION COL2ROW | 42 | #define DIODE_DIRECTION COL2ROW |
| 45 | 43 | ||
| 44 | #define LED_CAPS_LOCK_PIN B2 | ||
| 45 | #define LED_PIN_ON_STATE 0 | ||
| 46 | |||
| 47 | #define BACKLIGHT_PIN B6 | ||
| 48 | |||
| 49 | |||
| 46 | /* define if matrix has ghost */ | 50 | /* define if matrix has ghost */ |
| 47 | //#define MATRIX_HAS_GHOST | 51 | //#define MATRIX_HAS_GHOST |
| 48 | 52 | ||
diff --git a/keyboards/cutie_club/wraith/config.h b/keyboards/cutie_club/wraith/config.h index a5d3f0ebc..e1d2d51d6 100644 --- a/keyboards/cutie_club/wraith/config.h +++ b/keyboards/cutie_club/wraith/config.h | |||
| @@ -48,10 +48,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 48 | /* COL2ROW, ROW2COL*/ | 48 | /* COL2ROW, ROW2COL*/ |
| 49 | #define DIODE_DIRECTION COL2ROW | 49 | #define DIODE_DIRECTION COL2ROW |
| 50 | 50 | ||
| 51 | /* | 51 | #define LED_CAPS_LOCK_PIN B3 |
| 52 | * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. | 52 | #define LED_PIN_ON_STATE 0 |
| 53 | */ | ||
| 54 | #define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6 | ||
| 55 | 53 | ||
| 56 | // #define BACKLIGHT_PIN B7 | 54 | // #define BACKLIGHT_PIN B7 |
| 57 | // #define BACKLIGHT_BREATHING | 55 | // #define BACKLIGHT_BREATHING |
diff --git a/keyboards/cutie_club/wraith/wraith.c b/keyboards/cutie_club/wraith/wraith.c index 95265384e..cb2d1911c 100644 --- a/keyboards/cutie_club/wraith/wraith.c +++ b/keyboards/cutie_club/wraith/wraith.c | |||
| @@ -15,29 +15,8 @@ | |||
| 15 | */ | 15 | */ |
| 16 | #include "wraith.h" | 16 | #include "wraith.h" |
| 17 | 17 | ||
| 18 | // Optional override functions below. | ||
| 19 | // You can leave any or all of these undefined. | ||
| 20 | // These are only required if you want to perform custom actions. | ||
| 21 | |||
| 22 | void matrix_init_kb(void) { | 18 | void matrix_init_kb(void) { |
| 23 | setPinOutput(B3); | 19 | setPinOutput(B0); |
| 24 | setPinOutput(B0); | ||
| 25 | matrix_init_user(); | ||
| 26 | } | ||
| 27 | |||
| 28 | void matrix_scan_kb(void) { | ||
| 29 | matrix_scan_user(); | ||
| 30 | } | ||
| 31 | |||
| 32 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 33 | return process_record_user(keycode, record); | ||
| 34 | } | ||
| 35 | 20 | ||
| 36 | void led_set_kb(uint8_t usb_led) { | 21 | matrix_init_user(); |
| 37 | if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { | ||
| 38 | writePinLow(B3); | ||
| 39 | } else { | ||
| 40 | writePinHigh(B3); | ||
| 41 | } | ||
| 42 | led_set_user(usb_led); | ||
| 43 | } | 22 | } |
diff --git a/keyboards/dz60/config.h b/keyboards/dz60/config.h index 3699ef755..24fd63836 100644 --- a/keyboards/dz60/config.h +++ b/keyboards/dz60/config.h | |||
| @@ -30,6 +30,9 @@ | |||
| 30 | /* COL2ROW, ROW2COL*/ | 30 | /* COL2ROW, ROW2COL*/ |
| 31 | #define DIODE_DIRECTION COL2ROW | 31 | #define DIODE_DIRECTION COL2ROW |
| 32 | 32 | ||
| 33 | #define LED_CAPS_LOCK_PIN B2 | ||
| 34 | #define LED_PIN_ON_STATE 0 | ||
| 35 | |||
| 33 | #define BACKLIGHT_PIN B6 | 36 | #define BACKLIGHT_PIN B6 |
| 34 | #define BACKLIGHT_LEVELS 5 | 37 | #define BACKLIGHT_LEVELS 5 |
| 35 | 38 | ||
diff --git a/keyboards/dz60/dz60.c b/keyboards/dz60/dz60.c index 936d027a3..23db2e4d7 100644 --- a/keyboards/dz60/dz60.c +++ b/keyboards/dz60/dz60.c | |||
| @@ -1,21 +1 @@ | |||
| 1 | #include "dz60.h" | #include "dz60.h" | |
| 2 | |||
| 3 | void matrix_init_kb(void) { | ||
| 4 | matrix_init_user(); | ||
| 5 | led_init_ports(); | ||
| 6 | }; | ||
| 7 | |||
| 8 | void led_init_ports(void) { | ||
| 9 | setPinOutput(B2); | ||
| 10 | writePinHigh(B2); | ||
| 11 | } | ||
| 12 | |||
| 13 | void led_set_kb(uint8_t usb_led) { | ||
| 14 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | ||
| 15 | writePinLow(B2); | ||
| 16 | } else { | ||
| 17 | writePinHigh(B2); | ||
| 18 | } | ||
| 19 | |||
| 20 | led_set_user(usb_led); | ||
| 21 | } | ||
diff --git a/keyboards/jd40/jd40.c b/keyboards/jd40/jd40.c index fa06356d9..1b68ddd4f 100644 --- a/keyboards/jd40/jd40.c +++ b/keyboards/jd40/jd40.c | |||
| @@ -1,26 +1 @@ | |||
| 1 | #include "jd40.h" | #include "jd40.h" | |
| 2 | |||
| 3 | void led_set_kb(uint8_t usb_led) { | ||
| 4 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | ||
| 5 | |||
| 6 | |||
| 7 | // if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | ||
| 8 | // gh60_caps_led_on(); | ||
| 9 | // } else { | ||
| 10 | // gh60_caps_led_off(); | ||
| 11 | // } | ||
| 12 | |||
| 13 | // if (usb_led & (1<<USB_LED_NUM_LOCK)) { | ||
| 14 | // gh60_esc_led_on(); | ||
| 15 | // } else { | ||
| 16 | // gh60_esc_led_off(); | ||
| 17 | // } | ||
| 18 | |||
| 19 | // if (usb_led & (1<<USB_LED_SCROLL_LOCK)) { | ||
| 20 | // gh60_fn_led_on(); | ||
| 21 | // } else { | ||
| 22 | // gh60_fn_led_off(); | ||
| 23 | // } | ||
| 24 | |||
| 25 | led_set_user(usb_led); | ||
| 26 | } | ||
diff --git a/keyboards/mechkeys/mk60/config.h b/keyboards/mechkeys/mk60/config.h index 9fccd8a8b..b408625f2 100644 --- a/keyboards/mechkeys/mk60/config.h +++ b/keyboards/mechkeys/mk60/config.h | |||
| @@ -53,6 +53,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 53 | */ | 53 | */ |
| 54 | #define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6 | 54 | #define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6 |
| 55 | 55 | ||
| 56 | #define LED_CAPS_LOCK_PIN B7 | ||
| 57 | #define LED_PIN_ON_STATE 0 | ||
| 58 | |||
| 56 | #define BACKLIGHT_PIN B6 | 59 | #define BACKLIGHT_PIN B6 |
| 57 | #define BACKLIGHT_BREATHING | 60 | #define BACKLIGHT_BREATHING |
| 58 | #define BACKLIGHT_LEVELS 6 | 61 | #define BACKLIGHT_LEVELS 6 |
diff --git a/keyboards/mechkeys/mk60/mk60.c b/keyboards/mechkeys/mk60/mk60.c index 4c6a059f4..7ec8bff22 100644 --- a/keyboards/mechkeys/mk60/mk60.c +++ b/keyboards/mechkeys/mk60/mk60.c | |||
| @@ -14,37 +14,3 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | #include "mk60.h" | 16 | #include "mk60.h" |
| 17 | |||
| 18 | void matrix_init_kb(void) { | ||
| 19 | // put your keyboard start-up code here | ||
| 20 | // runs once when the firmware starts up | ||
| 21 | setPinOutput(B7); | ||
| 22 | |||
| 23 | matrix_init_user(); | ||
| 24 | } | ||
| 25 | |||
| 26 | void matrix_scan_kb(void) { | ||
| 27 | // put your looping keyboard code here | ||
| 28 | // runs every cycle (a lot) | ||
| 29 | |||
| 30 | matrix_scan_user(); | ||
| 31 | } | ||
| 32 | |||
| 33 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 34 | // put your per-action keyboard code here | ||
| 35 | // runs for every action, just before processing by the firmware | ||
| 36 | |||
| 37 | return process_record_user(keycode, record); | ||
| 38 | } | ||
| 39 | |||
| 40 | void led_set_kb(uint8_t usb_led) { | ||
| 41 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | ||
| 42 | |||
| 43 | if(IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)){ | ||
| 44 | writePinLow(B7); | ||
| 45 | }else { | ||
| 46 | writePinHigh(B7); | ||
| 47 | } | ||
| 48 | |||
| 49 | led_set_user(usb_led); | ||
| 50 | } | ||
diff --git a/keyboards/moon/config.h b/keyboards/moon/config.h index a02cfdba1..12a949a07 100644 --- a/keyboards/moon/config.h +++ b/keyboards/moon/config.h | |||
| @@ -31,6 +31,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 31 | #define MATRIX_ROWS 8 | 31 | #define MATRIX_ROWS 8 |
| 32 | #define MATRIX_COLS 11 | 32 | #define MATRIX_COLS 11 |
| 33 | 33 | ||
| 34 | #define LED_CAPS_LOCK_PIN B5 | ||
| 35 | #define LED_SCROLL_LOCK_PIN B6 | ||
| 36 | |||
| 34 | /* 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 */ |
| 35 | #define DEBOUNCE 5 | 38 | #define DEBOUNCE 5 |
| 36 | 39 | ||
diff --git a/keyboards/moon/moon.c b/keyboards/moon/moon.c index c218bf5ef..95ce007e2 100644 --- a/keyboards/moon/moon.c +++ b/keyboards/moon/moon.c | |||
| @@ -14,56 +14,3 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | #include "moon.h" | 16 | #include "moon.h" |
| 17 | |||
| 18 | #define CAPS_PIN B5 | ||
| 19 | #define SCROLL_PIN B6 | ||
| 20 | |||
| 21 | // Optional override functions below. | ||
| 22 | // You can leave any or all of these undefined. | ||
| 23 | // These are only required if you want to perform custom actions. | ||
| 24 | |||
| 25 | void matrix_init_kb(void) { | ||
| 26 | // put your keyboard start-up code here | ||
| 27 | // runs once when the firmware starts up | ||
| 28 | |||
| 29 | setPinOutput(CAPS_PIN); | ||
| 30 | setPinOutput(SCROLL_PIN); | ||
| 31 | |||
| 32 | matrix_init_user(); | ||
| 33 | } | ||
| 34 | |||
| 35 | /* | ||
| 36 | |||
| 37 | void matrix_scan_kb(void) { | ||
| 38 | // put your looping keyboard code here | ||
| 39 | // runs every cycle (a lot) | ||
| 40 | |||
| 41 | matrix_scan_user(); | ||
| 42 | } | ||
| 43 | |||
| 44 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 45 | // put your per-action keyboard code here | ||
| 46 | // runs for every action, just before processing by the firmware | ||
| 47 | |||
| 48 | return process_record_user(keycode, record); | ||
| 49 | } | ||
| 50 | |||
| 51 | */ | ||
| 52 | |||
| 53 | void led_set_kb(uint8_t usb_led) { | ||
| 54 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | ||
| 55 | |||
| 56 | if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { | ||
| 57 | writePinHigh(CAPS_PIN); | ||
| 58 | } else { | ||
| 59 | writePinLow(CAPS_PIN); | ||
| 60 | } | ||
| 61 | |||
| 62 | if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) { | ||
| 63 | writePinHigh(SCROLL_PIN); | ||
| 64 | } else { | ||
| 65 | writePinLow(SCROLL_PIN); | ||
| 66 | } | ||
| 67 | |||
| 68 | led_set_user(usb_led); | ||
| 69 | } | ||
diff --git a/keyboards/mt980/config.h b/keyboards/mt980/config.h index 6b8b95295..56927be70 100644 --- a/keyboards/mt980/config.h +++ b/keyboards/mt980/config.h | |||
| @@ -22,6 +22,11 @@ | |||
| 22 | /* COL2ROW or ROW2COL */ | 22 | /* COL2ROW or ROW2COL */ |
| 23 | #define DIODE_DIRECTION ROW2COL | 23 | #define DIODE_DIRECTION ROW2COL |
| 24 | 24 | ||
| 25 | #define LED_NUM_LOCK_PIN C6 | ||
| 26 | #define LED_CAPS_LOCK_PIN C7 | ||
| 27 | #define LED_SCROLL_LOCK_PIN B5 | ||
| 28 | #define LED_PIN_ON_STATE 0 | ||
| 29 | |||
| 25 | /* number of backlight levels */ | 30 | /* number of backlight levels */ |
| 26 | #define BACKLIGHT_PIN B6 | 31 | #define BACKLIGHT_PIN B6 |
| 27 | #ifdef BACKLIGHT_PIN | 32 | #ifdef BACKLIGHT_PIN |
diff --git a/keyboards/mt980/mt980.c b/keyboards/mt980/mt980.c index 5461a3b21..69f7cc491 100644 --- a/keyboards/mt980/mt980.c +++ b/keyboards/mt980/mt980.c | |||
| @@ -1,65 +1 @@ | |||
| 1 | #include "mt980.h" | #include "mt980.h" | |
| 2 | |||
| 3 | __attribute__ ((weak)) | ||
| 4 | void matrix_init_keymap(void) {} | ||
| 5 | |||
| 6 | __attribute__ ((weak)) | ||
| 7 | void matrix_scan_keymap(void) {} | ||
| 8 | |||
| 9 | __attribute__ ((weak)) | ||
| 10 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | ||
| 11 | return true; | ||
| 12 | } | ||
| 13 | __attribute__ ((weak)) | ||
| 14 | uint32_t layer_state_set_keymap (uint32_t state) { | ||
| 15 | return state; | ||
| 16 | } | ||
| 17 | __attribute__ ((weak)) | ||
| 18 | void led_set_keymap(uint8_t usb_led) {} | ||
| 19 | |||
| 20 | void matrix_init_user(void) { | ||
| 21 | matrix_init_keymap(); | ||
| 22 | } | ||
| 23 | |||
| 24 | void matrix_scan_user(void) { | ||
| 25 | matrix_scan_keymap(); | ||
| 26 | } | ||
| 27 | |||
| 28 | void keyboard_pre_init_user(void) { | ||
| 29 | /* Set NUMLOCK indicator pin as output */ | ||
| 30 | setPinOutput(C6); | ||
| 31 | /* Set CAPSLOCK indicator pin as output */ | ||
| 32 | setPinOutput(C7); | ||
| 33 | /* Set SCROLLOCK indicator pin as output */ | ||
| 34 | setPinOutput(B5); | ||
| 35 | } | ||
| 36 | |||
| 37 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 38 | return process_record_keymap(keycode, record); | ||
| 39 | } | ||
| 40 | |||
| 41 | void led_set_user(uint8_t usb_led) { | ||
| 42 | |||
| 43 | if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) { | ||
| 44 | writePinLow(C6); | ||
| 45 | } | ||
| 46 | else { | ||
| 47 | writePinHigh(C6); | ||
| 48 | } | ||
| 49 | |||
| 50 | if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { | ||
| 51 | writePinLow(C7); | ||
| 52 | } | ||
| 53 | else { | ||
| 54 | writePinHigh(C7); | ||
| 55 | } | ||
| 56 | |||
| 57 | if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) { | ||
| 58 | writePinLow(B5); | ||
| 59 | } | ||
| 60 | else { | ||
| 61 | writePinHigh(B5); | ||
| 62 | } | ||
| 63 | |||
| 64 | led_set_keymap(usb_led); | ||
| 65 | } | ||
diff --git a/keyboards/omnikeyish/config.h b/keyboards/omnikeyish/config.h index d510c64c9..1bce90526 100644 --- a/keyboards/omnikeyish/config.h +++ b/keyboards/omnikeyish/config.h | |||
| @@ -24,9 +24,9 @@ | |||
| 24 | #endif | 24 | #endif |
| 25 | #define MATRIX_COL_PINS { F0, F1, F2, F3, F4, F5, F6, F7, C7, C6, C5, C4, C3, C2, C1, C0, B0, B1, B2, B3, B4, B5, B6 } | 25 | #define MATRIX_COL_PINS { F0, F1, F2, F3, F4, F5, F6, F7, C7, C6, C5, C4, C3, C2, C1, C0, B0, B1, B2, B3, B4, B5, B6 } |
| 26 | 26 | ||
| 27 | #define NUMLOCKLEDPIN E0 | 27 | #define LED_NUM_LOCK_PIN E0 |
| 28 | #define CAPSLOCKLEDPIN E1 | 28 | #define LED_CAPS_LOCK_PIN E1 |
| 29 | #define SCROLLLOCKLEDPIN B7 | 29 | #define LED_SCROLL_LOCK_PIN B7 |
| 30 | 30 | ||
| 31 | /* COL2ROW or ROW2COL */ | 31 | /* COL2ROW or ROW2COL */ |
| 32 | #define DIODE_DIRECTION ROW2COL | 32 | #define DIODE_DIRECTION ROW2COL |
diff --git a/keyboards/omnikeyish/omnikeyish.c b/keyboards/omnikeyish/omnikeyish.c index d7b68d41a..9b8ce7b97 100644 --- a/keyboards/omnikeyish/omnikeyish.c +++ b/keyboards/omnikeyish/omnikeyish.c | |||
| @@ -1,11 +1,6 @@ | |||
| 1 | #include "omnikeyish.h" | 1 | #include "omnikeyish.h" |
| 2 | 2 | ||
| 3 | void keyboard_pre_init_user(void) { | 3 | void keyboard_pre_init_user(void) { |
| 4 | /* Configure LED driving pins as output pins */ | ||
| 5 | setPinOutput(NUMLOCKLEDPIN); | ||
| 6 | setPinOutput(CAPSLOCKLEDPIN); | ||
| 7 | setPinOutput(SCROLLLOCKLEDPIN); | ||
| 8 | |||
| 9 | dynamic_macro_init(); | 4 | dynamic_macro_init(); |
| 10 | } | 5 | } |
| 11 | 6 | ||
| @@ -33,23 +28,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 33 | 28 | ||
| 34 | return true; | 29 | return true; |
| 35 | } | 30 | } |
| 36 | |||
| 37 | void led_set_user(uint8_t usb_led) { | ||
| 38 | if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) { | ||
| 39 | writePinHigh(NUMLOCKLEDPIN); | ||
| 40 | } else { | ||
| 41 | writePinLow(NUMLOCKLEDPIN); | ||
| 42 | } | ||
| 43 | |||
| 44 | if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { | ||
| 45 | writePinHigh(CAPSLOCKLEDPIN); | ||
| 46 | } else { | ||
| 47 | writePinLow(CAPSLOCKLEDPIN); | ||
| 48 | } | ||
| 49 | |||
| 50 | if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) { | ||
| 51 | writePinHigh(SCROLLLOCKLEDPIN); | ||
| 52 | } else { | ||
| 53 | writePinLow(SCROLLLOCKLEDPIN); | ||
| 54 | } | ||
| 55 | } \ No newline at end of file | ||
diff --git a/keyboards/tkc/m0lly/config.h b/keyboards/tkc/m0lly/config.h index 29bd8411e..77480995c 100644 --- a/keyboards/tkc/m0lly/config.h +++ b/keyboards/tkc/m0lly/config.h | |||
| @@ -43,6 +43,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 43 | /* COL2ROW or ROW2COL */ | 43 | /* COL2ROW or ROW2COL */ |
| 44 | #define DIODE_DIRECTION COL2ROW | 44 | #define DIODE_DIRECTION COL2ROW |
| 45 | 45 | ||
| 46 | #define LED_NUM_LOCK_PIN D2 | ||
| 47 | #define LED_CAPS_LOCK_PIN D3 | ||
| 48 | #define LED_SCROLL_LOCK_PIN D4 | ||
| 49 | |||
| 46 | #define BACKLIGHT_PIN B6 | 50 | #define BACKLIGHT_PIN B6 |
| 47 | #define BACKLIGHT_BREATHING | 51 | #define BACKLIGHT_BREATHING |
| 48 | #define BACKLIGHT_LEVELS 3 | 52 | #define BACKLIGHT_LEVELS 3 |
diff --git a/keyboards/tkc/m0lly/m0lly.c b/keyboards/tkc/m0lly/m0lly.c index e47f9531e..e04407a35 100644 --- a/keyboards/tkc/m0lly/m0lly.c +++ b/keyboards/tkc/m0lly/m0lly.c | |||
| @@ -14,63 +14,13 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | #include "m0lly.h" | 16 | #include "m0lly.h" |
| 17 | #include "led.h" | ||
| 18 | 17 | ||
| 19 | void keyboard_pre_init_kb(void) { | 18 | void keyboard_pre_init_kb(void) { |
| 20 | setPinInputHigh(D0); | 19 | setPinInputHigh(D0); |
| 21 | setPinInputHigh(D1); | 20 | setPinInputHigh(D1); |
| 22 | 21 | ||
| 23 | keyboard_pre_init_user(); | 22 | setPinOutput(B7); |
| 24 | } | 23 | writePinHigh(B7); |
| 25 | |||
| 26 | void matrix_init_kb(void) { | ||
| 27 | // put your keyboard start-up code here | ||
| 28 | // runs once when the firmware starts up | ||
| 29 | led_init_ports(); | ||
| 30 | matrix_init_user(); | ||
| 31 | } | ||
| 32 | |||
| 33 | void matrix_scan_kb(void) { | ||
| 34 | // put your looping keyboard code here | ||
| 35 | // runs every cycle (a lot) | ||
| 36 | |||
| 37 | matrix_scan_user(); | ||
| 38 | } | ||
| 39 | |||
| 40 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 41 | // put your per-action keyboard code here | ||
| 42 | // runs for every action, just before processing by the firmware | ||
| 43 | 24 | ||
| 44 | return process_record_user(keycode, record); | 25 | keyboard_pre_init_user(); |
| 45 | } | 26 | } |
| 46 | |||
| 47 | void led_init_ports(void) { | ||
| 48 | DDRD |= (1<<2) | (1<<3) | (1<<4); // OUT | ||
| 49 | DDRB |= (1<<7); // OUT | ||
| 50 | PORTB |= (1<<7); | ||
| 51 | } | ||
| 52 | |||
| 53 | void led_set_kb(uint8_t usb_led) { | ||
| 54 | // led_set_user(usb_led); | ||
| 55 | if (usb_led & (1<<USB_LED_NUM_LOCK)) { | ||
| 56 | // Turn numlock on | ||
| 57 | PORTD |= (1<<2); | ||
| 58 | } else { | ||
| 59 | // Turn numlock off | ||
| 60 | PORTD &= ~(1<<2); | ||
| 61 | } | ||
| 62 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | ||
| 63 | // Turn capslock on | ||
| 64 | PORTD |= (1<<3); | ||
| 65 | } else { | ||
| 66 | // Turn capslock off | ||
| 67 | PORTD &= ~(1<<3); | ||
| 68 | } | ||
| 69 | if (usb_led & (1<<USB_LED_SCROLL_LOCK)) { | ||
| 70 | // Turn scrolllock on | ||
| 71 | PORTD |= (1<<4); | ||
| 72 | } else { | ||
| 73 | // Turn scrolllock off | ||
| 74 | PORTD &= ~(1<<4); | ||
| 75 | } | ||
| 76 | } \ No newline at end of file | ||
diff --git a/keyboards/tkc/tkc1800/config.h b/keyboards/tkc/tkc1800/config.h index 9c35699c9..f54583c2b 100644 --- a/keyboards/tkc/tkc1800/config.h +++ b/keyboards/tkc/tkc1800/config.h | |||
| @@ -43,6 +43,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 43 | /* COL2ROW or ROW2COL */ | 43 | /* COL2ROW or ROW2COL */ |
| 44 | #define DIODE_DIRECTION COL2ROW | 44 | #define DIODE_DIRECTION COL2ROW |
| 45 | 45 | ||
| 46 | #define LED_NUM_LOCK_PIN D2 | ||
| 47 | #define LED_CAPS_LOCK_PIN D3 | ||
| 48 | #define LED_SCROLL_LOCK_PIN D4 | ||
| 49 | |||
| 46 | #define BACKLIGHT_PIN B6 | 50 | #define BACKLIGHT_PIN B6 |
| 47 | #define BACKLIGHT_BREATHING | 51 | #define BACKLIGHT_BREATHING |
| 48 | #define BACKLIGHT_LEVELS 3 | 52 | #define BACKLIGHT_LEVELS 3 |
diff --git a/keyboards/tkc/tkc1800/tkc1800.c b/keyboards/tkc/tkc1800/tkc1800.c index 4232c97d5..08e4e0bb3 100644 --- a/keyboards/tkc/tkc1800/tkc1800.c +++ b/keyboards/tkc/tkc1800/tkc1800.c | |||
| @@ -14,63 +14,13 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | #include "tkc1800.h" | 16 | #include "tkc1800.h" |
| 17 | #include "led.h" | ||
| 18 | 17 | ||
| 19 | void keyboard_pre_init_kb(void) { | 18 | void keyboard_pre_init_kb(void) { |
| 20 | setPinInputHigh(D0); | 19 | setPinInputHigh(D0); |
| 21 | setPinInputHigh(D1); | 20 | setPinInputHigh(D1); |
| 22 | 21 | ||
| 23 | keyboard_pre_init_user(); | 22 | setPinOutput(B7); |
| 24 | } | 23 | writePinHigh(B7); |
| 25 | |||
| 26 | void matrix_init_kb(void) { | ||
| 27 | // put your keyboard start-up code here | ||
| 28 | // runs once when the firmware starts up | ||
| 29 | led_init_ports(); | ||
| 30 | matrix_init_user(); | ||
| 31 | } | ||
| 32 | |||
| 33 | void matrix_scan_kb(void) { | ||
| 34 | // put your looping keyboard code here | ||
| 35 | // runs every cycle (a lot) | ||
| 36 | |||
| 37 | matrix_scan_user(); | ||
| 38 | } | ||
| 39 | |||
| 40 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 41 | // put your per-action keyboard code here | ||
| 42 | // runs for every action, just before processing by the firmware | ||
| 43 | 24 | ||
| 44 | return process_record_user(keycode, record); | 25 | keyboard_pre_init_user(); |
| 45 | } | 26 | } |
| 46 | |||
| 47 | void led_init_ports(void) { | ||
| 48 | DDRD |= (1<<2) | (1<<3) | (1<<4); // OUT | ||
| 49 | DDRB |= (1<<7); // OUT | ||
| 50 | PORTB |= (1<<7); | ||
| 51 | } | ||
| 52 | |||
| 53 | void led_set_kb(uint8_t usb_led) { | ||
| 54 | // led_set_user(usb_led); | ||
| 55 | if (usb_led & (1<<USB_LED_NUM_LOCK)) { | ||
| 56 | // Turn numlock on | ||
| 57 | PORTD |= (1<<2); | ||
| 58 | } else { | ||
| 59 | // Turn numlock off | ||
| 60 | PORTD &= ~(1<<2); | ||
| 61 | } | ||
| 62 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | ||
| 63 | // Turn capslock on | ||
| 64 | PORTD |= (1<<3); | ||
| 65 | } else { | ||
| 66 | // Turn capslock off | ||
| 67 | PORTD &= ~(1<<3); | ||
| 68 | } | ||
| 69 | if (usb_led & (1<<USB_LED_SCROLL_LOCK)) { | ||
| 70 | // Turn scrolllock on | ||
| 71 | PORTD |= (1<<4); | ||
| 72 | } else { | ||
| 73 | // Turn scrolllock off | ||
| 74 | PORTD &= ~(1<<4); | ||
| 75 | } | ||
| 76 | } \ No newline at end of file | ||
diff --git a/keyboards/xd84/config.h b/keyboards/xd84/config.h index 2a77db68a..503cba318 100644 --- a/keyboards/xd84/config.h +++ b/keyboards/xd84/config.h | |||
| @@ -47,6 +47,9 @@ | |||
| 47 | /* COL2ROW, ROW2COL */ | 47 | /* COL2ROW, ROW2COL */ |
| 48 | //#define DIODE_DIRECTION COL2ROW | 48 | //#define DIODE_DIRECTION COL2ROW |
| 49 | 49 | ||
| 50 | #define LED_CAPS_LOCK_PIN B6 | ||
| 51 | #define LED_PIN_ON_STATE 0 | ||
| 52 | |||
| 50 | #define BACKLIGHT_PIN B5 | 53 | #define BACKLIGHT_PIN B5 |
| 51 | #define BACKLIGHT_LEVELS 10 | 54 | #define BACKLIGHT_LEVELS 10 |
| 52 | // #define BACKLIGHT_BREATHING | 55 | // #define BACKLIGHT_BREATHING |
diff --git a/keyboards/xd84/xd84.c b/keyboards/xd84/xd84.c index eaf531421..dec4ef95e 100644 --- a/keyboards/xd84/xd84.c +++ b/keyboards/xd84/xd84.c | |||
| @@ -14,19 +14,3 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | #include "xd84.h" | 16 | #include "xd84.h" |
| 17 | |||
| 18 | void keyboard_pre_init_kb(void) { | ||
| 19 | setPinOutput(B6); | ||
| 20 | |||
| 21 | keyboard_pre_init_user(); | ||
| 22 | } | ||
| 23 | |||
| 24 | void led_set_kb(uint8_t usb_led) { | ||
| 25 | if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { | ||
| 26 | writePinLow(B6); | ||
| 27 | } else { | ||
| 28 | writePinHigh(B6); | ||
| 29 | } | ||
| 30 | |||
| 31 | led_set_user(usb_led); | ||
| 32 | } | ||
diff --git a/keyboards/xd84pro/config.h b/keyboards/xd84pro/config.h index 7fd4496fe..01f410ea6 100644 --- a/keyboards/xd84pro/config.h +++ b/keyboards/xd84pro/config.h | |||
| @@ -35,6 +35,9 @@ | |||
| 35 | 35 | ||
| 36 | #define DIODE_DIRECTION COL2ROW | 36 | #define DIODE_DIRECTION COL2ROW |
| 37 | 37 | ||
| 38 | #define LED_CAPS_LOCK_PIN B2 | ||
| 39 | #define LED_PIN_ON_STATE 0 | ||
| 40 | |||
| 38 | #define RGB_DI_PIN F6 | 41 | #define RGB_DI_PIN F6 |
| 39 | #ifdef RGB_DI_PIN | 42 | #ifdef RGB_DI_PIN |
| 40 | #define RGBLED_NUM 12 | 43 | #define RGBLED_NUM 12 |
diff --git a/keyboards/xd84pro/xd84pro.c b/keyboards/xd84pro/xd84pro.c index cba8a57f2..0eb52fda0 100644 --- a/keyboards/xd84pro/xd84pro.c +++ b/keyboards/xd84pro/xd84pro.c | |||
| @@ -14,17 +14,3 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | #include "xd84pro.h" | 16 | #include "xd84pro.h" |
| 17 | |||
| 18 | void keyboard_pre_init_kb(void) { | ||
| 19 | led_init_ports(); | ||
| 20 | keyboard_pre_init_user(); | ||
| 21 | } | ||
| 22 | void led_init_ports(void) { | ||
| 23 | setPinOutput(B2); | ||
| 24 | } | ||
| 25 | bool led_update_kb(led_t led_state) { | ||
| 26 | if (led_update_user(led_state)) { | ||
| 27 | writePin(B2, !led_state.caps_lock); | ||
| 28 | } | ||
| 29 | return false; | ||
| 30 | } \ No newline at end of file | ||
diff --git a/keyboards/xd96/config.h b/keyboards/xd96/config.h index 799b835df..cf6fec1b9 100644 --- a/keyboards/xd96/config.h +++ b/keyboards/xd96/config.h | |||
| @@ -47,6 +47,10 @@ | |||
| 47 | /* COL2ROW, ROW2COL */ | 47 | /* COL2ROW, ROW2COL */ |
| 48 | //#define DIODE_DIRECTION COL2ROW | 48 | //#define DIODE_DIRECTION COL2ROW |
| 49 | 49 | ||
| 50 | #define LED_NUM_LOCK_PIN C6 | ||
| 51 | #define LED_CAPS_LOCK_PIN B6 | ||
| 52 | #define LED_PIN_ON_STATE 0 | ||
| 53 | |||
| 50 | #define BACKLIGHT_PIN B5 | 54 | #define BACKLIGHT_PIN B5 |
| 51 | #define BACKLIGHT_LEVELS 10 | 55 | #define BACKLIGHT_LEVELS 10 |
| 52 | // #define BACKLIGHT_BREATHING | 56 | // #define BACKLIGHT_BREATHING |
diff --git a/keyboards/xd96/xd96.c b/keyboards/xd96/xd96.c index e2af9f100..2c67ee3d7 100644 --- a/keyboards/xd96/xd96.c +++ b/keyboards/xd96/xd96.c | |||
| @@ -14,29 +14,3 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | #include "xd96.h" | 16 | #include "xd96.h" |
| 17 | |||
| 18 | #define CAPS_PIN B6 | ||
| 19 | #define NUMLOCK_PIN C6 | ||
| 20 | |||
| 21 | void keyboard_pre_init_kb(void) { | ||
| 22 | setPinOutput(CAPS_PIN); | ||
| 23 | setPinOutput(NUMLOCK_PIN); | ||
| 24 | |||
| 25 | keyboard_pre_init_user(); | ||
| 26 | } | ||
| 27 | |||
| 28 | void led_set_kb(uint8_t usb_led) { | ||
| 29 | if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { | ||
| 30 | writePinLow(CAPS_PIN); | ||
| 31 | } else { | ||
| 32 | writePinHigh(CAPS_PIN); | ||
| 33 | } | ||
| 34 | |||
| 35 | if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) { | ||
| 36 | writePinLow(NUMLOCK_PIN); | ||
| 37 | } else { | ||
| 38 | writePinHigh(NUMLOCK_PIN); | ||
| 39 | } | ||
| 40 | |||
| 41 | led_set_user(usb_led); | ||
| 42 | } | ||
diff --git a/keyboards/yd68/config.h b/keyboards/yd68/config.h index 17461c5dc..7b4a43bfd 100644 --- a/keyboards/yd68/config.h +++ b/keyboards/yd68/config.h | |||
| @@ -48,6 +48,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 48 | /* COL2ROW, ROW2COL*/ | 48 | /* COL2ROW, ROW2COL*/ |
| 49 | #define DIODE_DIRECTION COL2ROW | 49 | #define DIODE_DIRECTION COL2ROW |
| 50 | 50 | ||
| 51 | #define LED_CAPS_LOCK_PIN D4 | ||
| 52 | #define LED_PIN_ON_STATE 0 | ||
| 53 | |||
| 51 | // #define BACKLIGHT_PIN B7 | 54 | // #define BACKLIGHT_PIN B7 |
| 52 | // #define BACKLIGHT_BREATHING | 55 | // #define BACKLIGHT_BREATHING |
| 53 | // #define BACKLIGHT_LEVELS 3 | 56 | // #define BACKLIGHT_LEVELS 3 |
diff --git a/keyboards/yd68/yd68.c b/keyboards/yd68/yd68.c index f34661dd3..22f75f7f8 100644 --- a/keyboards/yd68/yd68.c +++ b/keyboards/yd68/yd68.c | |||
| @@ -15,59 +15,22 @@ | |||
| 15 | */ | 15 | */ |
| 16 | #include "yd68.h" | 16 | #include "yd68.h" |
| 17 | 17 | ||
| 18 | void matrix_init_kb(void) { | 18 | void keyboard_pre_init_kb(void) { |
| 19 | // put your keyboard start-up code here | ||
| 20 | // runs once when the firmware starts up | ||
| 21 | |||
| 22 | //Capslock LED Output Low | ||
| 23 | DDRD |= (1<<4); | ||
| 24 | PORTD &= ~(1<<4); | ||
| 25 | |||
| 26 | //Backlight LEDs Output Low | 19 | //Backlight LEDs Output Low |
| 27 | DDRD |= (1<<6); | 20 | setPinOutput(D6); |
| 28 | PORTD &= ~(1<<6); | 21 | writePinLow(D6); |
| 29 | 22 | ||
| 30 | //RGB power output low | 23 | //RGB power output low |
| 31 | DDRE |= (1<<2); | 24 | setPinOutput(E2); |
| 32 | PORTE &= ~(1<<2); | 25 | writePinLow(E2); |
| 33 | 26 | ||
| 34 | //Bluetooth power output high | 27 | //Bluetooth power output high |
| 35 | DDRB |= (1<<2); | 28 | setPinOutput(B2); |
| 36 | PORTB |= (1<<2); | 29 | writePinLow(B2); |
| 37 | 30 | ||
| 38 | //RGB data output low | 31 | //RGB data output low |
| 39 | DDRB |= (1<<3); | 32 | setPinOutput(B3); |
| 40 | PORTB &= ~(1<<3); | 33 | writePinLow(B3); |
| 41 | |||
| 42 | matrix_init_user(); | ||
| 43 | } | ||
| 44 | |||
| 45 | void matrix_scan_kb(void) { | ||
| 46 | // put your looping keyboard code here | ||
| 47 | // runs every cycle (a lot) | ||
| 48 | |||
| 49 | matrix_scan_user(); | ||
| 50 | } | ||
| 51 | |||
| 52 | bool process_record_kb(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 | |||
| 56 | return process_record_user(keycode, record); | ||
| 57 | } | ||
| 58 | |||
| 59 | void led_set_kb(uint8_t usb_led) { | ||
| 60 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | ||
| 61 | 34 | ||
| 62 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | 35 | keyboard_pre_init_user(); |
| 63 | // output low | ||
| 64 | DDRD |= (1<<4); | ||
| 65 | PORTD &= ~(1<<4); | ||
| 66 | } else { | ||
| 67 | // output high | ||
| 68 | DDRD |= (1<<4); | ||
| 69 | PORTD |= (1<<4); | ||
| 70 | } | ||
| 71 | |||
| 72 | led_set_user(usb_led); | ||
| 73 | } | 36 | } |
diff --git a/keyboards/z150_bh/config.h b/keyboards/z150_bh/config.h index fc33021ff..9fa1f0c52 100644 --- a/keyboards/z150_bh/config.h +++ b/keyboards/z150_bh/config.h | |||
| @@ -22,6 +22,10 @@ | |||
| 22 | /* COL2ROW or ROW2COL */ | 22 | /* COL2ROW or ROW2COL */ |
| 23 | #define DIODE_DIRECTION COL2ROW | 23 | #define DIODE_DIRECTION COL2ROW |
| 24 | 24 | ||
| 25 | #define LED_NUM_LOCK_PIN E7 | ||
| 26 | #define LED_CAPS_LOCK_PIN B0 | ||
| 27 | #define LED_SCROLL_LOCK_PIN E6 | ||
| 28 | |||
| 25 | /* Set 0 if debouncing isn't needed */ | 29 | /* Set 0 if debouncing isn't needed */ |
| 26 | #define DEBOUNCE 5 | 30 | #define DEBOUNCE 5 |
| 27 | 31 | ||
diff --git a/keyboards/z150_bh/z150_bh.c b/keyboards/z150_bh/z150_bh.c index 6db784b56..b75a1ff19 100644 --- a/keyboards/z150_bh/z150_bh.c +++ b/keyboards/z150_bh/z150_bh.c | |||
| @@ -1,32 +1 @@ | |||
| 1 | #include "z150_bh.h" | #include "z150_bh.h" | |
| 2 | |||
| 3 | void matrix_init_kb(void) { | ||
| 4 | setPinOutput(B0); | ||
| 5 | setPinOutput(E6); | ||
| 6 | setPinOutput(E7); | ||
| 7 | |||
| 8 | matrix_init_user(); | ||
| 9 | }; | ||
| 10 | |||
| 11 | void led_set_kb(uint8_t usb_led) { | ||
| 12 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | ||
| 13 | if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) { | ||
| 14 | writePinHigh(E7); | ||
| 15 | } else { | ||
| 16 | writePinLow(E7); | ||
| 17 | } | ||
| 18 | |||
| 19 | if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { | ||
| 20 | writePinHigh(B0); | ||
| 21 | } else { | ||
| 22 | writePinLow(B0); | ||
| 23 | } | ||
| 24 | |||
| 25 | if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) { | ||
| 26 | writePinHigh(E6); | ||
| 27 | } else { | ||
| 28 | writePinLow(E6); | ||
| 29 | } | ||
| 30 | |||
| 31 | led_set_user(usb_led); | ||
| 32 | } | ||
