aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2020-11-17 17:06:23 +0000
committerGitHub <noreply@github.com>2020-11-17 17:06:23 +0000
commitadfd34c4512f6215a49a8f705ce408d6c82fb8cc (patch)
tree8906980e1e581609db99856c449395afece1709e
parent3c156e130b3e7a24166eb20bf862aaaac8ceff53 (diff)
downloadqmk_firmware-adfd34c4512f6215a49a8f705ce408d6c82fb8cc.tar.gz
qmk_firmware-adfd34c4512f6215a49a8f705ce408d6c82fb8cc.zip
Refactor to use led config - Part 2 (#10906)
* Refactor to use led config * Refactor to use led config * Refactor to use led config
-rw-r--r--keyboards/bpiphany/kitten_paw/config.h7
-rw-r--r--keyboards/bpiphany/kitten_paw/kitten_paw.c50
-rw-r--r--keyboards/bpiphany/kitten_paw/kitten_paw.h11
-rw-r--r--keyboards/bpiphany/tiger_lily/config.h5
-rw-r--r--keyboards/bpiphany/tiger_lily/tiger_lily.c62
-rw-r--r--keyboards/bpiphany/unloved_bastard/config.h5
-rw-r--r--keyboards/bpiphany/unloved_bastard/unloved_bastard.c54
-rw-r--r--keyboards/gray_studio/space65/config.h6
-rw-r--r--keyboards/gray_studio/space65/space65.c33
-rw-r--r--keyboards/gray_studio/think65/hotswap/config.h5
-rw-r--r--keyboards/gray_studio/think65/hotswap/hotswap.c55
-rw-r--r--keyboards/kbdfans/kbd19x/config.h5
-rw-r--r--keyboards/kbdfans/kbd19x/kbd19x.c54
-rw-r--r--keyboards/kbdfans/kbd19x/kbd19x.h12
-rw-r--r--keyboards/kbdfans/kbd67/rev1/config.h2
-rw-r--r--keyboards/kbdfans/kbd67/rev1/rev1.c35
-rw-r--r--keyboards/kbdfans/kbd6x/config.h3
-rw-r--r--keyboards/kbdfans/kbd6x/kbd6x.c33
-rw-r--r--keyboards/kbdfans/kbd75/config.h3
-rw-r--r--keyboards/kbdfans/kbd75/rev1/rev1.c16
-rw-r--r--keyboards/kbdfans/kbd75/rev2/rev2.c16
-rw-r--r--keyboards/kbdfans/kbd8x/config.h5
-rw-r--r--keyboards/kbdfans/kbd8x/kbd8x.c55
-rw-r--r--keyboards/kbdfans/kbd8x/kbd8x.h13
-rw-r--r--keyboards/kbdfans/kbd8x_mk2/config.h8
-rw-r--r--keyboards/kbdfans/kbd8x_mk2/kbd8x_mk2.c55
-rw-r--r--keyboards/kbdfans/kbdpad_mk2/config.h6
-rw-r--r--keyboards/kbdfans/kbdpad_mk2/kbdpad_mk2.c45
28 files changed, 59 insertions, 600 deletions
diff --git a/keyboards/bpiphany/kitten_paw/config.h b/keyboards/bpiphany/kitten_paw/config.h
index 89f104cfe..5e1429c8d 100644
--- a/keyboards/bpiphany/kitten_paw/config.h
+++ b/keyboards/bpiphany/kitten_paw/config.h
@@ -47,7 +47,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
47 47
48/* COL2ROW or ROW2COL */ 48/* COL2ROW or ROW2COL */
49#define DIODE_DIRECTION COL2ROW 49#define DIODE_DIRECTION COL2ROW
50 50
51#define LED_NUM_LOCK_PIN B7
52#define LED_CAPS_LOCK_PIN C6
53#define LED_SCROLL_LOCK_PIN C5
54#define LED_PIN_ON_STATE 0
55
51// #define BACKLIGHT_PIN B7 56// #define BACKLIGHT_PIN B7
52// #define BACKLIGHT_BREATHING 57// #define BACKLIGHT_BREATHING
53// #define BACKLIGHT_LEVELS 3 58// #define BACKLIGHT_LEVELS 3
diff --git a/keyboards/bpiphany/kitten_paw/kitten_paw.c b/keyboards/bpiphany/kitten_paw/kitten_paw.c
index 26cb533f2..e71b3c801 100644
--- a/keyboards/bpiphany/kitten_paw/kitten_paw.c
+++ b/keyboards/bpiphany/kitten_paw/kitten_paw.c
@@ -1,51 +1 @@
1#include "kitten_paw.h" #include "kitten_paw.h"
2
3void matrix_init_kb(void) {
4 // put your keyboard start-up code here
5 // runs once when the firmware starts up
6
7 matrix_init_user();
8}
9
10void matrix_scan_kb(void) {
11 // put your looping keyboard code here
12 // runs every cycle (a lot)
13
14 matrix_scan_user();
15}
16
17__attribute__ ((weak))
18void matrix_init_user(void) {
19}
20
21__attribute__ ((weak))
22void matrix_scan_user(void) {
23}
24
25bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
26 // put your per-action keyboard code here
27 // runs for every action, just before processing by the firmware
28
29 return process_record_user(keycode, record);
30}
31
32void led_set_kb(uint8_t usb_led) {
33 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
34 CONFIG_LED_IO;
35 CONFIG_LED_IO;
36 print_dec(usb_led);
37 if (usb_led & (1<<USB_LED_CAPS_LOCK))
38 USB_LED_CAPS_LOCK_ON;
39 else
40 USB_LED_CAPS_LOCK_OFF;
41
42 if (usb_led & (1<<USB_LED_NUM_LOCK))
43 USB_LED_NUM_LOCK_ON;
44 else
45 USB_LED_NUM_LOCK_OFF;
46 if (usb_led & (1<<USB_LED_SCROLL_LOCK))
47 USB_LED_SCROLL_LOCK_ON;
48 else
49 USB_LED_SCROLL_LOCK_OFF;
50 led_set_user(usb_led);
51}
diff --git a/keyboards/bpiphany/kitten_paw/kitten_paw.h b/keyboards/bpiphany/kitten_paw/kitten_paw.h
index 4de550f81..38b2a9433 100644
--- a/keyboards/bpiphany/kitten_paw/kitten_paw.h
+++ b/keyboards/bpiphany/kitten_paw/kitten_paw.h
@@ -3,17 +3,6 @@
3 3
4#include "quantum.h" 4#include "quantum.h"
5 5
6#define CONFIG_LED_IO \
7 DDRB |= (1<<7); \
8 DDRC |= (1<<5) | (1<<6);
9
10#define USB_LED_CAPS_LOCK_ON PORTC &= ~(1<<6)
11#define USB_LED_CAPS_LOCK_OFF PORTC |= (1<<6)
12#define USB_LED_NUM_LOCK_ON PORTB &= ~(1<<7)
13#define USB_LED_NUM_LOCK_OFF PORTB |= (1<<7)
14#define USB_LED_SCROLL_LOCK_ON PORTC &= ~(1<<5)
15#define USB_LED_SCROLL_LOCK_OFF PORTC |= (1<<5)
16
17// This a shortcut to help you visually see your layout. 6// This a shortcut to help you visually see your layout.
18// The first section contains all of the arguements 7// The first section contains all of the arguements
19// The second converts the arguments into a two-dimensional array 8// The second converts the arguments into a two-dimensional array
diff --git a/keyboards/bpiphany/tiger_lily/config.h b/keyboards/bpiphany/tiger_lily/config.h
index 1ab352ccb..d7eb42941 100644
--- a/keyboards/bpiphany/tiger_lily/config.h
+++ b/keyboards/bpiphany/tiger_lily/config.h
@@ -44,6 +44,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
44 */ 44 */
45#define UNUSED_PINS { B0, C4, D3 } 45#define UNUSED_PINS { B0, C4, D3 }
46 46
47#define LED_NUM_LOCK_PIN C5
48#define LED_CAPS_LOCK_PIN C6
49#define LED_SCROLL_LOCK_PIN B7
50#define LED_PIN_ON_STATE 0
51
47/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ 52/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
48#define DEBOUNCE 5 53#define DEBOUNCE 5
49 54
diff --git a/keyboards/bpiphany/tiger_lily/tiger_lily.c b/keyboards/bpiphany/tiger_lily/tiger_lily.c
index d2e7ba709..f57f8b5f5 100644
--- a/keyboards/bpiphany/tiger_lily/tiger_lily.c
+++ b/keyboards/bpiphany/tiger_lily/tiger_lily.c
@@ -1,63 +1 @@
1#include "tiger_lily.h" #include "tiger_lily.h"
2
3void matrix_init_kb(void) {
4 // put your keyboard start-up code here
5 // runs once when the firmware starts up
6
7 matrix_init_user();
8}
9
10void matrix_scan_kb(void) {
11 // put your looping keyboard code here
12 // runs every cycle (a lot)
13
14 matrix_scan_user();
15}
16
17bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
18 // put your per-action keyboard code here
19 // runs for every action, just before processing by the firmware
20
21 return process_record_user(keycode, record);
22}
23
24void led_set_kb(uint8_t usb_led) {
25 DDRB |= (1<<7);
26 DDRC |= (1<<5) | (1<<6);
27
28 print_dec(usb_led);
29
30 if (usb_led & (1<<USB_LED_NUM_LOCK))
31 PORTC &= ~(1<<5);
32 else
33 PORTC |= (1<<5);
34
35 if (usb_led & (1<<USB_LED_SCROLL_LOCK))
36 PORTB &= ~(1<<7);
37 else
38 PORTB |= (1<<7);
39
40 if (usb_led & (1<<USB_LED_CAPS_LOCK))
41 PORTC &= ~(1<<6);
42 else
43 PORTC |= (1<<6);
44
45 led_set_user(usb_led);
46}
47
48__attribute__ ((weak))
49void matrix_init_user(void) {
50}
51
52__attribute__ ((weak))
53void matrix_scan_user(void) {
54}
55
56__attribute__ ((weak))
57bool process_record_user(uint16_t keycode, keyrecord_t *record) {
58 return true;
59}
60
61__attribute__ ((weak))
62void led_set_user(uint8_t usb_led) {
63} \ No newline at end of file
diff --git a/keyboards/bpiphany/unloved_bastard/config.h b/keyboards/bpiphany/unloved_bastard/config.h
index 029cdb59e..e67ca658f 100644
--- a/keyboards/bpiphany/unloved_bastard/config.h
+++ b/keyboards/bpiphany/unloved_bastard/config.h
@@ -35,6 +35,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
35/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ 35/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
36#define DEBOUNCE 5 36#define DEBOUNCE 5
37 37
38#define LED_NUM_LOCK_PIN B7
39#define LED_CAPS_LOCK_PIN C5
40#define LED_SCROLL_LOCK_PIN C6
41#define LED_PIN_ON_STATE 0
42
38/* define if matrix has ghost (lacks anti-ghosting diodes) */ 43/* define if matrix has ghost (lacks anti-ghosting diodes) */
39//#define MATRIX_HAS_GHOST 44//#define MATRIX_HAS_GHOST
40 45
diff --git a/keyboards/bpiphany/unloved_bastard/unloved_bastard.c b/keyboards/bpiphany/unloved_bastard/unloved_bastard.c
index 197593060..f4b8032a0 100644
--- a/keyboards/bpiphany/unloved_bastard/unloved_bastard.c
+++ b/keyboards/bpiphany/unloved_bastard/unloved_bastard.c
@@ -14,57 +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 "unloved_bastard.h" 16#include "unloved_bastard.h"
17
18void matrix_init_kb(void) {
19 // put your keyboard start-up code here
20 // runs once when the firmware starts up
21 led_init_ports();
22 matrix_init_user();
23}
24
25void matrix_scan_kb(void) {
26 // put your looping keyboard code here
27 // runs every cycle (a lot)
28
29 matrix_scan_user();
30}
31
32bool 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 return process_record_user(keycode, record);
36}
37
38// C5 left
39// C6 middle led
40// B7 right led
41void led_init_ports(void) {
42 DDRB |= (1<<7);
43 DDRC |= (1<<5);
44 DDRC |= (1<<6);
45
46 PORTB |= (1<<7);
47 PORTC |= (1<<5);
48 PORTC |= (1<<6);
49}
50
51
52void led_set_kb(uint8_t usb_led) {
53
54 if (usb_led & (1<<USB_LED_CAPS_LOCK))
55 PORTC &= ~(1<<5);
56 else
57 PORTC |= (1<<5);
58
59 if (usb_led & (1<<USB_LED_NUM_LOCK))
60 PORTB &= ~(1<<7);
61 else
62 PORTB |= (1<<7);
63
64 if (usb_led & (1<<USB_LED_SCROLL_LOCK))
65 PORTC &= ~(1<<6);
66 else
67 PORTC |= (1<<6);
68
69 led_set_user(usb_led);
70}
diff --git a/keyboards/gray_studio/space65/config.h b/keyboards/gray_studio/space65/config.h
index 2e3928e69..5f0817ba1 100644
--- a/keyboards/gray_studio/space65/config.h
+++ b/keyboards/gray_studio/space65/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 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_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/gray_studio/space65/space65.c b/keyboards/gray_studio/space65/space65.c
index 74a86a202..d27a1f38c 100644
--- a/keyboards/gray_studio/space65/space65.c
+++ b/keyboards/gray_studio/space65/space65.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 "space65.h" 16#include "space65.h"
17
18void matrix_init_kb(void) {
19 // put your keyboard start-up code here
20 // runs once when the firmware starts up
21
22 setPinOutput(E6);
23 matrix_init_user();
24}
25
26void matrix_scan_kb(void) {
27 // put your looping keyboard code here
28 // runs every cycle (a lot)
29
30 matrix_scan_user();
31}
32
33bool 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
40void led_set_kb(uint8_t usb_led) {
41 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
42 if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
43 writePinLow(E6);
44 } else {
45 writePinHigh(E6);
46 }
47
48 led_set_user(usb_led);
49}
diff --git a/keyboards/gray_studio/think65/hotswap/config.h b/keyboards/gray_studio/think65/hotswap/config.h
index 05a818a73..5fe35201a 100644
--- a/keyboards/gray_studio/think65/hotswap/config.h
+++ b/keyboards/gray_studio/think65/hotswap/config.h
@@ -46,6 +46,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
46 46
47#define DIODE_DIRECTION COL2ROW 47#define DIODE_DIRECTION COL2ROW
48 48
49#define LED_NUM_LOCK_PIN C6
50#define LED_CAPS_LOCK_PIN C7
51#define LED_SCROLL_LOCK_PIN F7
52#define LED_PIN_ON_STATE 0
53
49#define RGB_DI_PIN E2 54#define RGB_DI_PIN E2
50#ifdef RGB_DI_PIN 55#ifdef RGB_DI_PIN
51 #define RGBLED_NUM 22 56 #define RGBLED_NUM 22
diff --git a/keyboards/gray_studio/think65/hotswap/hotswap.c b/keyboards/gray_studio/think65/hotswap/hotswap.c
index 07cdc8b1f..60808979c 100644
--- a/keyboards/gray_studio/think65/hotswap/hotswap.c
+++ b/keyboards/gray_studio/think65/hotswap/hotswap.c
@@ -14,58 +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 "hotswap.h" 16#include "hotswap.h"
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
23void matrix_init_kb(void) {
24 // put your keyboard start-up code here
25 // runs once when the firmware starts up
26
27 setPinOutput(C6);
28 setPinOutput(C7);
29 setPinOutput(F7);
30
31 matrix_init_user();
32}
33
34void matrix_scan_kb(void) {
35 // put your looping keyboard code here
36 // runs every cycle (a lot)
37
38 matrix_scan_user();
39}
40
41bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
42 // put your per-action keyboard code here
43 // runs for every action, just before processing by the firmware
44
45 return process_record_user(keycode, record);
46}
47
48void led_set_kb(uint8_t usb_led) {
49 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
50
51 if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
52 writePinLow(C7);
53 } else {
54 writePinHigh(C7);
55 }
56
57 if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
58 writePinLow(C6);
59 } else {
60 writePinHigh(C6);
61 }
62
63 if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
64 writePinLow(F7);
65 } else {
66 writePinHigh(F7);
67 }
68
69 led_set_user(usb_led);
70}
71
diff --git a/keyboards/kbdfans/kbd19x/config.h b/keyboards/kbdfans/kbd19x/config.h
index 1146afa62..c0cea36ff 100644
--- a/keyboards/kbdfans/kbd19x/config.h
+++ b/keyboards/kbdfans/kbd19x/config.h
@@ -47,6 +47,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
47 47
48/* COL2ROW, ROW2COL*/ 48/* COL2ROW, ROW2COL*/
49#define DIODE_DIRECTION COL2ROW 49#define DIODE_DIRECTION COL2ROW
50
51#define LED_NUM_LOCK_PIN B2
52#define LED_CAPS_LOCK_PIN B0
53#define LED_SCROLL_LOCK_PIN B1
54
50#define BACKLIGHT_PIN B6 55#define BACKLIGHT_PIN B6
51#ifdef BACKLIGHT_PIN 56#ifdef BACKLIGHT_PIN
52#define BACKLIGHT_LEVELS 3 57#define BACKLIGHT_LEVELS 3
diff --git a/keyboards/kbdfans/kbd19x/kbd19x.c b/keyboards/kbdfans/kbd19x/kbd19x.c
index e6cd77d65..bdaf1a507 100644
--- a/keyboards/kbdfans/kbd19x/kbd19x.c
+++ b/keyboards/kbdfans/kbd19x/kbd19x.c
@@ -16,57 +16,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#include "kbd19x.h" 18#include "kbd19x.h"
19
20extern inline void kbd19x_caps_led_on(void);
21extern inline void kbd19x_caps_led_off(void);
22
23extern inline void kbd19x_sclk_led_on(void);
24extern inline void kbd19x_sclk_led_off(void);
25
26extern inline void kbd19x_nmlk_led_on(void);
27extern inline void kbd19x_nmlk_led_off(void);
28
29void matrix_init_kb(void) {
30 // put your keyboard start-up code here
31 // runs once when the firmware starts up
32
33 matrix_init_user();
34}
35
36void matrix_scan_kb(void) {
37 // put your looping keyboard code here
38 // runs every cycle (a lot)
39
40 matrix_scan_user();
41}
42
43bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
44 // put your per-action keyboard code here
45 // runs for every action, just before processing by the firmware
46
47 return process_record_user(keycode, record);
48}
49
50void led_set_kb(uint8_t usb_led) {
51 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
52
53 if (usb_led & (1<<USB_LED_NUM_LOCK)) {
54 kbd19x_nmlk_led_on();
55 } else {
56 kbd19x_nmlk_led_off();
57 }
58
59 if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
60 kbd19x_caps_led_on();
61 } else {
62 kbd19x_caps_led_off();
63 }
64
65 if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
66 kbd19x_sclk_led_on();
67 } else {
68 kbd19x_sclk_led_off();
69 }
70
71 led_set_user(usb_led);
72}
diff --git a/keyboards/kbdfans/kbd19x/kbd19x.h b/keyboards/kbdfans/kbd19x/kbd19x.h
index 28ad83158..41c27230f 100644
--- a/keyboards/kbdfans/kbd19x/kbd19x.h
+++ b/keyboards/kbdfans/kbd19x/kbd19x.h
@@ -20,14 +20,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
20#include "quantum.h" 20#include "quantum.h"
21#include "led.h" 21#include "led.h"
22 22
23inline void kbd19x_caps_led_on(void) { DDRB |= (1<<0); PORTB &= ~(1<<0); } 23inline void kbd19x_caps_led_on(void) { writePinHigh(LED_CAPS_LOCK_PIN); }
24inline void kbd19x_caps_led_off(void) { DDRB &= ~(1<<0); PORTB &= ~(1<<0); } 24inline void kbd19x_caps_led_off(void) { writePinLow(LED_CAPS_LOCK_PIN); }
25 25
26inline void kbd19x_sclk_led_on(void) { DDRB |= (1<<1); PORTB &= ~(1<<1); } 26inline void kbd19x_sclk_led_on(void) { writePinHigh(LED_SCROLL_LOCK_PIN); }
27inline void kbd19x_sclk_led_off(void) { DDRB &= ~(1<<1); PORTB &= ~(1<<1); } 27inline void kbd19x_sclk_led_off(void) { writePinLow(LED_SCROLL_LOCK_PIN); }
28 28
29inline void kbd19x_nmlk_led_on(void) { DDRB |= (1<<2); PORTB &= ~(1<<2); } 29inline void kbd19x_nmlk_led_on(void) { writePinHigh(LED_NUM_LOCK_PIN); }
30inline void kbd19x_nmlk_led_off(void) { DDRB &= ~(1<<2); PORTB &= ~(1<<2); } 30inline void kbd19x_nmlk_led_off(void) { writePinLow(LED_NUM_LOCK_PIN); }
31 31
32// readability 32// readability
33#define XXX KC_NO 33#define XXX KC_NO
diff --git a/keyboards/kbdfans/kbd67/rev1/config.h b/keyboards/kbdfans/kbd67/rev1/config.h
index 86ef3b813..a713143a4 100644
--- a/keyboards/kbdfans/kbd67/rev1/config.h
+++ b/keyboards/kbdfans/kbd67/rev1/config.h
@@ -48,6 +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#define LED_CAPS_LOCK_PIN B2
52
51#define BACKLIGHT_PIN B6 53#define BACKLIGHT_PIN B6
52#ifdef BACKLIGHT_PIN 54#ifdef BACKLIGHT_PIN
53#define BACKLIGHT_BREATHING 55#define BACKLIGHT_BREATHING
diff --git a/keyboards/kbdfans/kbd67/rev1/rev1.c b/keyboards/kbdfans/kbd67/rev1/rev1.c
index 94cb9e553..489e85683 100644
--- a/keyboards/kbdfans/kbd67/rev1/rev1.c
+++ b/keyboards/kbdfans/kbd67/rev1/rev1.c
@@ -14,38 +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 "rev1.h" 16#include "rev1.h"
17
18void 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
25void matrix_scan_kb(void) {
26 // put your looping keyboard code here
27 // runs every cycle (a lot)
28
29 matrix_scan_user();
30}
31
32bool 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
39void led_set_kb(uint8_t usb_led) {
40 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
41
42 if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
43 DDRB |= (1 << 2);
44 PORTB &= ~(1 << 2);
45 } else {
46 DDRB &= ~(1 << 2);
47 PORTB &= ~(1 << 2);
48 }
49
50 led_set_user(usb_led);
51}
diff --git a/keyboards/kbdfans/kbd6x/config.h b/keyboards/kbdfans/kbd6x/config.h
index 32a625f71..03c4aaaea 100644
--- a/keyboards/kbdfans/kbd6x/config.h
+++ b/keyboards/kbdfans/kbd6x/config.h
@@ -47,6 +47,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
47 47
48/* COL2ROW, ROW2COL*/ 48/* COL2ROW, ROW2COL*/
49#define DIODE_DIRECTION COL2ROW 49#define DIODE_DIRECTION COL2ROW
50
51#define LED_CAPS_LOCK_PIN B6
52
50#define BACKLIGHT_PIN B7 53#define BACKLIGHT_PIN B7
51#ifdef BACKLIGHT_PIN 54#ifdef BACKLIGHT_PIN
52#define BACKLIGHT_BREATHING 55#define BACKLIGHT_BREATHING
diff --git a/keyboards/kbdfans/kbd6x/kbd6x.c b/keyboards/kbdfans/kbd6x/kbd6x.c
index f558af030..3797822d4 100644
--- a/keyboards/kbdfans/kbd6x/kbd6x.c
+++ b/keyboards/kbdfans/kbd6x/kbd6x.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 "kbd6x.h" 16#include "kbd6x.h"
17
18void 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
25void matrix_scan_kb(void) {
26 // put your looping keyboard code here
27 // runs every cycle (a lot)
28
29 matrix_scan_user();
30}
31
32bool 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
39void led_set_kb(uint8_t usb_led) {
40 if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
41 DDRB |= (1 << 6);
42 PORTB &= ~(1 << 6);
43 } else {
44 DDRB &= ~(1 << 6);
45 PORTB &= ~(1 << 6);
46 }
47
48 led_set_user(usb_led);
49} \ No newline at end of file
diff --git a/keyboards/kbdfans/kbd75/config.h b/keyboards/kbdfans/kbd75/config.h
index d46ca7535..1d30d7abf 100644
--- a/keyboards/kbdfans/kbd75/config.h
+++ b/keyboards/kbdfans/kbd75/config.h
@@ -20,6 +20,9 @@
20/* COL2ROW or ROW2COL */ 20/* COL2ROW or ROW2COL */
21#define DIODE_DIRECTION COL2ROW 21#define DIODE_DIRECTION COL2ROW
22 22
23#define LED_CAPS_LOCK_PIN B2
24#define LED_PIN_ON_STATE 0
25
23/* number of backlight levels */ 26/* number of backlight levels */
24#define BACKLIGHT_PIN B6 27#define BACKLIGHT_PIN B6
25#ifdef BACKLIGHT_PIN 28#ifdef BACKLIGHT_PIN
diff --git a/keyboards/kbdfans/kbd75/rev1/rev1.c b/keyboards/kbdfans/kbd75/rev1/rev1.c
index 151e395e3..520a869e5 100644
--- a/keyboards/kbdfans/kbd75/rev1/rev1.c
+++ b/keyboards/kbdfans/kbd75/rev1/rev1.c
@@ -1,17 +1 @@
1#include "rev1.h" #include "rev1.h"
2
3void led_set_kb(uint8_t usb_led) {
4 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
5 if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
6 writePinLow(B2);
7 } else {
8 writePinHigh(B2);
9 }
10
11 led_set_user(usb_led);
12}
13
14void matrix_init_kb(void) {
15 setPinOutput(B2);
16 matrix_init_user();
17}
diff --git a/keyboards/kbdfans/kbd75/rev2/rev2.c b/keyboards/kbdfans/kbd75/rev2/rev2.c
index bf91d4009..b1af81707 100644
--- a/keyboards/kbdfans/kbd75/rev2/rev2.c
+++ b/keyboards/kbdfans/kbd75/rev2/rev2.c
@@ -1,17 +1 @@
1#include "rev2.h" #include "rev2.h"
2
3void led_set_kb(uint8_t usb_led) {
4 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
5 if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
6 writePinLow(B2);
7 } else {
8 writePinHigh(B2);
9 }
10
11 led_set_user(usb_led);
12}
13
14void matrix_init_kb(void) {
15 setPinOutput(B2);
16 matrix_init_user();
17}
diff --git a/keyboards/kbdfans/kbd8x/config.h b/keyboards/kbdfans/kbd8x/config.h
index 5c1627494..71daac15f 100644
--- a/keyboards/kbdfans/kbd8x/config.h
+++ b/keyboards/kbdfans/kbd8x/config.h
@@ -47,6 +47,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
47 47
48/* COL2ROW, ROW2COL*/ 48/* COL2ROW, ROW2COL*/
49#define DIODE_DIRECTION COL2ROW 49#define DIODE_DIRECTION COL2ROW
50
51#define LED_NUM_LOCK_PIN B1
52#define LED_CAPS_LOCK_PIN B3
53#define LED_SCROLL_LOCK_PIN B2
54
50#define BACKLIGHT_PIN B6 55#define BACKLIGHT_PIN B6
51#ifdef BACKLIGHT_PIN 56#ifdef BACKLIGHT_PIN
52#define BACKLIGHT_BREATHING 57#define BACKLIGHT_BREATHING
diff --git a/keyboards/kbdfans/kbd8x/kbd8x.c b/keyboards/kbdfans/kbd8x/kbd8x.c
index 97c2e74e3..c19981dbc 100644
--- a/keyboards/kbdfans/kbd8x/kbd8x.c
+++ b/keyboards/kbdfans/kbd8x/kbd8x.c
@@ -15,58 +15,3 @@
15 */ 15 */
16 16
17#include "kbd8x.h" 17#include "kbd8x.h"
18
19extern inline void caps_led_off(void);
20extern inline void caps_led_on(void);
21extern inline void num_led_off(void);
22extern inline void num_led_on(void);
23extern inline void scroll_led_off(void);
24extern inline void scroll_led_on(void);
25
26void matrix_init_kb(void) {
27 // put your keyboard start-up code here
28 // runs once when the firmware starts up
29
30 matrix_init_user();
31}
32
33void matrix_scan_kb(void) {
34 // put your looping keyboard code here
35 // runs every cycle (a lot)
36
37 matrix_scan_user();
38}
39
40bool 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
44 return process_record_user(keycode, record);
45}
46
47void led_set_kb(uint8_t usb_led) {
48 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
49
50 if(usb_led & (1<<USB_LED_NUM_LOCK))
51 {
52 num_led_on();
53 } else {
54 num_led_off();
55 }
56
57 if(usb_led & (1<<USB_LED_CAPS_LOCK))
58 {
59 caps_led_on();
60 } else {
61 caps_led_off();
62 }
63
64 if(usb_led & (1<<USB_LED_SCROLL_LOCK))
65 {
66 scroll_led_on();
67 } else {
68 scroll_led_off();
69 }
70
71 led_set_user(usb_led);
72}
diff --git a/keyboards/kbdfans/kbd8x/kbd8x.h b/keyboards/kbdfans/kbd8x/kbd8x.h
index f28b8ca7a..4433722c5 100644
--- a/keyboards/kbdfans/kbd8x/kbd8x.h
+++ b/keyboards/kbdfans/kbd8x/kbd8x.h
@@ -19,15 +19,14 @@
19#include "led.h" 19#include "led.h"
20 20
21// Functions for setting LEDs on toggle keys 21// Functions for setting LEDs on toggle keys
22inline void caps_led_on(void) { DDRB |= (1<<3); PORTB &= ~(1<<3); } 22inline void caps_led_on(void) { writePinHigh(LED_CAPS_LOCK_PIN); }
23inline void caps_led_off(void) { DDRB &= ~(1<<3); PORTB &= ~(1<<3); } 23inline void caps_led_off(void) { writePinLow(LED_CAPS_LOCK_PIN); }
24 24
25inline void num_led_on(void) { DDRB |= (1<<1); PORTB &= ~(1<<1); } 25inline void num_led_on(void) { writePinHigh(LED_NUM_LOCK_PIN); }
26inline void num_led_off(void) { DDRB &= ~(1<<1); PORTB &= ~(1<<1); } 26inline void num_led_off(void) { writePinLow(LED_NUM_LOCK_PIN); }
27
28inline void scroll_led_on(void) { DDRB |= (1<<2); PORTB &= ~(1<<2); }
29inline void scroll_led_off(void) { DDRB &= ~(1<<2); PORTB &= ~(1<<2); }
30 27
28inline void scroll_led_on(void) { writePinHigh(LED_SCROLL_LOCK_PIN); }
29inline void scroll_led_off(void) { writePinLow(LED_SCROLL_LOCK_PIN); }
31 30
32// LAYOUT depicting all possible switch positions. 31// LAYOUT depicting all possible switch positions.
33// LAYOUT_all supports ISO, split backspace and split left/right shift. 32// LAYOUT_all supports ISO, split backspace and split left/right shift.
diff --git a/keyboards/kbdfans/kbd8x_mk2/config.h b/keyboards/kbdfans/kbd8x_mk2/config.h
index 3e07ad60c..373646a8e 100644
--- a/keyboards/kbdfans/kbd8x_mk2/config.h
+++ b/keyboards/kbdfans/kbd8x_mk2/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_CAPS_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_SCROLL_LOCK_PIN B2
53 */ 53#define LED_PIN_ON_STATE 0
54#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6 54
55#define BACKLIGHT_PIN B7 55#define BACKLIGHT_PIN B7
56#ifdef BACKLIGHT_PIN 56#ifdef BACKLIGHT_PIN
57#define BACKLIGHT_BREATHING 57#define BACKLIGHT_BREATHING
diff --git a/keyboards/kbdfans/kbd8x_mk2/kbd8x_mk2.c b/keyboards/kbdfans/kbd8x_mk2/kbd8x_mk2.c
index 147270723..0a36e3109 100644
--- a/keyboards/kbdfans/kbd8x_mk2/kbd8x_mk2.c
+++ b/keyboards/kbdfans/kbd8x_mk2/kbd8x_mk2.c
@@ -14,58 +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 "kbd8x_mk2.h" 16#include "kbd8x_mk2.h"
17
18void matrix_init_kb(void) {
19
20 // Indicator pins
21 // B2 - Scroll Lock
22 // E6 - Caps Lock
23 // Sinking setup - 5V -> LED/Resistor -> Pin
24
25 setPinOutput(B2);
26 setPinOutput(E6);
27
28 matrix_init_user();
29}
30
31void led_set_kb(uint8_t usb_led) {
32
33 // Toggle indicator LEDs
34 // Since they are a sinking setup, write HIGH to DISABLE, LOW to ENABLE
35
36 if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
37 writePinLow(E6);
38 } else {
39 writePinHigh(E6);
40 }
41
42 if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
43 writePinLow(B2);
44 } else {
45 writePinHigh(B2);
46 }
47
48 led_set_user(usb_led);
49}
50
51// Optional override functions below.
52// You can leave any or all of these undefined.
53// These are only required if you want to perform custom actions.
54
55/*
56
57void matrix_scan_kb(void) {
58 // put your looping keyboard code here
59 // runs every cycle (a lot)
60
61 matrix_scan_user();
62}
63
64bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
65 // put your per-action keyboard code here
66 // runs for every action, just before processing by the firmware
67
68 return process_record_user(keycode, record);
69}
70
71*/
diff --git a/keyboards/kbdfans/kbdpad_mk2/config.h b/keyboards/kbdfans/kbdpad_mk2/config.h
index a7dae0a70..991475c10 100644
--- a/keyboards/kbdfans/kbdpad_mk2/config.h
+++ b/keyboards/kbdfans/kbdpad_mk2/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 B4
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#ifdef BACKLIGHT_PIN 55#ifdef BACKLIGHT_PIN
diff --git a/keyboards/kbdfans/kbdpad_mk2/kbdpad_mk2.c b/keyboards/kbdfans/kbdpad_mk2/kbdpad_mk2.c
index 3ca8e0c73..1d6e1642b 100644
--- a/keyboards/kbdfans/kbdpad_mk2/kbdpad_mk2.c
+++ b/keyboards/kbdfans/kbdpad_mk2/kbdpad_mk2.c
@@ -14,48 +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 "kbdpad_mk2.h" 16#include "kbdpad_mk2.h"
17
18void matrix_init_kb(void) {
19
20 // Num Lock LED = B4
21 // Sinking setup (5V -> LED/Res -> Pin)
22
23 setPinOutput(B4);
24
25 matrix_init_user();
26}
27
28void led_set_kb(uint8_t usb_led) {
29
30 // Sinking setup. Write HIGH to turn OFF, LOW to turn ON.
31
32 if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
33 writePinLow(B4);
34 } else {
35 writePinHigh(B4);
36 }
37
38 led_set_user(usb_led);
39}
40
41// Optional override functions below.
42// You can leave any or all of these undefined.
43// These are only required if you want to perform custom actions.
44
45/*
46
47void matrix_scan_kb(void) {
48 // put your looping keyboard code here
49 // runs every cycle (a lot)
50
51 matrix_scan_user();
52}
53
54bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
55 // put your per-action keyboard code here
56 // runs for every action, just before processing by the firmware
57
58 return process_record_user(keycode, record);
59}
60
61*/