Skip to content

Commit f00402a

Browse files
authored
Refactor to use led config - Part 3 (qmk#10966)
* Refactor to use led config * Refactor to use led config * Refactor to use led config * Refactor to use led config
1 parent e1e13c5 commit f00402a

File tree

30 files changed

+54
-546
lines changed

30 files changed

+54
-546
lines changed

keyboards/1upkeyboards/sweet16/v1/config.h

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
/* Set 0 if debouncing isn't needed */
1818
#define DEBOUNCE 5
1919

20+
#ifndef CONVERT_TO_PROTON_C
21+
# define LED_NUM_LOCK_PIN B0 // RXLED
22+
# define LED_CAPS_LOCK_PIN D5 // TXLED
23+
# define LED_PIN_ON_STATE 0
24+
#endif
25+
2026
/* Underglow options */
2127
#define RGB_DI_PIN B1
2228
#ifdef RGB_DI_PIN
-20
Original file line numberDiff line numberDiff line change
@@ -1,21 +1 @@
11
#include "v1.h"
2-
3-
void led_set_kb(uint8_t usb_led) {
4-
#ifndef CONVERT_TO_PROTON_C
5-
/* Map RXLED to USB_LED_NUM_LOCK */
6-
if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
7-
setPinOutput(B0);
8-
writePinLow(B0);
9-
} else {
10-
setPinInput(B0);
11-
}
12-
13-
/* Map TXLED to USB_LED_CAPS_LOCK */
14-
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
15-
setPinOutput(D5);
16-
writePinLow(D5);
17-
} else {
18-
setPinInput(D5);
19-
}
20-
#endif
21-
}

keyboards/alps64/alps64.c

-20
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,3 @@ You should have received a copy of the GNU General Public License
1515
along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717
#include "alps64.h"
18-
19-
void keyboard_pre_init_kb(void) {
20-
// put your keyboard start-up code here
21-
// runs once when the firmware starts up
22-
setPinOutput(C5);
23-
keyboard_pre_init_user();
24-
}
25-
26-
void led_set_kb(uint8_t usb_led)
27-
{
28-
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
29-
// output high
30-
writePinHigh(C5);
31-
} else {
32-
// Hi-Z
33-
writePinLow(C5);
34-
}
35-
36-
led_set_user(usb_led);
37-
}

keyboards/alps64/config.h

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
3737

3838
#define DIODE_DIRECTION COL2ROW
3939

40+
#define LED_CAPS_LOCK_PIN C5
41+
4042
/* define if matrix has ghost */
4143
//#define MATRIX_HAS_GHOST
4244

keyboards/amjpad/amjpad.c

-29
Original file line numberDiff line numberDiff line change
@@ -1,30 +1 @@
11
#include "amjpad.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-
DDRD |= (1<<6);
20-
}
21-
22-
void led_set_kb(uint8_t usb_led) {
23-
if (usb_led & (1<<USB_LED_NUM_LOCK)) {
24-
// Turn numlock on
25-
PORTD &= ~(1<<6);
26-
} else {
27-
// Turn numlock off
28-
PORTD |= (1<<6);
29-
}
30-
}

keyboards/amjpad/config.h

+3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
5454
/* Locking resynchronize hack */
5555
#define LOCKING_RESYNC_ENABLE
5656

57+
#define LED_NUM_LOCK_PIN D6
58+
#define LED_PIN_ON_STATE 0
59+
5760
/* Backlight configuration
5861
*/
5962
#define BACKLIGHT_LEVELS 4

keyboards/exclusive/e6v2/le/config.h

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
3737
#define MATRIX_COL_PINS { B5, D0, D1, D2, D3, D4, D5, D6, D7, C6, C7, F4, F5, F6, F7 }
3838
#define UNUSED_PINS
3939

40+
#define LED_CAPS_LOCK_PIN B7
41+
#define LED_PIN_ON_STATE 0
42+
4043
#define RGB_DI_PIN E6
4144
#ifdef RGB_DI_PIN
4245
#define RGBLIGHT_ANIMATIONS

keyboards/exclusive/e6v2/le/le.c

-32
Original file line numberDiff line numberDiff line change
@@ -1,33 +1 @@
11
#include "le.h"
2-
3-
void matrix_init_kb(void) {
4-
// put your keyboard start-up code here
5-
// runs once when the firmware starts up
6-
7-
matrix_init_user();
8-
}
9-
10-
void 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-
bool 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-
24-
void led_set_user(uint8_t usb_led) {
25-
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
26-
DDRB |= (1 << 7);
27-
PORTB &= ~(1 << 7);
28-
} else {
29-
DDRB &= ~(1 << 7);
30-
PORTB &= ~(1 << 7);
31-
}
32-
}
33-

keyboards/exclusive/e7v1/config.h

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
/* COL2ROW or ROW2COL */
2323
#define DIODE_DIRECTION COL2ROW
2424

25+
#define LED_CAPS_LOCK_PIN F0
26+
2527
/* number of backlight levels */
2628
#define BACKLIGHT_PIN B7
2729
#ifdef BACKLIGHT_PIN

keyboards/exclusive/e7v1/e7v1.c

-24
Original file line numberDiff line numberDiff line change
@@ -1,25 +1 @@
11
#include "e7v1.h"
2-
3-
void matrix_init_kb(void) {
4-
setPinOutput(F0);
5-
matrix_init_user();
6-
}
7-
8-
void matrix_scan_kb(void) {
9-
matrix_scan_user();
10-
}
11-
12-
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
13-
return process_record_user(keycode, record);
14-
}
15-
16-
void led_set_kb(uint8_t usb_led) {
17-
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
18-
writePinHigh(F0);
19-
} else {
20-
writePinLow(F0);
21-
}
22-
23-
led_set_user(usb_led);
24-
}
25-

