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 | |
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
42 files changed, 81 insertions, 671 deletions
diff --git a/keyboards/al1/al1.c b/keyboards/al1/al1.c index e50a6373b4..460a7620cf 100644 --- a/keyboards/al1/al1.c +++ b/keyboards/al1/al1.c @@ -14,27 +14,3 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "al1.h" - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - return process_record_user(keycode, record); -} - -void led_set_kb(uint8_t usb_led) { - CONFIG_LED_IO; - print_dec(usb_led); - if (usb_led & (1<<USB_LED_CAPS_LOCK)) - PORTB &= ~(1<<7); - else - PORTB |= (1<<7); - - if (usb_led & (1<<USB_LED_NUM_LOCK)) - PORTD &= ~(1<<0); - else - PORTD |= (1<<0); - - if (usb_led & (1<<USB_LED_SCROLL_LOCK)) - PORTD &= ~(1<<1); - else - PORTD |= (1<<1); - led_set_user(usb_led); -} diff --git a/keyboards/al1/al1.h b/keyboards/al1/al1.h index 17a0c96552..c313a898d2 100644 --- a/keyboards/al1/al1.h +++ b/keyboards/al1/al1.h @@ -18,11 +18,6 @@ #include "quantum.h" -#define CONFIG_LED_IO \ - DDRB |= (1<<7) | (1<<6); \ - DDRD |= (1<<0) | (1<<1); - - #define LAYOUT( \ K500, K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, K015, K415, K414,\ K501, K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, K115, K215, K413,\ diff --git a/keyboards/al1/config.h b/keyboards/al1/config.h index f4ded4346c..6a59afae7a 100644 --- a/keyboards/al1/config.h +++ b/keyboards/al1/config.h @@ -46,6 +46,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* COL2ROW, ROW2COL*/ #define DIODE_DIRECTION COL2ROW +#define LED_NUM_LOCK_PIN D0 +#define LED_CAPS_LOCK_PIN B7 +#define LED_SCROLL_LOCK_PIN D1 +#define LED_PIN_ON_STATE 0 + #define BACKLIGHT_PIN B6 #define BACKLIGHT_BREATHING #define BACKLIGHT_LEVELS 3 diff --git a/keyboards/amj40/amj40.c b/keyboards/amj40/amj40.c index 5a23769991..20742c3252 100755 --- a/keyboards/amj40/amj40.c +++ b/keyboards/amj40/amj40.c @@ -1,30 +1 @@ #include "amj40.h" -#include "led.h" - -void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - matrix_init_user(); - led_init_ports(); -}; - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - matrix_scan_user(); -}; - -void led_init_ports(void) { - // * Set our LED pins as output - DDRB |= (1<<2); -} - -void led_set_kb(uint8_t usb_led) { - if (usb_led & (1<<USB_LED_CAPS_LOCK)) { - // Turn capslock on - PORTB &= ~(1<<2); - } else { - // Turn capslock off - PORTB |= (1<<2); - } -} diff --git a/keyboards/amj40/config.h b/keyboards/amj40/config.h index f9a3c1ac69..5534dbf10c 100755 --- a/keyboards/amj40/config.h +++ b/keyboards/amj40/config.h @@ -38,6 +38,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MATRIX_COL_PINS { F1, F0, E6, C7, C6, B0, D4, B1, B7, B5, B4, D7} #define UNUSED_PINS +#define LED_CAPS_LOCK_PIN B2 +#define LED_PIN_ON_STATE 0 + #define BACKLIGHT_PIN B6 /* COL2ROW or ROW2COL */ diff --git a/keyboards/doro67/multi/config.h b/keyboards/doro67/multi/config.h index d76e7affff..83a9220386 100644 --- a/keyboards/doro67/multi/config.h +++ b/keyboards/doro67/multi/config.h @@ -29,5 +29,8 @@ #define DIODE_DIRECTION COL2ROW +#define LED_CAPS_LOCK_PIN E6 +#define LED_PIN_ON_STATE 0 + #define BACKLIGHT_PIN B7 #define BACKLIGHT_LEVELS 7 diff --git a/keyboards/doro67/multi/multi.c b/keyboards/doro67/multi/multi.c index 14e3359c1a..3ab1f53653 100644 --- a/keyboards/doro67/multi/multi.c +++ b/keyboards/doro67/multi/multi.c @@ -14,37 +14,3 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "multi.h" - -void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - - setPinOutput(E6); - matrix_init_user(); -} - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - - matrix_scan_user(); -} - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - // put your per-action keyboard code here - // runs for every action, just before processing by the firmware - - return process_record_user(keycode, record); -} - -void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here - - if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { - writePinLow(E6); - } else { - writePinHigh(E6); - } - - led_set_user(usb_led); -} diff --git a/keyboards/doro67/regular/config.h b/keyboards/doro67/regular/config.h index 4cfe2487d3..85a0c5038b 100644 --- a/keyboards/doro67/regular/config.h +++ b/keyboards/doro67/regular/config.h @@ -28,3 +28,6 @@ #define MATRIX_COL_PINS { B0, B1, B2, B3, D4, D6, D7, B4, B5, B6, C6, C7, F5, F6, F7 } #define DIODE_DIRECTION COL2ROW + +#define LED_CAPS_LOCK_PIN E6 +#define LED_PIN_ON_STATE 0 diff --git a/keyboards/doro67/regular/regular.c b/keyboards/doro67/regular/regular.c index 719ceea6fe..c9b0a25b59 100644 --- a/keyboards/doro67/regular/regular.c +++ b/keyboards/doro67/regular/regular.c @@ -14,34 +14,3 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "regular.h" - -void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - setPinOutput(E6); - matrix_init_user(); -} - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - - matrix_scan_user(); -} - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - // put your per-action keyboard code here - // runs for every action, just before processing by the firmware - - return process_record_user(keycode, record); -} - -void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here - if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { - writePinLow(E6); - } else { - writePinHigh(E6); - } - led_set_user(usb_led); -} diff --git a/keyboards/doro67/rgb/config.h b/keyboards/doro67/rgb/config.h index 90fefa1232..349b9f5cd8 100644 --- a/keyboards/doro67/rgb/config.h +++ b/keyboards/doro67/rgb/config.h @@ -48,6 +48,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* COL2ROW, ROW2COL*/ #define DIODE_DIRECTION COL2ROW +#define LED_CAPS_LOCK_PIN E6 +#define LED_PIN_ON_STATE 0 + // The pin connected to the data pin of the LEDs #define RGB_DI_PIN B7 // The number of LEDs connected diff --git a/keyboards/doro67/rgb/rgb.c b/keyboards/doro67/rgb/rgb.c index e8c9ac6321..794c037dd6 100644 --- a/keyboards/doro67/rgb/rgb.c +++ b/keyboards/doro67/rgb/rgb.c @@ -16,43 +16,6 @@ #include "rgb.h" #include "rgb_matrix_types.h" -// Optional override functions below. -// You can leave any or all of these undefined. -// These are only required if you want to perform custom actions. - - - -void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - setPinOutput(E6); - matrix_init_user(); -} - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - - matrix_scan_user(); -} - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - // put your per-action keyboard code here - // runs for every action, just before processing by the firmware - - return process_record_user(keycode, record); -} - -void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here - if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { - writePinLow(E6); - } else { - writePinHigh(E6); - } - led_set_user(usb_led); -} - led_config_t g_led_config = { { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 }, diff --git a/keyboards/espectro/config.h b/keyboards/espectro/config.h index 2736c1d880..b344c641e5 100755 --- a/keyboards/espectro/config.h +++ b/keyboards/espectro/config.h @@ -38,6 +38,11 @@ /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW +#define LED_NUM_LOCK_PIN B0 +#define LED_CAPS_LOCK_PIN B2 +#define LED_SCROLL_LOCK_PIN B1 +#define LED_PIN_ON_STATE 0 + /* number of backlight levels */ #define BACKLIGHT_PIN B6 #define BACKLIGHT_LEVELS 5 diff --git a/keyboards/espectro/espectro.c b/keyboards/espectro/espectro.c index 13030cdd41..64494c49c1 100755 --- a/keyboards/espectro/espectro.c +++ b/keyboards/espectro/espectro.c @@ -14,63 +14,4 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#include QMK_KEYBOARD_H -#include "quantum.h" - - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - - matrix_scan_user(); -} - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - // put your per-action keyboard code here - // runs for every action, just before processing by the firmware - - return process_record_user(keycode, record); -} - -void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here - - led_set_user(usb_led); -} - -__attribute__ ((weak)) -void led_set_user(uint8_t usb_led) { - - if (usb_led & (1 << USB_LED_NUM_LOCK)) { - DDRB |= (1 << 0); PORTB &= ~(1 << 0); - } else { - DDRB &= ~(1 << 0); PORTB &= ~(1 << 0); - } - - if (usb_led & (1 << USB_LED_CAPS_LOCK)) { - DDRB |= (1 << 2); PORTB &= ~(1 << 2); - } else { - DDRB &= ~(1 << 2); PORTB &= ~(1 << 2); - } - - if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { - DDRB |= (1 << 1); PORTB &= ~(1 << 1); - } else { - DDRB &= ~(1 << 1); PORTB &= ~(1 << 1); - } - - if (usb_led & (1 << USB_LED_COMPOSE)) { - - } else { - - } - - if (usb_led & (1 << USB_LED_KANA)) { - - } else { - - } - -} - +#include "espectro.h" diff --git a/keyboards/evil80/config.h b/keyboards/evil80/config.h index ae507c74f9..0f0e24529a 100644 --- a/keyboards/evil80/config.h +++ b/keyboards/evil80/config.h @@ -19,16 +19,17 @@ #define MATRIX_COL_PINS { B2, D0, D1, D2, D3, D5, D4, D6, D7, B4, B1, C6, C7, E6, F6, F7 } #define UNUSED_PINS -#define BACKLIGHT_PIN B5 -#define BACKLIGHT_BREATHING - /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW /* define if matrix has ghost */ //#define MATRIX_HAS_GHOST -/* number of backlight levels */ +#define LED_CAPS_LOCK_PIN B6 +#define LED_SCROLL_LOCK_PIN B7 + +#define BACKLIGHT_PIN B5 +#define BACKLIGHT_BREATHING #define BACKLIGHT_LEVELS 3 /* Set 0 if debouncing isn't needed */ diff --git a/keyboards/evil80/evil80.c b/keyboards/evil80/evil80.c index d4653d049b..471580fd80 100644 --- a/keyboards/evil80/evil80.c +++ b/keyboards/evil80/evil80.c @@ -1,47 +1 @@ #include "evil80.h" -void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - led_init_ports(); - matrix_init_user(); -} - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - - matrix_scan_user(); -} - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - // put your per-action keyboard code here - // runs for every action, just before processing by the firmware - - return process_record_user(keycode, record); -} - -void led_init_ports(void) { - DDRB |= (1<<6) | (1<<7); // OUT -} - -void led_set_kb(uint8_t usb_led) { - if (usb_led & (1<<USB_LED_CAPS_LOCK)) - { - PORTB |= (1<<6); // HI - } - else - { - PORTB &= ~(1<<6); // LO - } - - if (usb_led & (1<<USB_LED_SCROLL_LOCK)) - { - PORTB |= (1<<7); // HI - } - else - { - PORTB &= ~(1<<7); // LO - } - - led_set_user(usb_led); -} diff --git a/keyboards/fc660c/config.h b/keyboards/fc660c/config.h index bba402ca48..a3f90237fe 100644 --- a/keyboards/fc660c/config.h +++ b/keyboards/fc660c/config.h @@ -37,6 +37,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* define if matrix has ghost */ //#define MATRIX_HAS_GHOST +#define LED_CAPS_LOCK_PIN B6 +#define LED_PIN_ON_STATE 0 + /* number of backlight levels */ // #define BACKLIGHT_LEVELS 1 diff --git a/keyboards/fc660c/fc660c.c b/keyboards/fc660c/fc660c.c index da6ba9e744..592697cb88 100644 --- a/keyboards/fc660c/fc660c.c +++ b/keyboards/fc660c/fc660c.c @@ -21,36 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #endif void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - #ifdef ACTUATION_DEPTH_ADJUSTMENT adjust_actuation_point(ACTUATION_DEPTH_ADJUSTMENT); #endif matrix_init_user(); } - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - - matrix_scan_user(); -} - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - // put your per-action keyboard code here - // runs for every action, just before processing by the firmware - - return process_record_user(keycode, record); -} - -void led_set_kb(uint8_t usb_led) { - if (usb_led & (1<<USB_LED_CAPS_LOCK)) { - PORTB &= ~(1<<6); - } else { - PORTB |= (1<<6); - } - - led_set_user(usb_led); -} diff --git a/keyboards/gh60/revc/config.h b/keyboards/gh60/revc/config.h index 8c24b1e7e6..ccb95a9895 100644 --- a/keyboards/gh60/revc/config.h +++ b/keyboards/gh60/revc/config.h @@ -57,6 +57,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* define if matrix has ghost (lacks anti-ghosting diodes) */ //#define MATRIX_HAS_GHOST +#define LED_CAPS_LOCK_PIN B2 +#define LED_PIN_ON_STATE 0 + /* number of backlight levels */ #define BACKLIGHT_LEVELS 3 diff --git a/keyboards/gh60/revc/revc.c b/keyboards/gh60/revc/revc.c index e06739d2ba..47dd5410f0 100644 --- a/keyboards/gh60/revc/revc.c +++ b/keyboards/gh60/revc/revc.c @@ -1,27 +1 @@ #include "revc.h" - - -extern inline void gh60_caps_led_on(void); -extern inline void gh60_poker_leds_on(void); -extern inline void gh60_fn_led_on(void); -extern inline void gh60_esc_led_on(void); -extern inline void gh60_wasd_leds_on(void); - -extern inline void gh60_caps_led_off(void); -extern inline void gh60_poker_leds_off(void); -extern inline void gh60_fn_led_off(void); -extern inline void gh60_esc_led_off(void); -extern inline void gh60_wasd_leds_off(void); - - -void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here - - if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { - gh60_caps_led_on(); - } else { - gh60_caps_led_off(); - } - - led_set_user(usb_led); -} diff --git a/keyboards/gh60/revc/revc.h b/keyboards/gh60/revc/revc.h index 450c59020c..a94322ad72 100644 --- a/keyboards/gh60/revc/revc.h +++ b/keyboards/gh60/revc/revc.h @@ -12,17 +12,17 @@ * B2 Capslock LED * B0 not connected */ -inline void gh60_caps_led_on(void) { setPinOutput(B2); writePinLow(B2); } -inline void gh60_poker_leds_on(void) { setPinOutput(F4); writePinLow(F4); } -inline void gh60_fn_led_on(void) { setPinOutput(F5); writePinLow(F5); } -inline void gh60_esc_led_on(void) { setPinOutput(F6); writePinLow(F6); } -inline void gh60_wasd_leds_on(void) { setPinOutput(F7); writePinLow(F7); } +static inline void gh60_caps_led_on(void) { setPinOutput(B2); writePinLow(B2); } +static inline void gh60_poker_leds_on(void) { setPinOutput(F4); writePinLow(F4); } +static inline void gh60_fn_led_on(void) { setPinOutput(F5); writePinLow(F5); } +static inline void gh60_esc_led_on(void) { setPinOutput(F6); writePinLow(F6); } +static inline void gh60_wasd_leds_on(void) { setPinOutput(F7); writePinLow(F7); } -inline void gh60_caps_led_off(void) { setPinInput(B2); } -inline void gh60_poker_leds_off(void) { setPinInput(F4); } -inline void gh60_fn_led_off(void) { setPinInput(F5); } -inline void gh60_esc_led_off(void) { setPinInput(F6); } -inline void gh60_wasd_leds_off(void) { setPinInput(F7); } +static inline void gh60_caps_led_off(void) { setPinInput(B2); } +static inline void gh60_poker_leds_off(void) { setPinInput(F4); } +static inline void gh60_fn_led_off(void) { setPinInput(F5); } +static inline void gh60_esc_led_off(void) { setPinInput(F6); } +static inline void gh60_wasd_leds_off(void) { setPinInput(F7); } /* GH60 keymap definition macro * K2C, K31 and K3C are extra keys for ISO diff --git a/keyboards/gh60/satan/config.h b/keyboards/gh60/satan/config.h index 8c172314a8..ac343782e4 100644 --- a/keyboards/gh60/satan/config.h +++ b/keyboards/gh60/satan/config.h @@ -37,6 +37,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MATRIX_COL_PINS { F0, F1, E6, C7, C6, B7, D4, B1, B0, B5, B4, D7, D6, B3 } #define UNUSED_PINS +#define LED_NUM_LOCK_PIN B2 +#define LED_PIN_ON_STATE 0 + #define BACKLIGHT_PIN B6 /* COL2ROW or ROW2COL */ diff --git a/keyboards/gh60/satan/satan.c b/keyboards/gh60/satan/satan.c index 8542a57c43..cd65084455 100644 --- a/keyboards/gh60/satan/satan.c +++ b/keyboards/gh60/satan/satan.c @@ -1,24 +1 @@ #include "satan.h" - -void matrix_init_kb(void) { - matrix_init_user(); - led_init_ports(); -}; - -void matrix_scan_kb(void) { - matrix_scan_user(); -}; - -void led_init_ports(void) { - setPinOutput(B2); -} - -void led_set_kb(uint8_t usb_led) { - if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { - // Turn Caps Lock LED on - writePinLow(B2); - } else { - // Turn Caps Lock LED off - writePinHigh(B2); - } -} diff --git a/keyboards/kinesis/stapelberg/config.h b/keyboards/kinesis/stapelberg/config.h index 992480195f..5037baebd3 100644 --- a/keyboards/kinesis/stapelberg/config.h +++ b/keyboards/kinesis/stapelberg/config.h @@ -27,7 +27,12 @@ /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW - + +#define LED_NUM_LOCK_PIN F2 +#define LED_CAPS_LOCK_PIN F3 +#define LED_SCROLL_LOCK_PIN F1 +#define LED_COMPOSE_PIN F0 +#define LED_PIN_ON_STATE 0 /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCE 5 diff --git a/keyboards/kinesis/stapelberg/stapelberg.c b/keyboards/kinesis/stapelberg/stapelberg.c index af407ac4fc..a69679eef9 100644 --- a/keyboards/kinesis/stapelberg/stapelberg.c +++ b/keyboards/kinesis/stapelberg/stapelberg.c @@ -1,61 +1 @@ #include "stapelberg.h" - -void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - // * Set our LED pins as output - DDRF |= (1<<0); // Keypad LED - DDRF |= (1<<1); // ScrLock LED - DDRF |= (1<<2); // NumLock LED - DDRF |= (1<<3); // CapsLock LED - - matrix_init_user(); -} - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - - matrix_scan_user(); -} - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - // put your per-action keyboard code here - // runs for every action, just before processing by the firmware - - return process_record_user(keycode, record); -} - -void led_init_ports() { - // * Set our LED pins as output - DDRF |= (1<<0); // Keypad LED - DDRF |= (1<<1); // ScrLock LED - DDRF |= (1<<2); // NumLock LED - DDRF |= (1<<3); // CapsLock LED -} - -void led_set_kb(uint8_t usb_led) { - if (usb_led & (1<<USB_LED_COMPOSE)) { - PORTF &= ~(1<<0); - } else { - PORTF |= (1<<0); - } - - if (usb_led & (1<<USB_LED_SCROLL_LOCK)) { - PORTF &= ~(1<<1); - } else { - PORTF |= (1<<1); - } - - if (usb_led & (1<<USB_LED_NUM_LOCK)) { - PORTF &= ~(1<<2); - } else { - PORTF |= (1<<2); - } - - if (usb_led & (1<<USB_LED_CAPS_LOCK)) { - PORTF &= ~(1<<3); - } else { - PORTF |= (1<<3); - } -} diff --git a/keyboards/noxary/260/260.c b/keyboards/noxary/260/260.c index 9f577a2aee..a2f76a38a7 100644 --- a/keyboards/noxary/260/260.c +++ b/keyboards/noxary/260/260.c @@ -14,48 +14,3 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "260.h" - -// Optional override functions below. -// You can leave any or all of these undefined. -// These are only required if you want to perform custom actions. - - -void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - setPinOutput(B1); - matrix_init_user(); -} - -/* -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - - matrix_scan_user(); -} - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - // put your per-action keyboard code here - // runs for every action, just before processing by the firmware - - return process_record_user(keycode, record); -} - -void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here - - led_set_user(usb_led); -} - -*/ - -void led_set_kb(uint8_t usb_led) { - if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { - writePinLow(B1); - } else { - writePinHigh(B1); - } - - led_set_user(usb_led); -}
\ No newline at end of file diff --git a/keyboards/noxary/260/config.h b/keyboards/noxary/260/config.h index 379dbbf78d..9876d09f48 100644 --- a/keyboards/noxary/260/config.h +++ b/keyboards/noxary/260/config.h @@ -48,6 +48,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* COL2ROW, ROW2COL*/ #define DIODE_DIRECTION COL2ROW +#define LED_CAPS_LOCK_PIN B1 +#define LED_PIN_ON_STATE 0 + /* * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. */ diff --git a/keyboards/playkbtw/ca66/ca66.c b/keyboards/playkbtw/ca66/ca66.c index 43a648eca0..91f4826f99 100644 --- a/keyboards/playkbtw/ca66/ca66.c +++ b/keyboards/playkbtw/ca66/ca66.c @@ -1,12 +1 @@ #include "ca66.h" - -void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here - if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { - writePinHigh(D1); - } else { - writePinLow(D1); - } - - led_set_user(usb_led); -} diff --git a/keyboards/playkbtw/ca66/config.h b/keyboards/playkbtw/ca66/config.h index ff68cdac9e..4e2d040727 100644 --- a/keyboards/playkbtw/ca66/config.h +++ b/keyboards/playkbtw/ca66/config.h @@ -22,6 +22,8 @@ /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW +#define LED_CAPS_LOCK_PIN D1 + /* number of backlight levels */ #define BACKLIGHT_PIN F0 diff --git a/keyboards/playkbtw/pk60/config.h b/keyboards/playkbtw/pk60/config.h index 93e29951e9..f4709697c8 100644 --- a/keyboards/playkbtw/pk60/config.h +++ b/keyboards/playkbtw/pk60/config.h @@ -23,6 +23,9 @@ /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW +#define LED_CAPS_LOCK_PIN F4 +#define LED_PIN_ON_STATE 0 + /* number of backlight levels */ #define BACKLIGHT_PIN B7 #ifdef BACKLIGHT_PIN diff --git a/keyboards/playkbtw/pk60/pk60.c b/keyboards/playkbtw/pk60/pk60.c index a9da0ff229..909230def2 100644 --- a/keyboards/playkbtw/pk60/pk60.c +++ b/keyboards/playkbtw/pk60/pk60.c @@ -1,35 +1 @@ #include "pk60.h" -#include "led.h" - -void matrix_init_kb (void) { - - matrix_init_user(); - led_init_ports(); - -} - -void matrix_scan_kb(void) { - - matrix_scan_user(); - -}; - -void led_init_ports(void) { - // Set capslock LED pin as pinout - DDRF |= (1 << 4); - PORTF |= (1 << 4); - -} - -void led_set_kb(uint8_t usb_led) { - - if (usb_led & (1<<USB_LED_CAPS_LOCK)) { - // Turn capslock on - PORTF &= ~(1 << 4); - } else { - // Turn capslock off - PORTF |= (1 << 4); - } - led_set_user(usb_led); - -}
\ No newline at end of file diff --git a/keyboards/redscarf_iiplus/verc/config.h b/keyboards/redscarf_iiplus/verc/config.h index 3fecdcac3b..d920596ec9 100755 --- a/keyboards/redscarf_iiplus/verc/config.h +++ b/keyboards/redscarf_iiplus/verc/config.h @@ -49,10 +49,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* COL2ROW, ROW2COL*/ #define DIODE_DIRECTION COL2ROW -/* - * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. - */ -//#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6 +#define LED_NUM_LOCK_PIN E6 +#define LED_CAPS_LOCK_PIN C7 +#define LED_PIN_ON_STATE 0 #define BACKLIGHT_PIN B7 // #define BACKLIGHT_BREATHING diff --git a/keyboards/redscarf_iiplus/verc/verc.c b/keyboards/redscarf_iiplus/verc/verc.c index 9dfc260679..a235cdd533 100755 --- a/keyboards/redscarf_iiplus/verc/verc.c +++ b/keyboards/redscarf_iiplus/verc/verc.c @@ -14,38 +14,3 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "verc.h" - -// Optional override functions below. -// You can leave any or all of these undefined. -// These are only required if you want to perform custom actions. - -void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - - matrix_init_user(); - led_init_ports(); -} - -void led_init_ports(void) { - setPinOutput(C7); - setPinOutput(E6); -} - -void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here - - if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { - writePinLow(C7); - } else { - writePinHigh(C7); - } - - if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) { - writePinLow(E6); - } else { - writePinHigh(E6); - } - - led_set_user(usb_led); -} diff --git a/keyboards/sentraq/s65_plus/config.h b/keyboards/sentraq/s65_plus/config.h index 51aacfc196..f1f3512c6a 100644 --- a/keyboards/sentraq/s65_plus/config.h +++ b/keyboards/sentraq/s65_plus/config.h @@ -20,6 +20,9 @@ #define MATRIX_COL_PINS { F6, F5, F4, F1, F0, E6, B0, B1, D5, B2, B3, D0, D1, D2, D4, D6, D7, F7 } #define UNUSED_PINS +#define LED_CAPS_LOCK_PIN B7 +#define LED_PIN_ON_STATE 0 + /* number of backlight levels */ #define BACKLIGHT_PIN B7 #define BACKLIGHT_LEVELS 3 diff --git a/keyboards/sentraq/s65_plus/s65_plus.c b/keyboards/sentraq/s65_plus/s65_plus.c index 3eaaa37174..7b20ee0696 100644 --- a/keyboards/sentraq/s65_plus/s65_plus.c +++ b/keyboards/sentraq/s65_plus/s65_plus.c @@ -1,24 +1 @@ #include "s65_plus.h" -#include "led.h" - -void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - matrix_init_user(); -}; - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - matrix_scan_user(); -}; - -void led_set_kb(uint8_t usb_led) { - if (usb_led & (1<<USB_LED_CAPS_LOCK)) { - // Turn capslock on - PORTB &= ~(1<<7); - } else { - // Turn capslock off - PORTB |= (1<<7); - } -} diff --git a/keyboards/tada68/config.h b/keyboards/tada68/config.h index 41618e9d26..8c36a78bf6 100755 --- a/keyboards/tada68/config.h +++ b/keyboards/tada68/config.h @@ -51,6 +51,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* Locking resynchronize hack */ #define LOCKING_RESYNC_ENABLE +#define LED_CAPS_LOCK_PIN B2 +#define LED_PIN_ON_STATE 0 + /* Backlight configuration */ #define BACKLIGHT_PIN B6 #define BACKLIGHT_BREATHING diff --git a/keyboards/tada68/tada68.c b/keyboards/tada68/tada68.c index e4fab98101..34534de747 100755 --- a/keyboards/tada68/tada68.c +++ b/keyboards/tada68/tada68.c @@ -1,31 +1 @@ #include "tada68.h" -#include "led.h" - -void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - matrix_init_user(); - led_init_ports(); -}; - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - matrix_scan_user(); -}; - -void led_init_ports(void) { - // * Set our LED pins as output - DDRB |= (1<<2); -} - -void led_set_kb(uint8_t usb_led) { - if (usb_led & (1<<USB_LED_CAPS_LOCK)) { - // Turn capslock on - PORTB &= ~(1<<2); - } else { - // Turn capslock off - PORTB |= (1<<2); - } - led_set_user(usb_led); -} diff --git a/keyboards/toad/config.h b/keyboards/toad/config.h index 5f3eb43c2b..016bd54138 100644 --- a/keyboards/toad/config.h +++ b/keyboards/toad/config.h @@ -23,6 +23,10 @@ /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW +#define LED_CAPS_LOCK_PIN B6 +#define LED_SCROLL_LOCK_PIN B5 +#define LED_PIN_ON_STATE 0 + /* number of backlight levels */ #ifdef BACKLIGHT_PIN diff --git a/keyboards/toad/toad.c b/keyboards/toad/toad.c index bc4db0339e..a58779507f 100644 --- a/keyboards/toad/toad.c +++ b/keyboards/toad/toad.c @@ -1,18 +1 @@ #include "toad.h" - -void led_set_user(uint8_t usb_led) { - - //LED1 - if (usb_led & (1 << USB_LED_CAPS_LOCK)) { - DDRB |= (1 << 6); PORTB &= ~(1 << 6); - } else { - DDRB &= ~(1 << 6); PORTB &= ~(1 << 6); - } - - //LED2 - if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { - DDRB |= (1 << 5); PORTB &= ~(1 << 5); - } else { - DDRB &= ~(1 << 5); PORTB &= ~(1 << 5); - } -} diff --git a/keyboards/westfoxtrot/aanzee/aanzee.c b/keyboards/westfoxtrot/aanzee/aanzee.c index 17efdbe88d..bc90dcf2db 100644 --- a/keyboards/westfoxtrot/aanzee/aanzee.c +++ b/keyboards/westfoxtrot/aanzee/aanzee.c @@ -1,55 +1,17 @@ /* Copyright 2019 westfoxtrot - * - * 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 "aanzee.h" - -void keyboard_pre_init_kb(void) { - - // Call the keyboard pre init code. - // Set our LED pins as output - setPinOutput(B2); - - keyboard_pre_init_user(); -} - -void led_set_kb(uint8_t usb_led) { - - if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { - - // Turn capslock on - writePinLow(B2); - } else { - - // Turn capslock off - writePinHigh(B2); - } - - led_set_user(usb_led); -} diff --git a/keyboards/westfoxtrot/aanzee/config.h b/keyboards/westfoxtrot/aanzee/config.h index 69fc613879..73db816f65 100644 --- a/keyboards/westfoxtrot/aanzee/config.h +++ b/keyboards/westfoxtrot/aanzee/config.h @@ -40,6 +40,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW +#define LED_CAPS_LOCK_PIN B2 +#define LED_PIN_ON_STATE 0 + #define BACKLIGHT_PIN B7 #define BACKLIGHT_BREATHING #define BACKLIGHT_LEVELS 5 diff --git a/keyboards/xmmx/config.h b/keyboards/xmmx/config.h index bee047bf05..5f9c305d1a 100644 --- a/keyboards/xmmx/config.h +++ b/keyboards/xmmx/config.h @@ -23,6 +23,10 @@ /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW +#define LED_CAPS_LOCK_PIN B6 +#define LED_SCROLL_LOCK_PIN B5 +#define LED_PIN_ON_STATE 0 + /* number of backlight levels */ #ifdef BACKLIGHT_PIN diff --git a/keyboards/xmmx/xmmx.c b/keyboards/xmmx/xmmx.c index 4d410e90a0..399ae4eb44 100644 --- a/keyboards/xmmx/xmmx.c +++ b/keyboards/xmmx/xmmx.c @@ -1,18 +1 @@ #include "xmmx.h" - -void led_set_user(uint8_t usb_led) { - - //LED1 - if (usb_led & (1 << USB_LED_CAPS_LOCK)) { - DDRB |= (1 << 6); PORTB &= ~(1 << 6); - } else { - DDRB &= ~(1 << 6); PORTB &= ~(1 << 6); - } - - //LED2 - if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { - DDRB |= (1 << 5); PORTB &= ~(1 << 5); - } else { - DDRB &= ~(1 << 5); PORTB &= ~(1 << 5); - } -} |