keyboards/fc980c/config.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
4949

5050
/* Set 0 if debouncing isn't needed */
5151
#define DEBOUNCE 0
52-
#define TAPPING_TERM 175
52+
53+
#define LED_NUM_LOCK_PIN B4
54+
#define LED_CAPS_LOCK_PIN B5
55+
#define LED_SCROLL_LOCK_PIN B6
5356

5457
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
5558
// #define LOCKING_SUPPORT_ENABLE

keyboards/fc980c/fc980c.c

-37
Original file line numberDiff line numberDiff line change
@@ -22,46 +22,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2222
#endif
2323

2424
void matrix_init_kb(void) {
25-
// put your keyboard start-up code here
26-
// runs once when the firmware starts up
27-
2825
#ifdef ACTUATION_DEPTH_ADJUSTMENT
2926
adjust_actuation_point(ACTUATION_DEPTH_ADJUSTMENT);
3027
#endif
3128

3229
matrix_init_user();
3330
}
34-
35-
void matrix_scan_kb(void) {
36-
// put your looping keyboard code here
37-
// runs every cycle (a lot)
38-
39-
matrix_scan_user();
40-
}
41-
42-
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
43-
// put your per-action keyboard code here
44-
// runs for every action, just before processing by the firmware
45-
46-
return process_record_user(keycode, record);
47-
}
48-
49-
void led_set_kb(uint8_t usb_led) {
50-
if (usb_led & (1<<USB_LED_NUM_LOCK)) {
51-
PORTB |= (1<<4);
52-
} else {
53-
PORTB &= ~(1<<4);
54-
}
55-
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
56-
PORTB |= (1<<5);
57-
} else {
58-
PORTB &= ~(1<<5);
59-
}
60-
if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
61-
PORTB |= (1<<6);
62-
} else {
63-
PORTB &= ~(1<<6);
64-
}
65-
66-
led_set_user(usb_led);
67-
}

keyboards/foxlab/leaf60/hotswap/config.h

+3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
4848
/* COL2ROW, ROW2COL*/
4949
#define DIODE_DIRECTION COL2ROW
5050

51+
#define LED_CAPS_LOCK_PIN E6
52+
#define LED_PIN_ON_STATE 0
53+
5154
#define BACKLIGHT_PIN B7
5255
#define BACKLIGHT_BREATHING
5356
#define BACKLIGHT_LEVELS 4

keyboards/foxlab/leaf60/hotswap/hotswap.c

-43
Original file line numberDiff line numberDiff line change
@@ -14,46 +14,3 @@
1414
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1515
*/
1616
#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-
void matrix_init_kb(void) {
23-
// put your keyboard start-up code here
24-
// runs once when the firmware starts up
25-
setPinOutput(E6);
26-
matrix_init_user();
27-
}
28-
/*
29-
30-
void matrix_scan_kb(void) {
31-
// put your looping keyboard code here
32-
// runs every cycle (a lot)
33-
34-
matrix_scan_user();
35-
}
36-
37-
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
38-
// put your per-action keyboard code here
39-
// runs for every action, just before processing by the firmware
40-
41-
return process_record_user(keycode, record);
42-
}
43-
44-
void led_set_kb(uint8_t usb_led) {
45-
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
46-
47-
led_set_user(usb_led);
48-
}
49-
50-
*/
51-
52-
void led_set_kb(uint8_t usb_led) {
53-
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
54-
writePinLow(E6);
55-
} else {
56-
writePinHigh(E6);
57-
}
58-
led_set_user(usb_led);
59-
}

keyboards/foxlab/leaf60/universal/config.h

+3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
4848
/* COL2ROW, ROW2COL*/
4949
#define DIODE_DIRECTION COL2ROW
5050

51+
#define LED_CAPS_LOCK_PIN E6
52+
#define LED_PIN_ON_STATE 0
53+
5154
#define BACKLIGHT_PIN B7
5255
#define BACKLIGHT_BREATHING
5356
#define BACKLIGHT_LEVELS 3

keyboards/foxlab/leaf60/universal/universal.c

-45
Original file line numberDiff line numberDiff line change
@@ -14,48 +14,3 @@
1414
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1515
*/
1616
#include "universal.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-
void matrix_init_kb(void) {
23-
// put your keyboard start-up code here
24-
// runs once when the firmware starts up
25-
setPinOutput(E6);
26-
matrix_init_user();
27-
}
28-
29-
/*
30-
31-
void matrix_scan_kb(void) {
32-
// put your looping keyboard code here
33-
// runs every cycle (a lot)
34-
35-
matrix_scan_user();
36-
}
37-
38-
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
39-
// put your per-action keyboard code here
40-
// runs for every action, just before processing by the firmware
41-
42-
return process_record_user(keycode, record);
43-
}
44-
45-
void led_set_kb(uint8_t usb_led) {
46-
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
47-
48-
led_set_user(usb_led);
49-
}
50-
51-
*/
52-
53-
54-
void led_set_kb(uint8_t usb_led) {
55-
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
56-
writePinLow(E6);
57-
} else {
58-
writePinHigh(E6);
59-
}
60-
led_set_user(usb_led);
61-
}

keyboards/hineybush/hineyg80/config.h

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
/* COL2ROW or ROW2COL */
2323
#define DIODE_DIRECTION COL2ROW
2424

25+
26+
#define LED_NUM_LOCK_PIN C6
27+
#define LED_CAPS_LOCK_PIN B6
28+
#define LED_SCROLL_LOCK_PIN B5
29+
2530
/* number of backlight levels */
2631

2732
#ifdef BACKLIGHT_PIN

0 commit comments

Comments
 (0)