summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2024-05-02 19:48:49 +1000
committerGitHub <noreply@github.com>2024-05-02 10:48:49 +0100
commit61c7c1f74cc5365501a3038181df551df11f719e (patch)
tree67b134bfd3ba45660765f5c2c46b8d3f535b5b69
parent7220715dd1619dfb073db78cfc23998a67994655 (diff)
Convert some AVR GPIO operations to macros (#23424)
-rw-r--r--keyboards/40percentclub/ut47/led.c14
-rw-r--r--keyboards/40percentclub/ut47/matrix.c44
-rw-r--r--keyboards/amjkeyboard/amj96/matrix.c63
-rw-r--r--keyboards/bajjak/bajjak.c10
-rw-r--r--keyboards/bpiphany/sixshooter/sixshooter.h61
-rw-r--r--keyboards/ckeys/obelus/obelus.c4
-rw-r--r--keyboards/clueboard/66/rev2/rev2.c24
-rw-r--r--keyboards/clueboard/66/rev3/rev3.c24
-rw-r--r--keyboards/clueboard/66_hotswap/prototype/prototype.c24
-rw-r--r--keyboards/converter/hp_46010a/matrix.c31
-rw-r--r--keyboards/converter/sun_usb/matrix.c6
-rwxr-xr-xkeyboards/crawlpad/keymaps/default/keymap.c35
-rw-r--r--keyboards/do60/do60.h21
-rw-r--r--keyboards/ergodox_ez/ergodox_ez.c17
-rw-r--r--keyboards/ergodox_ez/ergodox_ez.h44
-rw-r--r--keyboards/gboards/ergotaco/ergotaco.c37
-rw-r--r--keyboards/gboards/georgi/georgi.c17
-rw-r--r--keyboards/gboards/gergo/gergo.c17
-rw-r--r--keyboards/gh80_3000/keymaps/ansi_wkl/keymap.c1
-rw-r--r--keyboards/gh80_3000/keymaps/default/keymap.c1
-rw-r--r--keyboards/gh80_3000/keymaps/iso_default/keymap.c1
-rw-r--r--keyboards/gh80_3000/keymaps/iso_std/keymap.c1
-rw-r--r--keyboards/gh80_3000/keymaps/iso_wkl/keymap.c1
-rw-r--r--keyboards/glenpickle/chimera_ergo/chimera_ergo.c10
-rw-r--r--keyboards/glenpickle/chimera_ergo/chimera_ergo.h40
-rw-r--r--keyboards/glenpickle/chimera_ls/chimera_ls.c10
-rw-r--r--keyboards/glenpickle/chimera_ls/chimera_ls.h40
-rw-r--r--keyboards/glenpickle/chimera_ortho/chimera_ortho.c10
-rw-r--r--keyboards/glenpickle/chimera_ortho/chimera_ortho.h40
-rw-r--r--keyboards/glenpickle/chimera_ortho_plus/chimera_ortho_plus.c12
-rw-r--r--keyboards/glenpickle/chimera_ortho_plus/chimera_ortho_plus.h16
-rw-r--r--keyboards/handwired/arrow_pad/keymaps/default/keymap.c14
-rw-r--r--keyboards/handwired/arrow_pad/keymaps/pad_21/keymap.c16
-rw-r--r--keyboards/handwired/arrow_pad/keymaps/pad_24/keymap.c14
-rw-r--r--keyboards/handwired/atreus50/atreus50.c4
-rw-r--r--keyboards/handwired/datahand/matrix.c16
-rw-r--r--keyboards/handwired/frenchdev/frenchdev.c11
-rw-r--r--keyboards/handwired/frenchdev/frenchdev.h42
-rw-r--r--keyboards/handwired/frenchdev/matrix.c54
-rw-r--r--keyboards/handwired/gamenum/gamenum.c8
-rw-r--r--keyboards/handwired/gamenum/keymaps/default/keymap.c8
-rw-r--r--keyboards/handwired/retro_refit/retro_refit.c4
-rw-r--r--keyboards/hotdox/hotdox.h45
-rw-r--r--keyboards/hotdox/matrix.c45
-rw-r--r--keyboards/keyboardio/model01/leds.c7
-rw-r--r--keyboards/keyboardio/model01/matrix.c4
-rw-r--r--keyboards/kira/kira75/kira75.h21
-rwxr-xr-xkeyboards/kmini/matrix.c112
-rw-r--r--keyboards/knops/mini/keymaps/default-gsm-newbs/keymap.c120
-rw-r--r--keyboards/knops/mini/keymaps/default/keymap.c120
-rw-r--r--keyboards/lazydesigners/the50/the50.c7
-rw-r--r--keyboards/mitosis/mitosis.c10
-rw-r--r--keyboards/mitosis/mitosis.h40
-rw-r--r--keyboards/noxary/268/keymaps/sixtyeight/keymap.c5
-rw-r--r--keyboards/org60/org60.h21
-rw-r--r--keyboards/planck/light/light.c4
-rw-r--r--keyboards/satt/comet46/keymaps/default-rgbled/keymap.c22
-rw-r--r--keyboards/sirius/uni660/rev1/rev1.c12
-rw-r--r--keyboards/sirius/uni660/rev1/rev1.h40
-rw-r--r--keyboards/sirius/uni660/rev2/rev2.c12
-rw-r--r--keyboards/sirius/uni660/rev2/rev2.h40
-rw-r--r--keyboards/sirius/unigo66/main.c20
-rw-r--r--keyboards/sixkeyboard/matrix.c13
-rw-r--r--keyboards/sixkeyboard/sixkeyboard.c29
-rw-r--r--keyboards/tmo50/tmo50.c40
-rw-r--r--keyboards/v60_type_r/config.h6
-rw-r--r--keyboards/v60_type_r/v60_type_r.c16
-rw-r--r--keyboards/viktus/omnikey_bh/keymaps/default/keymap.c23
-rw-r--r--keyboards/wilba_tech/wt_rgb_backlight.c9
-rw-r--r--keyboards/xiudi/xd60/xd60.h21
-rw-r--r--keyboards/ydkb/yd68/keymaps/default/keymap.c2
71 files changed, 885 insertions, 848 deletions
diff --git a/keyboards/40percentclub/ut47/led.c b/keyboards/40percentclub/ut47/led.c
index 867a6e2e2a..fa431de760 100644
--- a/keyboards/40percentclub/ut47/led.c
+++ b/keyboards/40percentclub/ut47/led.c
@@ -25,16 +25,14 @@ bool led_update_kb(led_t led_state)
25 if (res) { 25 if (res) {
26 if (led_state.caps_lock) { 26 if (led_state.caps_lock) {
27 // output low 27 // output low
28 DDRB |= (1<<0); 28 gpio_set_pin_output(B0);
29 PORTB &= ~(1<<0); 29 gpio_write_pin_low(B0);
30 DDRD |= (1<<5); 30 gpio_set_pin_output(D5);
31 PORTD &= ~(1<<5); 31 gpio_write_pin_low(D5);
32 } else { 32 } else {
33 // Hi-Z 33 // Hi-Z
34 DDRB &= ~(1<<0); 34 gpio_set_pin_input(B0);
35 PORTB &= ~(1<<0); 35 gpio_set_pin_input(D5);
36 DDRD &= ~(1<<5);
37 PORTD &= ~(1<<5);
38 } 36 }
39 } 37 }
40 return false; 38 return false;
diff --git a/keyboards/40percentclub/ut47/matrix.c b/keyboards/40percentclub/ut47/matrix.c
index 02ed88b709..d803f11c5e 100644
--- a/keyboards/40percentclub/ut47/matrix.c
+++ b/keyboards/40percentclub/ut47/matrix.c
@@ -126,14 +126,18 @@ void matrix_print(void)
126static void init_cols(void) 126static void init_cols(void)
127{ 127{
128 // Input with pull-up(DDR:0, PORT:1) 128 // Input with pull-up(DDR:0, PORT:1)
129 DDRF &= ~(1<<4 | 1<<5 | 1<<6 | 1<<7); 129 gpio_set_pin_input_high(F4);
130 PORTF |= (1<<4 | 1<<5 | 1<<6 | 1<<7); 130 gpio_set_pin_input_high(F5);
131 DDRE &= ~(1<<6); 131 gpio_set_pin_input_high(F6);
132 PORTE |= (1<<6); 132 gpio_set_pin_input_high(F7);
133 DDRD &= ~(1<<7); 133 gpio_set_pin_input_high(E6);
134 PORTD |= (1<<7); 134 gpio_set_pin_input_high(D7);
135 DDRB &= ~(1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6); 135 gpio_set_pin_input_high(B1);
136 PORTB |= (1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6); 136 gpio_set_pin_input_high(B2);
137 gpio_set_pin_input_high(B3);
138 gpio_set_pin_input_high(B4);
139 gpio_set_pin_input_high(B5);
140 gpio_set_pin_input_high(B6);
137} 141}
138 142
139static matrix_row_t read_cols(void) 143static matrix_row_t read_cols(void)
@@ -160,10 +164,10 @@ static matrix_row_t read_cols(void)
160static void unselect_rows(void) 164static void unselect_rows(void)
161{ 165{
162 // Hi-Z(DDR:0, PORT:0) to unselect 166 // Hi-Z(DDR:0, PORT:0) to unselect
163 DDRD &= ~0b00010011; 167 gpio_set_pin_input(C6);
164 PORTD &= ~0b00010011; 168 gpio_set_pin_input(D0);
165 DDRC &= ~0b01000000; 169 gpio_set_pin_input(D1);
166 PORTC &= ~0b01000000; 170 gpio_set_pin_input(D4);
167} 171}
168 172
169static void select_row(uint8_t row) 173static void select_row(uint8_t row)
@@ -171,20 +175,20 @@ static void select_row(uint8_t row)
171 // Output low(DDR:1, PORT:0) to select 175 // Output low(DDR:1, PORT:0) to select
172 switch (row) { 176 switch (row) {
173 case 0: 177 case 0:
174 DDRD |= (1<<1); 178 gpio_set_pin_output(D1);
175 PORTD &= ~(1<<1); 179 gpio_write_pin_low(D1);
176 break; 180 break;
177 case 1: 181 case 1:
178 DDRD |= (1<<0); 182 gpio_set_pin_output(D0);
179 PORTD &= ~(1<<0); 183 gpio_write_pin_low(D0);
180 break; 184 break;
181 case 2: 185 case 2:
182 DDRD |= (1<<4); 186 gpio_set_pin_output(D4);
183 PORTD &= ~(1<<4); 187 gpio_write_pin_low(D4);
184 break; 188 break;
185 case 3: 189 case 3:
186 DDRC |= (1<<6); 190 gpio_set_pin_output(C6);
187 PORTC &= ~(1<<6); 191 gpio_write_pin_low(C6);
188 break; 192 break;
189 } 193 }
190} 194}
diff --git a/keyboards/amjkeyboard/amj96/matrix.c b/keyboards/amjkeyboard/amj96/matrix.c
index 7faf40d4fe..448508971f 100644
--- a/keyboards/amjkeyboard/amj96/matrix.c
+++ b/keyboards/amjkeyboard/amj96/matrix.c
@@ -65,8 +65,8 @@ void matrix_init(void)
65#endif 65#endif
66 66
67 // 85 REST 67 // 85 REST
68 DDRD |= _BV(PD7); 68 gpio_set_pin_output(D7);
69 PORTD |= _BV(PD7); 69 gpio_write_pin_high(D7);
70 70
71 // initialize row and col 71 // initialize row and col
72 init_rows(); 72 init_rows();
@@ -143,36 +143,35 @@ static void init_cols(void)
143 DDRD &= 0b00011100; 143 DDRD &= 0b00011100;
144 PORTD |= 0b11100011; 144 PORTD |= 0b11100011;
145 145
146 DDRB &= ~(_BV(PB6) | _BV(PB7)| _BV(PB0)); 146 gpio_set_pin_input_high(B0);
147 PORTB |= (_BV(PB6) | _BV(PB7)| _BV(PB0)); 147 gpio_set_pin_input_high(B6);
148 gpio_set_pin_input_high(B7);
148 149
149 DDRE &= ~_BV(PE6); 150 gpio_set_pin_input_high(E6);
150 PORTE |= _BV(PE6);
151 151
152 DDRC &= ~_BV(PC7); 152 gpio_set_pin_input_high(C7);
153 PORTC |= _BV(PC7);
154 153
155} 154}
156 155
157static matrix_row_t read_cols(void) 156static matrix_row_t read_cols(void)
158{ 157{
159 158
160 return (PINF&_BV(PF7) ? 0 : (1<<0)) | 159 return (gpio_read_pin(F7) ? 0 : (1<<0)) |
161 (PINF&_BV(PF6) ? 0 : (1<<1)) | 160 (gpio_read_pin(F6) ? 0 : (1<<1)) |
162 (PINF&_BV(PF5) ? 0 : (1<<2)) | 161 (gpio_read_pin(F5) ? 0 : (1<<2)) |
163 (PINF&_BV(PF4) ? 0 : (1<<3)) | 162 (gpio_read_pin(F4) ? 0 : (1<<3)) |
164 (PINF&_BV(PF1) ? 0 : (1<<4)) | 163 (gpio_read_pin(F1) ? 0 : (1<<4)) |
165 (PINF&_BV(PF0) ? 0 : (1<<5)) | 164 (gpio_read_pin(F0) ? 0 : (1<<5)) |
166 (PINE&_BV(PE6) ? 0 : (1<<6)) | 165 (gpio_read_pin(E6) ? 0 : (1<<6)) |
167 (PIND&_BV(PD7) ? 0 : (1<<7)) | 166 (gpio_read_pin(D7) ? 0 : (1<<7)) |
168 (PIND&_BV(PD6) ? 0 : (1<<8)) | 167 (gpio_read_pin(D6) ? 0 : (1<<8)) |
169 (PIND&_BV(PD5) ? 0 : (1<<9)) | 168 (gpio_read_pin(D5) ? 0 : (1<<9)) |
170 (PIND&_BV(PD1) ? 0 : (1<<10)) | 169 (gpio_read_pin(D1) ? 0 : (1<<10)) |
171 (PIND&_BV(PD0) ? 0 : (1<<11)) | 170 (gpio_read_pin(D0) ? 0 : (1<<11)) |
172 (PINB&_BV(PB7) ? 0 : (1<<12)) | 171 (gpio_read_pin(B7) ? 0 : (1<<12)) |
173 (PINB&_BV(PB6) ? 0 : (1<<13)) | 172 (gpio_read_pin(B6) ? 0 : (1<<13)) |
174 (PINB&_BV(PB0) ? 0 : (1<<14)) | 173 (gpio_read_pin(B0) ? 0 : (1<<14)) |
175 (PINC&_BV(PC7) ? 0 : (1<<15)); 174 (gpio_read_pin(C7) ? 0 : (1<<15));
176} 175}
177 176
178/* Row pin configuration 177/* Row pin configuration
@@ -184,21 +183,23 @@ static matrix_row_t read_cols(void)
184 183
185static void init_rows(void) 184static void init_rows(void)
186{ 185{
187 DDRB |= (1<<PB1 | 1<<PB2 | 1<<PB3); 186 gpio_set_pin_input(B1);
187 gpio_set_pin_input(B2);
188 gpio_set_pin_input(B3);
188} 189}
189 190
190static void unselect_rows(void) 191static void unselect_rows(void)
191{ 192{
192 // Hi-Z(DDR:0, PORT:0) to unselect 193 // Hi-Z(DDR:0, PORT:0) to unselect
193 PORTB |= (1<<PB1); 194 gpio_write_pin_high(B1);
194 PORTB |= (1<<PB2); 195 gpio_write_pin_high(B2);
195 PORTB |= (1<<PB3); 196 gpio_write_pin_high(B3);
196} 197}
197 198
198static void select_row(uint8_t row) 199static void select_row(uint8_t row)
199{ 200{
200 // Output low(DDR:1, PORT:0) to select 201 // Output low(DDR:1, PORT:0) to select
201 (row & (1<<0)) ? (PORTB |= (1<<PB3)) : (PORTB &= ~(1<<PB3)); 202 gpio_write_pin(B3, row & (1<<0));
202 (row & (1<<1)) ? (PORTB |= (1<<PB2)) : (PORTB &= ~(1<<PB2)); 203 gpio_write_pin(B2, row & (1<<1));
203 (row & (1<<2)) ? (PORTB |= (1<<PB1)) : (PORTB &= ~(1<<PB1)); 204 gpio_write_pin(B1, row & (1<<2));
204} 205}
diff --git a/keyboards/bajjak/bajjak.c b/keyboards/bajjak/bajjak.c
index 6689a6ba2c..aadeb0415a 100644
--- a/keyboards/bajjak/bajjak.c
+++ b/keyboards/bajjak/bajjak.c
@@ -54,15 +54,13 @@ void matrix_init_kb(void) {
54 TCCR1B = 0b00001001; // set and configure fast PWM 54 TCCR1B = 0b00001001; // set and configure fast PWM
55 55
56 // (tied to Vcc for hardware convenience) 56 // (tied to Vcc for hardware convenience)
57 DDRB &= ~(1<<4); // set B(4) as input 57 gpio_set_pin_input(B4); // set B(4) as input, internal pull-up disabled
58 PORTB &= ~(1<<4); // set B(4) internal pull-up disabled
59 58
60 // unused pins - D4, D5, E6 59 // unused pins - D4, D5, E6
61 // set as input with internal pull-up enabled 60 // set as input with internal pull-up enabled
62 DDRD &= ~(1<<5 | 1<<4); 61 gpio_set_pin_input_high(D4);
63 DDRE &= ~(1<<6); 62 gpio_set_pin_input_high(D5);
64 PORTD |= (1<<5 | 1<<4); 63 gpio_set_pin_input_high(E6);
65 PORTE |= (1<<6);
66 64
67 keyboard_config.raw = eeconfig_read_kb(); 65 keyboard_config.raw = eeconfig_read_kb();
68 bajjak_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4 ); 66 bajjak_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4 );
diff --git a/keyboards/bpiphany/sixshooter/sixshooter.h b/keyboards/bpiphany/sixshooter/sixshooter.h
index 0d93c455ef..735088bdb7 100644
--- a/keyboards/bpiphany/sixshooter/sixshooter.h
+++ b/keyboards/bpiphany/sixshooter/sixshooter.h
@@ -2,19 +2,56 @@
2 2
3#include "quantum.h" 3#include "quantum.h"
4 4
5inline void sixshooter_led_0_on(void) { DDRB |= (1<<6); PORTB |= (1<<6); } 5#define SIXSHOOTER_LED_0_PIN B6
6inline void sixshooter_led_1_on(void) { DDRC |= (1<<7); PORTC |= (1<<7); } 6#define SIXSHOOTER_LED_1_PIN C7
7inline void sixshooter_led_2_on(void) { DDRD |= (1<<0); PORTD |= (1<<0); } 7#define SIXSHOOTER_LED_2_PIN D0
8inline void sixshooter_led_3_on(void) { DDRB |= (1<<5); PORTB |= (1<<5); } 8#define SIXSHOOTER_LED_3_PIN B5
9inline void sixshooter_led_4_on(void) { DDRD |= (1<<7); PORTD |= (1<<7); } 9#define SIXSHOOTER_LED_4_PIN D7
10inline void sixshooter_led_5_on(void) { DDRB |= (1<<7); PORTB |= (1<<7); } 10#define SIXSHOOTER_LED_5_PIN B7
11 11
12inline void sixshooter_led_0_off(void) { DDRB &= ~(1<<6); PORTB &= ~(1<<6); } 12inline void sixshooter_led_0_on(void) {
13inline void sixshooter_led_1_off(void) { DDRC &= ~(1<<7); PORTC &= ~(1<<7); } 13 gpio_set_pin_output(SIXSHOOTER_LED_0_PIN);
14inline void sixshooter_led_2_off(void) { DDRD &= ~(1<<0); PORTD &= ~(1<<0); } 14 gpio_write_pin_high(SIXSHOOTER_LED_0_PIN);
15inline void sixshooter_led_3_off(void) { DDRB &= ~(1<<5); PORTB &= ~(1<<5); } 15}
16inline void sixshooter_led_4_off(void) { DDRD &= ~(1<<7); PORTD &= ~(1<<7); } 16inline void sixshooter_led_1_on(void) {
17inline void sixshooter_led_5_off(void) { DDRB &= ~(1<<7); PORTB &= ~(1<<7); } 17 gpio_set_pin_output(SIXSHOOTER_LED_1_PIN);
18 gpio_write_pin_high(SIXSHOOTER_LED_1_PIN);
19}
20inline void sixshooter_led_2_on(void) {
21 gpio_set_pin_output(SIXSHOOTER_LED_2_PIN);
22 gpio_write_pin_high(SIXSHOOTER_LED_2_PIN);
23}
24inline void sixshooter_led_3_on(void) {
25 gpio_set_pin_output(SIXSHOOTER_LED_3_PIN);
26 gpio_write_pin_high(SIXSHOOTER_LED_3_PIN);
27}
28inline void sixshooter_led_4_on(void) {
29 gpio_set_pin_output(SIXSHOOTER_LED_4_PIN);
30 gpio_write_pin_high(SIXSHOOTER_LED_4_PIN);
31}
32inline void sixshooter_led_5_on(void) {
33 gpio_set_pin_output(SIXSHOOTER_LED_5_PIN);
34 gpio_write_pin_high(SIXSHOOTER_LED_5_PIN);
35}
36
37inline void sixshooter_led_0_off(void) {
38 gpio_set_pin_input(SIXSHOOTER_LED_0_PIN);
39}
40inline void sixshooter_led_1_off(void) {
41 gpio_set_pin_input(SIXSHOOTER_LED_1_PIN);
42}
43inline void sixshooter_led_2_off(void) {
44 gpio_set_pin_input(SIXSHOOTER_LED_2_PIN);
45}
46inline void sixshooter_led_3_off(void) {
47 gpio_set_pin_input(SIXSHOOTER_LED_3_PIN);
48}
49inline void sixshooter_led_4_off(void) {
50 gpio_set_pin_input(SIXSHOOTER_LED_4_PIN);
51}
52inline void sixshooter_led_5_off(void) {
53 gpio_set_pin_input(SIXSHOOTER_LED_5_PIN);
54}
18 55
19inline void sixshooter_led_all_on(void) { 56inline void sixshooter_led_all_on(void) {
20 sixshooter_led_0_on(); 57 sixshooter_led_0_on();
diff --git a/keyboards/ckeys/obelus/obelus.c b/keyboards/ckeys/obelus/obelus.c
index 123d93f0f4..59f9000cb4 100644
--- a/keyboards/ckeys/obelus/obelus.c
+++ b/keyboards/ckeys/obelus/obelus.c
@@ -4,8 +4,8 @@ void matrix_init_kb(void) {
4 // put your keyboard start-up code here 4 // put your keyboard start-up code here
5 // runs once when the firmware starts up 5 // runs once when the firmware starts up
6 // Turn status LED on 6 // Turn status LED on
7 DDRD |= (1<<6); 7 gpio_set_pin_output(D6);
8 PORTD |= (1<<6); 8 gpio_write_pin_high(D6);
9 9
10 matrix_init_user(); 10 matrix_init_user();
11} 11}
diff --git a/keyboards/clueboard/66/rev2/rev2.c b/keyboards/clueboard/66/rev2/rev2.c
index 7e3ed5c9dd..ea306a764b 100644
--- a/keyboards/clueboard/66/rev2/rev2.c
+++ b/keyboards/clueboard/66/rev2/rev2.c
@@ -4,26 +4,26 @@
4void backlight_init_ports(void) { 4void backlight_init_ports(void) {
5 print("init_backlight_pin()\n"); 5 print("init_backlight_pin()\n");
6 // Set our LED pins as output 6 // Set our LED pins as output
7 DDRD |= (1<<6); // Esc 7 gpio_set_pin_output(D6); // Esc
8 DDRB |= (1<<7); // Page Up 8 gpio_set_pin_output(B7); // Page Up
9 DDRD |= (1<<4); // Arrows 9 gpio_set_pin_output(D4); // Arrows
10 10
11 // Set our LED pins low 11 // Set our LED pins low
12 PORTD &= ~(1<<6); // Esc 12 gpio_write_pin_low(D6); // Esc
13 PORTB &= ~(1<<7); // Page Up 13 gpio_write_pin_low(B7); // Page Up
14 PORTD &= ~(1<<4); // Arrows 14 gpio_write_pin_low(D4); // Arrows
15} 15}
16 16
17void backlight_set(uint8_t level) { 17void backlight_set(uint8_t level) {
18 if ( level == 0 ) { 18 if ( level == 0 ) {
19 // Turn off light 19 // Turn off light
20 PORTD |= (1<<6); // Esc 20 gpio_write_pin_high(D6); // Esc
21 PORTB |= (1<<7); // Page Up 21 gpio_write_pin_high(B7); // Page Up
22 PORTD |= (1<<4); // Arrows 22 gpio_write_pin_high(D4); // Arrows
23 } else { 23 } else {
24 // Turn on light 24 // Turn on light
25 PORTD &= ~(1<<6); // Esc 25 gpio_write_pin_low(D6); // Esc
26 PORTB &= ~(1<<7); // Page Up 26 gpio_write_pin_low(B7); // Page Up
27 PORTD &= ~(1<<4); // Arrows 27 gpio_write_pin_low(D4); // Arrows
28 } 28 }
29} 29}
diff --git a/keyboards/clueboard/66/rev3/rev3.c b/keyboards/clueboard/66/rev3/rev3.c
index 7e3ed5c9dd..ea306a764b 100644
--- a/keyboards/clueboard/66/rev3/rev3.c
+++ b/keyboards/clueboard/66/rev3/rev3.c
@@ -4,26 +4,26 @@
4void backlight_init_ports(void) { 4void backlight_init_ports(void) {
5 print("init_backlight_pin()\n"); 5 print("init_backlight_pin()\n");
6 // Set our LED pins as output 6 // Set our LED pins as output
7 DDRD |= (1<<6); // Esc 7 gpio_set_pin_output(D6); // Esc
8 DDRB |= (1<<7); // Page Up 8 gpio_set_pin_output(B7); // Page Up
9 DDRD |= (1<<4); // Arrows 9 gpio_set_pin_output(D4); // Arrows
10 10
11 // Set our LED pins low 11 // Set our LED pins low
12 PORTD &= ~(1<<6); // Esc 12 gpio_write_pin_low(D6); // Esc
13 PORTB &= ~(1<<7); // Page Up 13 gpio_write_pin_low(B7); // Page Up
14 PORTD &= ~(1<<4); // Arrows 14 gpio_write_pin_low(D4); // Arrows
15} 15}
16 16
17void backlight_set(uint8_t level) { 17void backlight_set(uint8_t level) {
18 if ( level == 0 ) { 18 if ( level == 0 ) {
19 // Turn off light 19 // Turn off light
20 PORTD |= (1<<6); // Esc 20 gpio_write_pin_high(D6); // Esc
21 PORTB |= (1<<7); // Page Up 21 gpio_write_pin_high(B7); // Page Up
22 PORTD |= (1<<4); // Arrows 22 gpio_write_pin_high(D4); // Arrows
23 } else { 23 } else {
24 // Turn on light 24 // Turn on light
25 PORTD &= ~(1<<6); // Esc 25 gpio_write_pin_low(D6); // Esc
26 PORTB &= ~(1<<7); // Page Up 26 gpio_write_pin_low(B7); // Page Up
27 PORTD &= ~(1<<4); // Arrows 27 gpio_write_pin_low(D4); // Arrows
28 } 28 }
29} 29}
diff --git a/keyboards/clueboard/66_hotswap/prototype/prototype.c b/keyboards/clueboard/66_hotswap/prototype/prototype.c
index c89fbafbff..27aa332ca4 100644
--- a/keyboards/clueboard/66_hotswap/prototype/prototype.c
+++ b/keyboards/clueboard/66_hotswap/prototype/prototype.c
@@ -4,26 +4,26 @@
4void backlight_init_ports(void) { 4void backlight_init_ports(void) {
5 print("init_backlight_pin()\n"); 5 print("init_backlight_pin()\n");
6 // Set our LED pins as output 6 // Set our LED pins as output
7 DDRD |= (1<<0); // Esc 7 gpio_set_pin_output(D0); // Esc
8 DDRD |= (1<<4); // Page Up 8 gpio_set_pin_output(D4); // Page Up
9 DDRD |= (1<<1); // Arrows 9 gpio_set_pin_output(D1); // Arrows
10 10
11 // Set our LED pins low 11 // Set our LED pins low
12 PORTD &= ~(1<<0); // Esc 12 gpio_write_pin_low(D0); // Esc
13 PORTD &= ~(1<<4); // Page Up 13 gpio_write_pin_low(D4); // Page Up
14 PORTD &= ~(1<<1); // Arrows 14 gpio_write_pin_low(D1); // Arrows
15} 15}
16 16
17void backlight_set(uint8_t level) { 17void backlight_set(uint8_t level) {
18 if ( level == 0 ) { 18 if ( level == 0 ) {
19 // Turn off light 19 // Turn off light
20 PORTD |= (1<<0); // Esc 20 gpio_write_pin_high(D0); // Esc
21 PORTD |= (1<<4); // Page Up 21 gpio_write_pin_high(D4); // Page Up
22 PORTD |= (1<<1); // Arrows 22 gpio_write_pin_high(D1); // Arrows
23 } else { 23 } else {
24 // Turn on light 24 // Turn on light
25 PORTD &= ~(1<<0); // Esc 25 gpio_write_pin_low(D0); // Esc
26 PORTD &= ~(1<<4); // Page Up 26 gpio_write_pin_low(D4); // Page Up
27 PORTD &= ~(1<<1); // Arrows 27 gpio_write_pin_low(D1); // Arrows
28 } 28 }
29} 29}
diff --git a/keyboards/converter/hp_46010a/matrix.c b/keyboards/converter/hp_46010a/matrix.c
index 7f4e11ab27..a36e8821a3 100644
--- a/keyboards/converter/hp_46010a/matrix.c
+++ b/keyboards/converter/hp_46010a/matrix.c
@@ -82,17 +82,17 @@ void matrix_scan_user(void) {
82// switch, and then into the diode, then into one of the columns into the 82// switch, and then into the diode, then into one of the columns into the
83// matrix. the reset pin can be used to reset the entire counter. 83// matrix. the reset pin can be used to reset the entire counter.
84 84
85#define RESET _BV(PB0) 85#define HP_46010A_RESET_PIN B0
86#define SCLK _BV(PB1) 86#define HP_46010A_SCLK_PIN B1
87#define SDATA _BV(PB3) 87#define HP_46010A_SDATA_PIN B3
88#define LED _BV(PD6) 88#define HP_46010A_LED_PIN D6
89 89
90inline 90inline
91static 91static
92void SCLK_increment(void) { 92void SCLK_increment(void) {
93 PORTB &= ~SCLK ; 93 gpio_write_pin_low(HP_46010A_SCLK_PIN);
94 _delay_us( 4 ) ; // make sure the line is stable 94 _delay_us( 4 ) ; // make sure the line is stable
95 PORTB |= SCLK ; 95 gpio_write_pin_high(HP_46010A_SCLK_PIN);
96 _delay_us( 4 ) ; 96 _delay_us( 4 ) ;
97 97
98 return ; 98 return ;
@@ -101,9 +101,9 @@ void SCLK_increment(void) {
101inline 101inline
102static 102static
103void Matrix_Reset(void) { 103void Matrix_Reset(void) {
104 PORTB |= RESET ; 104 gpio_write_pin_high(HP_46010A_RESET_PIN);
105 _delay_us( 4 ) ; // make sure the line is stable 105 _delay_us( 4 ) ; // make sure the line is stable
106 PORTB &= ~RESET ; 106 gpio_write_pin_low(HP_46010A_RESET_PIN);
107 107
108 return ; 108 return ;
109} 109}
@@ -116,7 +116,7 @@ uint8_t Matrix_ReceiveByte (void) {
116 for ( uint8_t bit = 0; bit < MATRIX_COLS; ++bit ) { 116 for ( uint8_t bit = 0; bit < MATRIX_COLS; ++bit ) {
117 // toggle the clock 117 // toggle the clock
118 SCLK_increment(); 118 SCLK_increment();
119 temp = (PINB & SDATA) << 4 ; 119 temp = gpio_read_pin(HP_46010A_SDATA_PIN) << 4 ;
120 received |= temp >> bit ; 120 received |= temp >> bit ;
121 } 121 }
122 122
@@ -138,18 +138,19 @@ void Matrix_ThrowByte(void) {
138void matrix_init (void) { 138void matrix_init (void) {
139 // debug_matrix = 1; 139 // debug_matrix = 1;
140 // PB0 (SS) and PB1 (SCLK) set to outputs 140 // PB0 (SS) and PB1 (SCLK) set to outputs
141 DDRB |= RESET | SCLK ; 141 gpio_set_pin_output(HP_46010A_RESET_PIN);
142 gpio_set_pin_output(HP_46010A_SCLK_PIN);
142 // PB2, is unused, and PB3 is our serial input 143 // PB2, is unused, and PB3 is our serial input
143 DDRB &= ~SDATA ; 144 gpio_set_pin_input(HP_46010A_SDATA_PIN);
144 145
145 // SS is reset for this board, and is active High 146 // SS is reset for this board, and is active High
146 // SCLK is the serial clock and is active High 147 // SCLK is the serial clock and is active High
147 PORTB &= ~RESET ; 148 gpio_write_pin_low(HP_46010A_RESET_PIN);
148 PORTB |= SCLK ; 149 gpio_write_pin_high(HP_46010A_SCLK_PIN);
149 150
150 // led pin 151 // led pin
151 DDRD |= LED ; 152 gpio_set_pin_output(HP_46010A_LED_PIN);
152 PORTD &= ~LED ; 153 gpio_write_pin_low(HP_46010A_LED_PIN);
153 154
154 matrix_init_kb(); 155 matrix_init_kb();
155 156
diff --git a/keyboards/converter/sun_usb/matrix.c b/keyboards/converter/sun_usb/matrix.c
index 6d52d5cd6c..93354ee114 100644
--- a/keyboards/converter/sun_usb/matrix.c
+++ b/keyboards/converter/sun_usb/matrix.c
@@ -74,8 +74,8 @@ uint8_t matrix_cols(void)
74 74
75void matrix_init(void) 75void matrix_init(void)
76{ 76{
77 /* DDRD |= (1<<6); */ 77 /* gpio_set_pin_output(D6); */
78 /* PORTD |= (1<<6); */ 78 /* gpio_write_pin_high(D6); */
79 debug_enable = true; 79 debug_enable = true;
80 80
81 uart_init(1200); 81 uart_init(1200);
@@ -99,7 +99,7 @@ void matrix_init(void)
99 /* } */ 99 /* } */
100 /* print(" Done\n"); */ 100 /* print(" Done\n"); */
101 101
102 /* PORTD &= ~(1<<6); */ 102 /* gpio_write_pin_low(D6) */
103 103
104 matrix_init_kb(); 104 matrix_init_kb();
105 return; 105 return;
diff --git a/keyboards/crawlpad/keymaps/default/keymap.c b/keyboards/crawlpad/keymaps/default/keymap.c
index 547132bb7d..306ade6e5f 100755
--- a/keyboards/crawlpad/keymaps/default/keymap.c
+++ b/keyboards/crawlpad/keymaps/default/keymap.c
@@ -40,32 +40,16 @@ void set_led(int idx, bool enable) {
40bool process_record_user(uint16_t keycode, keyrecord_t *record) { 40bool process_record_user(uint16_t keycode, keyrecord_t *record) {
41 switch (keycode) { 41 switch (keycode) {
42 case BL1: 42 case BL1:
43 if (record->event.pressed) { 43 gpio_write_pin(B4, record->event.pressed);
44 PORTB |= (1 << 4);
45 } else {
46 PORTB &= ~(1 << 4);
47 }
48 return false; 44 return false;
49 case BL2: 45 case BL2:
50 if (record->event.pressed) { 46 gpio_write_pin(B5, record->event.pressed);
51 PORTB |= (1 << 5);
52 } else {
53 PORTB &= ~(1 << 5);
54 }
55 return false; 47 return false;
56 case BL3: 48 case BL3:
57 if (record->event.pressed) { 49 gpio_write_pin(B6, record->event.pressed);
58 PORTB |= (1 << 6);
59 } else {
60 PORTB &= ~(1 << 6);
61 }
62 return false; 50 return false;
63 case BL4: 51 case BL4:
64 if (record->event.pressed) { 52 gpio_write_pin(B7, record->event.pressed);
65 PORTB |= (1 << 7);
66 } else {
67 PORTB &= ~(1 << 7);
68 }
69 return false; 53 return false;
70 } 54 }
71 return true; 55 return true;
@@ -73,6 +57,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
73 57
74void matrix_init_user(void) { 58void matrix_init_user(void) {
75 /* set LED row pins to output and low */ 59 /* set LED row pins to output and low */
76 DDRB |= (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7); 60 gpio_set_pin_output(B4);
77 PORTB &= ~(1 << 4) & ~(1 << 5) & ~(1 << 6) & ~(1 << 7); 61 gpio_set_pin_output(B5);
62 gpio_set_pin_output(B6);
63 gpio_set_pin_output(B7);
64
65 gpio_write_pin_low(B4);
66 gpio_write_pin_low(B5);
67 gpio_write_pin_low(B6);
68 gpio_write_pin_low(B7);
78} 69}
diff --git a/keyboards/do60/do60.h b/keyboards/do60/do60.h
index de64b8f134..5aa9c17f2e 100644
--- a/keyboards/do60/do60.h
+++ b/keyboards/do60/do60.h
@@ -2,6 +2,9 @@
2 2
3#include "quantum.h" 3#include "quantum.h"
4 4
5#define DO60_CAPS_LOCK_LED_PIN B2
6#define DO60_BACKLIGHT_PIN F4
7
5/* DO60 LEDs 8/* DO60 LEDs
6 * GPIO pads 9 * GPIO pads
7 * 0 F7 not connected 10 * 0 F7 not connected
@@ -13,11 +16,21 @@
13 */ 16 */
14 17
15/* 18/*
16inline void do60_caps_led_on(void) { DDRB |= (1<<2); PORTB &= ~(1<<2); } 19inline void do60_caps_led_on(void) {
17inline void do60_bl_led_on(void) { DDRF |= (1<<4); PORTF &= ~(1<<4); } 20 gpio_set_pin_output(DO60_CAPS_LOCK_LED_PIN);
21 gpio_write_pin_low(DO60_CAPS_LOCK_LED_PIN);
22}
23inline void do60_bl_led_on(void) {
24 gpio_set_pin_output(DO60_BACKLIGHT_PIN);
25 gpio_write_pin_low(DO60_BACKLIGHT_PIN);
26}
18 27
19inline void do60_caps_led_off(void) { DDRB &= ~(1<<2); PORTB &= ~(1<<2); } 28inline void do60_caps_led_off(void) {
20inline void do60_bl_led_off(void) { DDRF &= ~(1<<4); PORTF &= ~(1<<4); } 29 gpio_set_pin_input(DO60_CAPS_LOCK_LED_PIN);
30}
31inline void do60_bl_led_off(void) {
32 gpio_set_pin_input(DO60_BACKLIGHT_PIN);
33}
21*/ 34*/
22 35
23inline void setdefaultrgb(void){ rgblight_sethsv(100,100,100); } 36inline void setdefaultrgb(void){ rgblight_sethsv(100,100,100); }
diff --git a/keyboards/ergodox_ez/ergodox_ez.c b/keyboards/ergodox_ez/ergodox_ez.c
index 5270738f86..5fc173917f 100644
--- a/keyboards/ergodox_ez/ergodox_ez.c
+++ b/keyboards/ergodox_ez/ergodox_ez.c
@@ -24,13 +24,11 @@ extern inline void ergodox_board_led_on(void);
24extern inline void ergodox_right_led_1_on(void); 24extern inline void ergodox_right_led_1_on(void);
25extern inline void ergodox_right_led_2_on(void); 25extern inline void ergodox_right_led_2_on(void);
26extern inline void ergodox_right_led_3_on(void); 26extern inline void ergodox_right_led_3_on(void);
27extern inline void ergodox_right_led_on(uint8_t led);
28 27
29extern inline void ergodox_board_led_off(void); 28extern inline void ergodox_board_led_off(void);
30extern inline void ergodox_right_led_1_off(void); 29extern inline void ergodox_right_led_1_off(void);
31extern inline void ergodox_right_led_2_off(void); 30extern inline void ergodox_right_led_2_off(void);
32extern inline void ergodox_right_led_3_off(void); 31extern inline void ergodox_right_led_3_off(void);
33extern inline void ergodox_right_led_off(uint8_t led);
34 32
35extern inline void ergodox_led_all_on(void); 33extern inline void ergodox_led_all_on(void);
36extern inline void ergodox_led_all_off(void); 34extern inline void ergodox_led_all_off(void);
@@ -53,17 +51,14 @@ void matrix_init_kb(void) {
53 TCCR1B = 0b00001001; // set and configure fast PWM 51 TCCR1B = 0b00001001; // set and configure fast PWM
54 52
55 // (tied to Vcc for hardware convenience) 53 // (tied to Vcc for hardware convenience)
56 DDRB &= ~(1 << 4); // set B(4) as input 54 gpio_set_pin_input(B4); // set B(4) as input, internal pull-up disabled
57 PORTB &= ~(1 << 4); // set B(4) internal pull-up disabled
58 55
59 // unused pins - C7, D4, D5, D7, E6 56 // unused pins - C7, D4, D5, E6
60 // set as input with internal pull-up enabled 57 // set as input with internal pull-up enabled
61 DDRC &= ~(1 << 7); 58 gpio_set_pin_input_high(C7);
62 DDRD &= ~(1 << 5 | 1 << 4); 59 gpio_set_pin_input_high(D4);
63 DDRE &= ~(1 << 6); 60 gpio_set_pin_input_high(D5);
64 PORTC |= (1 << 7); 61 gpio_set_pin_input_high(E6);
65 PORTD |= (1 << 5 | 1 << 4);
66 PORTE |= (1 << 6);
67 62
68 keyboard_config.raw = eeconfig_read_kb(); 63 keyboard_config.raw = eeconfig_read_kb();
69 ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4); 64 ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4);
diff --git a/keyboards/ergodox_ez/ergodox_ez.h b/keyboards/ergodox_ez/ergodox_ez.h
index df2dbed715..3938ff49f1 100644
--- a/keyboards/ergodox_ez/ergodox_ez.h
+++ b/keyboards/ergodox_ez/ergodox_ez.h
@@ -51,18 +51,40 @@ uint8_t ergodox_left_leds_update(void);
51#define LED_BRIGHTNESS_HI 255 51#define LED_BRIGHTNESS_HI 255
52#endif 52#endif
53 53
54#define ERGODOX_EZ_BOARD_LED_PIN D6
55#define ERGODOX_EZ_RIGHT_LED_1_PIN B5
56#define ERGODOX_EZ_RIGHT_LED_2_PIN B6
57#define ERGODOX_EZ_RIGHT_LED_3_PIN B7
58
59inline void ergodox_board_led_on(void) {
60 gpio_set_pin_output(ERGODOX_EZ_BOARD_LED_PIN);
61 gpio_write_pin_high(ERGODOX_EZ_BOARD_LED_PIN);
62}
63inline void ergodox_right_led_1_on(void) {
64 gpio_set_pin_output(ERGODOX_EZ_RIGHT_LED_1_PIN);
65 gpio_write_pin_high(ERGODOX_EZ_RIGHT_LED_1_PIN);
66}
67inline void ergodox_right_led_2_on(void) {
68 gpio_set_pin_output(ERGODOX_EZ_RIGHT_LED_2_PIN);
69 gpio_write_pin_high(ERGODOX_EZ_RIGHT_LED_2_PIN);
70}
71inline void ergodox_right_led_3_on(void) {
72 gpio_set_pin_output(ERGODOX_EZ_RIGHT_LED_3_PIN);
73 gpio_write_pin_high(ERGODOX_EZ_RIGHT_LED_3_PIN);
74}
54 75
55inline void ergodox_board_led_on(void) { DDRD |= (1<<6); PORTD |= (1<<6); } 76inline void ergodox_board_led_off(void) {
56inline void ergodox_right_led_1_on(void) { DDRB |= (1<<5); PORTB |= (1<<5); } 77 gpio_set_pin_input(ERGODOX_EZ_BOARD_LED_PIN);
57inline void ergodox_right_led_2_on(void) { DDRB |= (1<<6); PORTB |= (1<<6); } 78}
58inline void ergodox_right_led_3_on(void) { DDRB |= (1<<7); PORTB |= (1<<7); } 79inline void ergodox_right_led_1_off(void) {
59inline void ergodox_right_led_on(uint8_t led) { DDRB |= (1<<(led+4)); PORTB |= (1<<(led+4)); } 80 gpio_set_pin_input(ERGODOX_EZ_RIGHT_LED_1_PIN);
60 81}
61inline void ergodox_board_led_off(void) { DDRD &= ~(1<<6); PORTD &= ~(1<<6); } 82inline void ergodox_right_led_2_off(void) {
62inline void ergodox_right_led_1_off(void) { DDRB &= ~(1<<5); PORTB &= ~(1<<5); } 83 gpio_set_pin_input(ERGODOX_EZ_RIGHT_LED_2_PIN);
63inline void ergodox_right_led_2_off(void) { DDRB &= ~(1<<6); PORTB &= ~(1<<6); } 84}
64inline void ergodox_right_led_3_off(void) { DDRB &= ~(1<<7); PORTB &= ~(1<<7); } 85inline void ergodox_right_led_3_off(void) {
65inline void ergodox_right_led_off(uint8_t led) { DDRB &= ~(1<<(led+4)); PORTB &= ~(1<<(led+4)); } 86 gpio_set_pin_input(ERGODOX_EZ_RIGHT_LED_3_PIN);
87}
66 88
67#ifdef LEFT_LEDS 89#ifdef LEFT_LEDS
68bool ergodox_left_led_1; 90bool ergodox_left_led_1;
diff --git a/keyboards/gboards/ergotaco/ergotaco.c b/keyboards/gboards/ergotaco/ergotaco.c
index 6795dfde4f..1e526f15e2 100644
--- a/keyboards/gboards/ergotaco/ergotaco.c
+++ b/keyboards/gboards/ergotaco/ergotaco.c
@@ -5,25 +5,30 @@ i2c_status_t mcp23018_status = 0x20;
5 5
6void matrix_init_kb(void) { 6void matrix_init_kb(void) {
7 // (tied to Vcc for hardware convenience) 7 // (tied to Vcc for hardware convenience)
8 //DDRB &= ~(1<<4); // set B(4) as input 8 //gpio_set_pin_input(B4); // set B(4) as input, internal pull-up disabled
9 //PORTB &= ~(1<<4); // set B(4) internal pull-up disabled
10 9
11 // unused pins 10 // unused pins
12 // set as input with internal pull-up enabled 11 // set as input with internal pull-up enabled
13 DDRB &= ~(1<<4 | 1<<5 | 1<<6 | 1<<7); 12 gpio_set_pin_input_high(B4);
14 PORTB |= (1<<4 | 1<<5 | 1<<6 | 1<<7); 13 gpio_set_pin_input_high(B5);
15 14 gpio_set_pin_input_high(B6);
16 DDRC &= ~(1<<7 | 1<<6); 15 gpio_set_pin_input_high(B7);
17 PORTC |= (1<<7 | 1<<6); 16
18 17 gpio_set_pin_input_high(C6);
19 DDRD &= ~(1<<4 | 1<<5 | 1<<6 | 1<<7); 18 gpio_set_pin_input_high(C7);
20 PORTD |= (1<<4 | 1<<5 | 1<<6 | 1<<7); 19
21 20 gpio_set_pin_input_high(D4);
22 DDRE &= ~(1<<6); 21 gpio_set_pin_input_high(D5);
23 PORTE |= (1<<6); 22 gpio_set_pin_input_high(D6);
24 23 gpio_set_pin_input_high(D7);
25 DDRF &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6 | 1<<7); 24
26 PORTF |= (1<<0 | 1<<1 | 1<<4 | 1<<6 | 1<<7); 25 gpio_set_pin_input_high(E6);
26
27 gpio_set_pin_input_high(D0);
28 gpio_set_pin_input_high(D1);
29 gpio_set_pin_input_high(D4);
30 gpio_set_pin_input_high(D6);
31 gpio_set_pin_input_high(D7);
27 32
28 matrix_init_user(); 33 matrix_init_user();
29} 34}
diff --git a/keyboards/gboards/georgi/georgi.c b/keyboards/gboards/georgi/georgi.c
index 44b7067b47..da88e6ed8b 100644
--- a/keyboards/gboards/georgi/georgi.c
+++ b/keyboards/gboards/georgi/georgi.c
@@ -7,17 +7,16 @@ void matrix_init_kb(void) {
7 steno_set_mode(STENO_MODE_GEMINI); // or STENO_MODE_BOLT 7 steno_set_mode(STENO_MODE_GEMINI); // or STENO_MODE_BOLT
8 8
9 // (tied to Vcc for hardware convenience) 9 // (tied to Vcc for hardware convenience)
10 //DDRB &= ~(1<<4); // set B(4) as input 10 //gpio_set_pin_input(B4); // set B(4) as input, internal pull-up disabled
11 //PORTB &= ~(1<<4); // set B(4) internal pull-up disabled
12 11
13 // unused pins - C7, D4, D5, D7, E6 12 // unused pins - C7, D4, D5, D6, D7, E6
14 // set as input with internal pull-up enabled 13 // set as input with internal pull-up enabled
15 DDRC &= ~(1<<7); 14 gpio_set_pin_input_high(C7);
16 DDRD &= ~(1<<5 | 1<<4 | 1<<6 | 1<<7); 15 gpio_set_pin_input_high(D4);
17 DDRE &= ~(1<<6); 16 gpio_set_pin_input_high(D5);
18 PORTC |= (1<<7); 17 gpio_set_pin_input_high(D6);
19 PORTD |= (1<<5 | 1<<4 | 1<<6 | 1<<7); 18 gpio_set_pin_input_high(D7);
20 PORTE |= (1<<6); 19 gpio_set_pin_input_high(E6);
21 20
22 matrix_init_user(); 21 matrix_init_user();
23} 22}
diff --git a/keyboards/gboards/gergo/gergo.c b/keyboards/gboards/gergo/gergo.c
index fa73c4b42f..1ec6105eeb 100644
--- a/keyboards/gboards/gergo/gergo.c
+++ b/keyboards/gboards/gergo/gergo.c
@@ -5,17 +5,16 @@ i2c_status_t mcp23018_status = 0x20;
5 5
6void matrix_init_kb(void) { 6void matrix_init_kb(void) {
7 // (tied to Vcc for hardware convenience) 7 // (tied to Vcc for hardware convenience)
8 //DDRB &= ~(1<<4); // set B(4) as input 8 //gpio_set_pin_input(B4); // set B(4) as input, internal pull-up disabled
9 //PORTB &= ~(1<<4); // set B(4) internal pull-up disabled
10 9
11 // unused pins - C7, D4, D5, D7, E6 10 // unused pins - C7, D4, D5, D6, D7, E6
12 // set as input with internal pull-up enabled 11 // set as input with internal pull-up enabled
13 DDRC &= ~(1<<7); 12 gpio_set_pin_input_high(C7);
14 DDRD &= ~(1<<5 | 1<<4 | 1<<6 | 1<<7); 13 gpio_set_pin_input_high(D4);
15 DDRE &= ~(1<<6); 14 gpio_set_pin_input_high(D5);
16 PORTC |= (1<<7); 15 gpio_set_pin_input_high(D6);
17 PORTD |= (1<<5 | 1<<4 | 1<<6 | 1<<7); 16 gpio_set_pin_input_high(D7);
18 PORTE |= (1<<6); 17 gpio_set_pin_input_high(E6);
19 18
20 matrix_init_user(); 19 matrix_init_user();
21} 20}
diff --git a/keyboards/gh80_3000/keymaps/ansi_wkl/keymap.c b/keyboards/gh80_3000/keymaps/ansi_wkl/keymap.c
index a949b11941..54fdb3400d 100644
--- a/keyboards/gh80_3000/keymaps/ansi_wkl/keymap.c
+++ b/keyboards/gh80_3000/keymaps/ansi_wkl/keymap.c
@@ -11,4 +11,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
11 KC_LCTL, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT 11 KC_LCTL, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT
12 ) 12 )
13}; 13};
14
diff --git a/keyboards/gh80_3000/keymaps/default/keymap.c b/keyboards/gh80_3000/keymaps/default/keymap.c
index 08f43c1d68..4a54df83cc 100644
--- a/keyboards/gh80_3000/keymaps/default/keymap.c
+++ b/keyboards/gh80_3000/keymaps/default/keymap.c
@@ -11,4 +11,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
11 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PCMM, KC_PDOT, KC_PENT 11 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PCMM, KC_PDOT, KC_PENT
12 ) 12 )
13}; 13};
14
diff --git a/keyboards/gh80_3000/keymaps/iso_default/keymap.c b/keyboards/gh80_3000/keymaps/iso_default/keymap.c
index ff2b373a54..b3433eb21a 100644
--- a/keyboards/gh80_3000/keymaps/iso_default/keymap.c
+++ b/keyboards/gh80_3000/keymaps/iso_default/keymap.c
@@ -11,4 +11,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
11 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PCMM, KC_PDOT, KC_PENT 11 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PCMM, KC_PDOT, KC_PENT
12 ) 12 )
13}; 13};
14
diff --git a/keyboards/gh80_3000/keymaps/iso_std/keymap.c b/keyboards/gh80_3000/keymaps/iso_std/keymap.c
index 7783aae0a9..26fbb855e8 100644
--- a/keyboards/gh80_3000/keymaps/iso_std/keymap.c
+++ b/keyboards/gh80_3000/keymaps/iso_std/keymap.c
@@ -11,4 +11,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
11 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT 11 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT
12 ) 12 )
13}; 13};
14
diff --git a/keyboards/gh80_3000/keymaps/iso_wkl/keymap.c b/keyboards/gh80_3000/keymaps/iso_wkl/keymap.c
index 9108f6aba4..4d20f5a402 100644
--- a/keyboards/gh80_3000/keymaps/iso_wkl/keymap.c
+++ b/keyboards/gh80_3000/keymaps/iso_wkl/keymap.c
@@ -11,4 +11,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
11 KC_LCTL, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT 11 KC_LCTL, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT
12 ) 12 )
13}; 13};
14
diff --git a/keyboards/glenpickle/chimera_ergo/chimera_ergo.c b/keyboards/glenpickle/chimera_ergo/chimera_ergo.c
index 47653c2e4b..40748e0b3d 100644
--- a/keyboards/glenpickle/chimera_ergo/chimera_ergo.c
+++ b/keyboards/glenpickle/chimera_ergo/chimera_ergo.c
@@ -1,10 +1,12 @@
1#include "chimera_ergo.h" 1#include "chimera_ergo.h"
2 2
3void led_init(void) { 3void led_init(void) {
4 DDRD |= (1<<1); 4 gpio_set_pin_output(CHIMERA_ERGO_GREEN_LED_PIN);
5 PORTD |= (1<<1); 5 gpio_write_pin_high(CHIMERA_ERGO_GREEN_LED_PIN);
6 DDRF |= (1<<4) | (1<<5); 6 gpio_set_pin_output(CHIMERA_ERGO_BLUE_LED_PIN);
7 PORTF |= (1<<4) | (1<<5); 7 gpio_write_pin_high(CHIMERA_ERGO_BLUE_LED_PIN);
8 gpio_set_pin_output(CHIMERA_ERGO_RED_LED_PIN);
9 gpio_write_pin_high(CHIMERA_ERGO_RED_LED_PIN);
8} 10}
9 11
10 12
diff --git a/keyboards/glenpickle/chimera_ergo/chimera_ergo.h b/keyboards/glenpickle/chimera_ergo/chimera_ergo.h
index 04ef56503f..46f0b931e8 100644
--- a/keyboards/glenpickle/chimera_ergo/chimera_ergo.h
+++ b/keyboards/glenpickle/chimera_ergo/chimera_ergo.h
@@ -2,12 +2,16 @@
2 2
3#include "quantum.h" 3#include "quantum.h"
4 4
5#define red_led_off PORTF |= (1<<5) 5#define CHIMERA_ERGO_RED_LED_PIN F5
6#define red_led_on PORTF &= ~(1<<5) 6#define CHIMERA_ERGO_GREEN_LED_PIN D1
7#define blu_led_off PORTF |= (1<<4) 7#define CHIMERA_ERGO_BLUE_LED_PIN F4
8#define blu_led_on PORTF &= ~(1<<4) 8
9#define grn_led_off PORTD |= (1<<1) 9#define red_led_off gpio_write_pin_high(CHIMERA_ERGO_RED_LED_PIN)
10#define grn_led_on PORTD &= ~(1<<1) 10#define red_led_on gpio_write_pin_low(CHIMERA_ERGO_RED_LED_PIN)
11#define blu_led_off gpio_write_pin_high(CHIMERA_ERGO_BLUE_LED_PIN)
12#define blu_led_on gpio_write_pin_low(CHIMERA_ERGO_BLUE_LED_PIN)
13#define grn_led_off gpio_write_pin_high(CHIMERA_ERGO_GREEN_LED_PIN)
14#define grn_led_on gpio_write_pin_low(CHIMERA_ERGO_GREEN_LED_PIN)
11 15
12#define set_led_off red_led_off; grn_led_off; blu_led_off 16#define set_led_off red_led_off; grn_led_off; blu_led_off
13#define set_led_red red_led_on; grn_led_off; blu_led_off 17#define set_led_red red_led_on; grn_led_off; blu_led_off
@@ -17,27 +21,3 @@
17#define set_led_magenta red_led_on; grn_led_off; blu_led_on 21#define set_led_magenta red_led_on; grn_led_off; blu_led_on
18#define set_led_cyan red_led_off; grn_led_on; blu_led_on 22#define set_led_cyan red_led_off; grn_led_on; blu_led_on
19#define set_led_white red_led_on; grn_led_on; blu_led_on 23#define set_led_white red_led_on; grn_led_on; blu_led_on
20
21/*
22#define LED_B 5
23#define LED_R 6
24#define LED_G 7
25
26#define all_leds_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
27
28#define red_led_on PORTF |= (1<<LED_R)
29#define red_led_off PORTF &= ~(1<<LED_R)
30#define grn_led_on PORTF |= (1<<LED_G)
31#define grn_led_off PORTF &= ~(1<<LED_G)
32#define blu_led_on PORTF |= (1<<LED_B)
33#define blu_led_off PORTF &= ~(1<<LED_B)
34
35#define set_led_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
36#define set_led_red PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_G) | (1<<LED_R)
37#define set_led_blue PORTF = PORTF & ~(1<<LED_G) & ~(1<<LED_R) | (1<<LED_B)
38#define set_led_green PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_R) | (1<<LED_G)
39#define set_led_yellow PORTF = PORTF & ~(1<<LED_B) | (1<<LED_R) | (1<<LED_G)
40#define set_led_magenta PORTF = PORTF & ~(1<<LED_G) | (1<<LED_R) | (1<<LED_B)
41#define set_led_cyan PORTF = PORTF & ~(1<<LED_R) | (1<<LED_B) | (1<<LED_G)
42#define set_led_white PORTF |= (1<<LED_B) | (1<<LED_R) | (1<<LED_G)
43*/
diff --git a/keyboards/glenpickle/chimera_ls/chimera_ls.c b/keyboards/glenpickle/chimera_ls/chimera_ls.c
index f88e9a4f12..80bd99047f 100644
--- a/keyboards/glenpickle/chimera_ls/chimera_ls.c
+++ b/keyboards/glenpickle/chimera_ls/chimera_ls.c
@@ -1,10 +1,12 @@
1#include "chimera_ls.h" 1#include "chimera_ls.h"
2 2
3void led_init(void) { 3void led_init(void) {
4 DDRD |= (1<<1); 4 gpio_set_pin_output(CHIMERA_LS_GREEN_LED_PIN);
5 PORTD |= (1<<1); 5 gpio_write_pin_high(CHIMERA_LS_GREEN_LED_PIN);
6 DDRF |= (1<<4) | (1<<5); 6 gpio_set_pin_output(CHIMERA_LS_BLUE_LED_PIN);
7 PORTF |= (1<<4) | (1<<5); 7 gpio_write_pin_high(CHIMERA_LS_BLUE_LED_PIN);
8 gpio_set_pin_output(CHIMERA_LS_RED_LED_PIN);
9 gpio_write_pin_high(CHIMERA_LS_RED_LED_PIN);
8} 10}
9 11
10 12
diff --git a/keyboards/glenpickle/chimera_ls/chimera_ls.h b/keyboards/glenpickle/chimera_ls/chimera_ls.h
index 04ef56503f..f4c04614bb 100644
--- a/keyboards/glenpickle/chimera_ls/chimera_ls.h
+++ b/keyboards/glenpickle/chimera_ls/chimera_ls.h
@@ -2,12 +2,16 @@
2 2
3#include "quantum.h" 3#include "quantum.h"
4 4
5#define red_led_off PORTF |= (1<<5) 5#define CHIMERA_LS_RED_LED_PIN F5
6#define red_led_on PORTF &= ~(1<<5) 6#define CHIMERA_LS_GREEN_LED_PIN D1
7#define blu_led_off PORTF |= (1<<4) 7#define CHIMERA_LS_BLUE_LED_PIN F4
8#define blu_led_on PORTF &= ~(1<<4) 8
9#define grn_led_off PORTD |= (1<<1) 9#define red_led_off gpio_write_pin_high(CHIMERA_LS_RED_LED_PIN)
10#define grn_led_on PORTD &= ~(1<<1) 10#define red_led_on gpio_write_pin_low(CHIMERA_LS_RED_LED_PIN)
11#define blu_led_off gpio_write_pin_high(CHIMERA_LS_BLUE_LED_PIN)
12#define blu_led_on gpio_write_pin_low(CHIMERA_LS_BLUE_LED_PIN)
13#define grn_led_off gpio_write_pin_high(CHIMERA_LS_GREEN_LED_PIN)
14#define grn_led_on gpio_write_pin_low(CHIMERA_LS_GREEN_LED_PIN)
11 15
12#define set_led_off red_led_off; grn_led_off; blu_led_off 16#define set_led_off red_led_off; grn_led_off; blu_led_off
13#define set_led_red red_led_on; grn_led_off; blu_led_off 17#define set_led_red red_led_on; grn_led_off; blu_led_off
@@ -17,27 +21,3 @@
17#define set_led_magenta red_led_on; grn_led_off; blu_led_on 21#define set_led_magenta red_led_on; grn_led_off; blu_led_on
18#define set_led_cyan red_led_off; grn_led_on; blu_led_on 22#define set_led_cyan red_led_off; grn_led_on; blu_led_on
19#define set_led_white red_led_on; grn_led_on; blu_led_on 23#define set_led_white red_led_on; grn_led_on; blu_led_on
20
21/*
22#define LED_B 5
23#define LED_R 6
24#define LED_G 7
25
26#define all_leds_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
27
28#define red_led_on PORTF |= (1<<LED_R)
29#define red_led_off PORTF &= ~(1<<LED_R)
30#define grn_led_on PORTF |= (1<<LED_G)
31#define grn_led_off PORTF &= ~(1<<LED_G)
32#define blu_led_on PORTF |= (1<<LED_B)
33#define blu_led_off PORTF &= ~(1<<LED_B)
34
35#define set_led_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
36#define set_led_red PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_G) | (1<<LED_R)
37#define set_led_blue PORTF = PORTF & ~(1<<LED_G) & ~(1<<LED_R) | (1<<LED_B)
38#define set_led_green PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_R) | (1<<LED_G)
39#define set_led_yellow PORTF = PORTF & ~(1<<LED_B) | (1<<LED_R) | (1<<LED_G)
40#define set_led_magenta PORTF = PORTF & ~(1<<LED_G) | (1<<LED_R) | (1<<LED_B)
41#define set_led_cyan PORTF = PORTF & ~(1<<LED_R) | (1<<LED_B) | (1<<LED_G)
42#define set_led_white PORTF |= (1<<LED_B) | (1<<LED_R) | (1<<LED_G)
43*/
diff --git a/keyboards/glenpickle/chimera_ortho/chimera_ortho.c b/keyboards/glenpickle/chimera_ortho/chimera_ortho.c
index 2cdc3d9331..d7dc7b68cf 100644
--- a/keyboards/glenpickle/chimera_ortho/chimera_ortho.c
+++ b/keyboards/glenpickle/chimera_ortho/chimera_ortho.c
@@ -1,10 +1,12 @@
1#include "chimera_ortho.h" 1#include "chimera_ortho.h"
2 2
3void led_init(void) { 3void led_init(void) {
4 DDRD |= (1<<1); 4 gpio_set_pin_output(CHIMERA_ORTHO_GREEN_LED_PIN);
5 PORTD |= (1<<1); 5 gpio_write_pin_high(CHIMERA_ORTHO_GREEN_LED_PIN);
6 DDRF |= (1<<4) | (1<<5); 6 gpio_set_pin_output(CHIMERA_ORTHO_BLUE_LED_PIN);
7 PORTF |= (1<<4) | (1<<5); 7 gpio_write_pin_high(CHIMERA_ORTHO_BLUE_LED_PIN);
8 gpio_set_pin_output(CHIMERA_ORTHO_RED_LED_PIN);
9 gpio_write_pin_high(CHIMERA_ORTHO_RED_LED_PIN);
8} 10}
9 11
10 12
diff --git a/keyboards/glenpickle/chimera_ortho/chimera_ortho.h b/keyboards/glenpickle/chimera_ortho/chimera_ortho.h
index 04ef56503f..5f9169b93b 100644
--- a/keyboards/glenpickle/chimera_ortho/chimera_ortho.h
+++ b/keyboards/glenpickle/chimera_ortho/chimera_ortho.h
@@ -2,12 +2,16 @@
2 2
3#include "quantum.h" 3#include "quantum.h"
4 4
5#define red_led_off PORTF |= (1<<5) 5#define CHIMERA_ORTHO_RED_LED_PIN F5
6#define red_led_on PORTF &= ~(1<<5) 6#define CHIMERA_ORTHO_GREEN_LED_PIN D1
7#define blu_led_off PORTF |= (1<<4) 7#define CHIMERA_ORTHO_BLUE_LED_PIN F4
8#define blu_led_on PORTF &= ~(1<<4) 8
9#define grn_led_off PORTD |= (1<<1) 9#define red_led_off gpio_write_pin_high(CHIMERA_ORTHO_RED_LED_PIN)
10#define grn_led_on PORTD &= ~(1<<1) 10#define red_led_on gpio_write_pin_low(CHIMERA_ORTHO_RED_LED_PIN)
11#define blu_led_off gpio_write_pin_high(CHIMERA_ORTHO_BLUE_LED_PIN)
12#define blu_led_on gpio_write_pin_low(CHIMERA_ORTHO_BLUE_LED_PIN)
13#define grn_led_off gpio_write_pin_high(CHIMERA_ORTHO_GREEN_LED_PIN)
14#define grn_led_on gpio_write_pin_low(CHIMERA_ORTHO_GREEN_LED_PIN)
11 15
12#define set_led_off red_led_off; grn_led_off; blu_led_off 16#define set_led_off red_led_off; grn_led_off; blu_led_off
13#define set_led_red red_led_on; grn_led_off; blu_led_off 17#define set_led_red red_led_on; grn_led_off; blu_led_off
@@ -17,27 +21,3 @@
17#define set_led_magenta red_led_on; grn_led_off; blu_led_on 21#define set_led_magenta red_led_on; grn_led_off; blu_led_on
18#define set_led_cyan red_led_off; grn_led_on; blu_led_on 22#define set_led_cyan red_led_off; grn_led_on; blu_led_on
19#define set_led_white red_led_on; grn_led_on; blu_led_on 23#define set_led_white red_led_on; grn_led_on; blu_led_on
20
21/*
22#define LED_B 5
23#define LED_R 6
24#define LED_G 7
25
26#define all_leds_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
27
28#define red_led_on PORTF |= (1<<LED_R)
29#define red_led_off PORTF &= ~(1<<LED_R)
30#define grn_led_on PORTF |= (1<<LED_G)
31#define grn_led_off PORTF &= ~(1<<LED_G)
32#define blu_led_on PORTF |= (1<<LED_B)
33#define blu_led_off PORTF &= ~(1<<LED_B)
34
35#define set_led_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
36#define set_led_red PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_G) | (1<<LED_R)
37#define set_led_blue PORTF = PORTF & ~(1<<LED_G) & ~(1<<LED_R) | (1<<LED_B)
38#define set_led_green PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_R) | (1<<LED_G)
39#define set_led_yellow PORTF = PORTF & ~(1<<LED_B) | (1<<LED_R) | (1<<LED_G)
40#define set_led_magenta PORTF = PORTF & ~(1<<LED_G) | (1<<LED_R) | (1<<LED_B)
41#define set_led_cyan PORTF = PORTF & ~(1<<LED_R) | (1<<LED_B) | (1<<LED_G)
42#define set_led_white PORTF |= (1<<LED_B) | (1<<LED_R) | (1<<LED_G)
43*/
diff --git a/keyboards/glenpickle/chimera_ortho_plus/chimera_ortho_plus.c b/keyboards/glenpickle/chimera_ortho_plus/chimera_ortho_plus.c
index 6d87ed7053..6f32d1fb55 100644
--- a/keyboards/glenpickle/chimera_ortho_plus/chimera_ortho_plus.c
+++ b/keyboards/glenpickle/chimera_ortho_plus/chimera_ortho_plus.c
@@ -1,12 +1,12 @@
1#include "chimera_ortho_plus.h" 1#include "chimera_ortho_plus.h"
2 2
3void led_init(void) { 3void led_init(void) {
4 setPinOutput(D1); 4 gpio_set_pin_output(CHIMERA_ORTHO_PLUS_GREEN_LED_PIN);
5 setPinOutput(F4); 5 gpio_set_pin_output(CHIMERA_ORTHO_PLUS_BLUE_LED_PIN);
6 setPinOutput(F5); 6 gpio_set_pin_output(CHIMERA_ORTHO_PLUS_RED_LED_PIN);
7 writePinHigh(D1); 7 gpio_write_pin_high(CHIMERA_ORTHO_PLUS_GREEN_LED_PIN);
8 writePinHigh(F4); 8 gpio_write_pin_high(CHIMERA_ORTHO_PLUS_BLUE_LED_PIN);
9 writePinHigh(F5); 9 gpio_write_pin_high(CHIMERA_ORTHO_PLUS_RED_LED_PIN);
10} 10}
11 11
12 12
diff --git a/keyboards/glenpickle/chimera_ortho_plus/chimera_ortho_plus.h b/keyboards/glenpickle/chimera_ortho_plus/chimera_ortho_plus.h
index a5d79bbfcb..25aec599ad 100644
--- a/keyboards/glenpickle/chimera_ortho_plus/chimera_ortho_plus.h
+++ b/keyboards/glenpickle/chimera_ortho_plus/chimera_ortho_plus.h
@@ -2,12 +2,16 @@
2 2
3#include "quantum.h" 3#include "quantum.h"
4 4
5#define red_led_off PORTF |= (1<<5) 5#define CHIMERA_ORTHO_PLUS_RED_LED_PIN F5
6#define red_led_on PORTF &= ~(1<<5) 6#define CHIMERA_ORTHO_PLUS_GREEN_LED_PIN D1
7#define blu_led_off PORTF |= (1<<4) 7#define CHIMERA_ORTHO_PLUS_BLUE_LED_PIN F4
8#define blu_led_on PORTF &= ~(1<<4) 8
9#define grn_led_off PORTD |= (1<<1) 9#define red_led_off gpio_write_pin_high(CHIMERA_ORTHO_PLUS_RED_LED_PIN)
10#define grn_led_on PORTD &= ~(1<<1) 10#define red_led_on gpio_write_pin_low(CHIMERA_ORTHO_PLUS_RED_LED_PIN)
11#define blu_led_off gpio_write_pin_high(CHIMERA_ORTHO_PLUS_BLUE_LED_PIN)
12#define blu_led_on gpio_write_pin_low(CHIMERA_ORTHO_PLUS_BLUE_LED_PIN)
13#define grn_led_off gpio_write_pin_high(CHIMERA_ORTHO_PLUS_GREEN_LED_PIN)
14#define grn_led_on gpio_write_pin_low(CHIMERA_ORTHO_PLUS_GREEN_LED_PIN)
11 15
12#define set_led_off red_led_off; grn_led_off; blu_led_off 16#define set_led_off red_led_off; grn_led_off; blu_led_off
13#define set_led_red red_led_on; grn_led_off; blu_led_off 17#define set_led_red red_led_on; grn_led_off; blu_led_off
diff --git a/keyboards/handwired/arrow_pad/keymaps/default/keymap.c b/keyboards/handwired/arrow_pad/keymaps/default/keymap.c
index 820851f803..635667a080 100644
--- a/keyboards/handwired/arrow_pad/keymaps/default/keymap.c
+++ b/keyboards/handwired/arrow_pad/keymaps/default/keymap.c
@@ -100,21 +100,19 @@ bool led_update_user(led_t led_state)
100{ 100{
101 if (led_state.caps_lock) { 101 if (led_state.caps_lock) {
102 // output high 102 // output high
103 DDRD |= (1<<6); 103 gpio_set_pin_output(D6);
104 PORTD |= (1<<6); 104 gpio_write_pin_high(D6);
105 } else { 105 } else {
106 // Hi-Z 106 // Hi-Z
107 DDRD &= ~(1<<6); 107 gpio_set_pin_input(D6);
108 PORTD &= ~(1<<6);
109 } 108 }
110 if (led_state.num_lock) { 109 if (led_state.num_lock) {
111 // output low 110 // output low
112 DDRC |= (1<<7); 111 gpio_set_pin_output(C7);
113 PORTC |= ~(1<<7); 112 gpio_write_pin_low(C7);
114 } else { 113 } else {
115 // Hi-Z 114 // Hi-Z
116 DDRC &= ~(1<<7); 115 gpio_set_pin_input(C7);
117 PORTC &= ~(1<<7);
118 } 116 }
119 return false; 117 return false;
120} 118}
diff --git a/keyboards/handwired/arrow_pad/keymaps/pad_21/keymap.c b/keyboards/handwired/arrow_pad/keymaps/pad_21/keymap.c
index c3ab462ce3..b29717dc92 100644
--- a/keyboards/handwired/arrow_pad/keymaps/pad_21/keymap.c
+++ b/keyboards/handwired/arrow_pad/keymaps/pad_21/keymap.c
@@ -12,7 +12,7 @@
12 k19, k1A, k17 \ 12 k19, k1A, k17 \
13) { \ 13) { \
14 { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A }, \ 14 { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A }, \
15 { k10, k11, k12, k13, k14, k15, k16, k17, XXX, k19, k1A } \ 15 { k10, k11, k12, k13, k14, k15, k16, k17, KC_NO, k19, k1A } \
16} 16}
17 17
18enum layers { 18enum layers {
@@ -113,21 +113,19 @@ bool led_update_user(led_t led_state)
113{ 113{
114 if (led_state.caps_lock) { 114 if (led_state.caps_lock) {
115 // output high 115 // output high
116 DDRD |= (1<<6); 116 gpio_set_pin_output(D6);
117 PORTD |= (1<<6); 117 gpio_write_pin_high(D6);
118 } else { 118 } else {
119 // Hi-Z 119 // Hi-Z
120 DDRD &= ~(1<<6); 120 gpio_set_pin_input(D6);
121 PORTD &= ~(1<<6);
122 } 121 }
123 if (led_state.num_lock) { 122 if (led_state.num_lock) {
124 // output low 123 // output low
125 DDRC |= (1<<7); 124 gpio_set_pin_output(C7);
126 PORTC |= ~(1<<7); 125 gpio_write_pin_low(C7);
127 } else { 126 } else {
128 // Hi-Z 127 // Hi-Z
129 DDRC &= ~(1<<7); 128 gpio_set_pin_input(C7);
130 PORTC &= ~(1<<7);
131 } 129 }
132 return false; 130 return false;
133} 131}
diff --git a/keyboards/handwired/arrow_pad/keymaps/pad_24/keymap.c b/keyboards/handwired/arrow_pad/keymaps/pad_24/keymap.c
index fc044a0e1a..986442e645 100644
--- a/keyboards/handwired/arrow_pad/keymaps/pad_24/keymap.c
+++ b/keyboards/handwired/arrow_pad/keymaps/pad_24/keymap.c
@@ -100,21 +100,19 @@ bool led_update_user(led_t led_state)
100{ 100{
101 if (led_state.caps_lock) { 101 if (led_state.caps_lock) {
102 // output high 102 // output high
103 DDRD |= (1<<6); 103 gpio_set_pin_output(D6);
104 PORTD |= (1<<6); 104 gpio_write_pin_high(D6);
105 } else { 105 } else {
106 // Hi-Z 106 // Hi-Z
107 DDRD &= ~(1<<6); 107 gpio_set_pin_input(D6);
108 PORTD &= ~(1<<6);
109 } 108 }
110 if (led_state.num_lock) { 109 if (led_state.num_lock) {
111 // output low 110 // output low
112 DDRC |= (1<<7); 111 gpio_set_pin_output(C7);
113 PORTC |= ~(1<<7); 112 gpio_write_pin_low(C7);
114 } else { 113 } else {
115 // Hi-Z 114 // Hi-Z
116 DDRC &= ~(1<<7); 115 gpio_set_pin_input(C7);
117 PORTC &= ~(1<<7);
118 } 116 }
119 return false; 117 return false;
120} 118}
diff --git a/keyboards/handwired/atreus50/atreus50.c b/keyboards/handwired/atreus50/atreus50.c
index 7b4e6f9586..eed4e0b443 100644
--- a/keyboards/handwired/atreus50/atreus50.c
+++ b/keyboards/handwired/atreus50/atreus50.c
@@ -3,8 +3,8 @@
3void matrix_init_kb(void) { 3void matrix_init_kb(void) {
4 4
5 // Turn status LED on 5 // Turn status LED on
6 //DDRE |= (1<<6); 6 //gpio_set_pin_output(E6);
7 PORTE |= (1<<6); 7 gpio_write_pin_high(E6);
8 8
9 matrix_init_user(); 9 matrix_init_user();
10}; 10};
diff --git a/keyboards/handwired/datahand/matrix.c b/keyboards/handwired/datahand/matrix.c
index afce07e10d..0e31c09a1b 100644
--- a/keyboards/handwired/datahand/matrix.c
+++ b/keyboards/handwired/datahand/matrix.c
@@ -99,27 +99,27 @@ static void select_row(uint8_t row) {
99 */ 99 */
100 100
101 if (row & (1<<0)) { 101 if (row & (1<<0)) {
102 PORTE |= (1<<6); 102 gpio_write_pin_high(E6);
103 } else { 103 } else {
104 PORTE &= ~(1<<6); 104 gpio_write_pin_low(E6);
105 } 105 }
106 106
107 if (row & (1<<1)) { 107 if (row & (1<<1)) {
108 PORTB |= (1<<7); 108 gpio_write_pin_high(B7);
109 } else { 109 } else {
110 PORTB &= ~(1<<7); 110 gpio_write_pin_low(B7);
111 } 111 }
112 112
113 if (row & (1<<2)) { 113 if (row & (1<<2)) {
114 PORTD |= (1<<0); 114 gpio_write_pin_high(D0);
115 } else { 115 } else {
116 PORTD &= ~(1<<0); 116 gpio_write_pin_low(D0);
117 } 117 }
118 118
119 if (row & (1<<3)) { 119 if (row & (1<<3)) {
120 PORTD |= (1<<1); 120 gpio_write_pin_high(D1);
121 } else { 121 } else {
122 PORTD &= ~(1<<1); 122 gpio_write_pin_low(D1);
123 } 123 }
124} 124}
125 125
diff --git a/keyboards/handwired/frenchdev/frenchdev.c b/keyboards/handwired/frenchdev/frenchdev.c
index 818c395c8e..6ff0158b5b 100644
--- a/keyboards/handwired/frenchdev/frenchdev.c
+++ b/keyboards/handwired/frenchdev/frenchdev.c
@@ -4,13 +4,11 @@ extern inline void frenchdev_board_led_on(void);
4extern inline void frenchdev_led_1_on(void); 4extern inline void frenchdev_led_1_on(void);
5extern inline void frenchdev_led_2_on(void); 5extern inline void frenchdev_led_2_on(void);
6extern inline void frenchdev_led_3_on(void); 6extern inline void frenchdev_led_3_on(void);
7extern inline void frenchdev_led_on(uint8_t led);
8 7
9extern inline void frenchdev_board_led_off(void); 8extern inline void frenchdev_board_led_off(void);
10extern inline void frenchdev_led_1_off(void); 9extern inline void frenchdev_led_1_off(void);
11extern inline void frenchdev_led_2_off(void); 10extern inline void frenchdev_led_2_off(void);
12extern inline void frenchdev_led_3_off(void); 11extern inline void frenchdev_led_3_off(void);
13extern inline void frenchdev_led_off(uint8_t led);
14 12
15extern inline void frenchdev_led_all_on(void); 13extern inline void frenchdev_led_all_on(void);
16extern inline void frenchdev_led_all_off(void); 14extern inline void frenchdev_led_all_off(void);
@@ -32,12 +30,11 @@ void matrix_init_kb(void) {
32 30
33 31
34 32
35 // unused pins - D4, D5, D7, E6 33 // unused pins - D4, D5, E6
36 // set as input with internal pull-ip enabled 34 // set as input with internal pull-ip enabled
37 DDRD &= ~(1<<5 | 1<<4); 35 gpio_set_pin_input_high(D4);
38 DDRE &= ~(1<<6); 36 gpio_set_pin_input_high(D5);
39 PORTD |= (1<<5 | 1<<4); 37 gpio_set_pin_input_high(E6);
40 PORTE |= (1<<6);
41 38
42 frenchdev_blink_all_leds(); 39 frenchdev_blink_all_leds();
43 frenchdev_blink_all_leds(); 40 frenchdev_blink_all_leds();
diff --git a/keyboards/handwired/frenchdev/frenchdev.h b/keyboards/handwired/frenchdev/frenchdev.h
index 0f1ac7dcaa..ff384724e1 100644
--- a/keyboards/handwired/frenchdev/frenchdev.h
+++ b/keyboards/handwired/frenchdev/frenchdev.h
@@ -27,18 +27,40 @@ uint8_t init_mcp23018(void);
27#define LED_BRIGHTNESS_LO 15 27#define LED_BRIGHTNESS_LO 15
28#define LED_BRIGHTNESS_HI 255 28#define LED_BRIGHTNESS_HI 255
29 29
30#define FRENCHDEV_BOARD_LED_PIN D6
31#define FRENCHDEV_LED_1_PIN B5
32#define FRENCHDEV_LED_2_PIN B6
33#define FRENCHDEV_LED_3_PIN B7
30 34
31inline void frenchdev_board_led_on(void) { DDRD |= (1<<6); PORTD |= (1<<6); } 35inline void frenchdev_board_led_on(void) {
32inline void frenchdev_led_1_on(void) { DDRB |= (1<<5); PORTB |= (1<<5); } 36 gpio_set_pin_output(FRENCHDEV_BOARD_LED_PIN);
33inline void frenchdev_led_2_on(void) { DDRB |= (1<<6); PORTB |= (1<<6); } 37 gpio_write_pin_high(FRENCHDEV_BOARD_LED_PIN);
34inline void frenchdev_led_3_on(void) { DDRB |= (1<<7); PORTB |= (1<<7); } 38}
35inline void frenchdev_led_on(uint8_t led) { DDRB |= (1<<(led+4)); PORTB |= (1<<(led+4)); } 39inline void frenchdev_led_1_on(void) {
40 gpio_set_pin_output(FRENCHDEV_LED_1_PIN);
41 gpio_write_pin_high(FRENCHDEV_LED_1_PIN);
42}
43inline void frenchdev_led_2_on(void) {
44 gpio_set_pin_output(FRENCHDEV_LED_2_PIN);
45 gpio_write_pin_high(FRENCHDEV_LED_2_PIN);
46}
47inline void frenchdev_led_3_on(void) {
48 gpio_set_pin_output(FRENCHDEV_LED_3_PIN);
49 gpio_write_pin_high(FRENCHDEV_LED_3_PIN);
50}
36 51
37inline void frenchdev_board_led_off(void) { DDRD &= ~(1<<6); PORTD &= ~(1<<6); } 52inline void frenchdev_board_led_off(void) {
38inline void frenchdev_led_1_off(void) { DDRB &= ~(1<<5); PORTB &= ~(1<<5); } 53 gpio_set_pin_input(FRENCHDEV_BOARD_LED_PIN);
39inline void frenchdev_led_2_off(void) { DDRB &= ~(1<<6); PORTB &= ~(1<<6); } 54}
40inline void frenchdev_led_3_off(void) { DDRB &= ~(1<<7); PORTB &= ~(1<<7); } 55inline void frenchdev_led_1_off(void) {
41inline void frenchdev_led_off(uint8_t led) { DDRB &= ~(1<<(led+4)); PORTB &= ~(1<<(led+4)); } 56 gpio_set_pin_input(FRENCHDEV_LED_1_PIN);
57}
58inline void frenchdev_led_2_off(void) {
59 gpio_set_pin_input(FRENCHDEV_LED_2_PIN);
60}
61inline void frenchdev_led_3_off(void) {
62 gpio_set_pin_input(FRENCHDEV_LED_3_PIN);
63}
42 64
43inline void frenchdev_led_all_on(void) 65inline void frenchdev_led_all_on(void)
44{ 66{
diff --git a/keyboards/handwired/frenchdev/matrix.c b/keyboards/handwired/frenchdev/matrix.c
index 68ec8e0801..7691eb762b 100644
--- a/keyboards/handwired/frenchdev/matrix.c
+++ b/keyboards/handwired/frenchdev/matrix.c
@@ -213,8 +213,12 @@ static void init_cols(void)
213 213
214 // init on teensy 214 // init on teensy
215 // Input with pull-up(DDR:0, PORT:1) 215 // Input with pull-up(DDR:0, PORT:1)
216 DDRF &= ~(1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<1 | 1<<0); 216 gpio_set_pin_input_high(F0);
217 PORTF |= (1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<1 | 1<<0); 217 gpio_set_pin_input_high(F1);
218 gpio_set_pin_input_high(F4);
219 gpio_set_pin_input_high(F5);
220 gpio_set_pin_input_high(F6);
221 gpio_set_pin_input_high(F7);
218} 222}
219 223
220static matrix_row_t read_cols(uint8_t row) 224static matrix_row_t read_cols(uint8_t row)
@@ -265,12 +269,14 @@ static void unselect_rows(void)
265 269
266 // unselect on teensy 270 // unselect on teensy
267 // Hi-Z(DDR:0, PORT:0) to unselect 271 // Hi-Z(DDR:0, PORT:0) to unselect
268 DDRB &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3); 272 gpio_set_pin_input(B0);
269 PORTB &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3); 273 gpio_set_pin_input(B1);
270 DDRD &= ~(1<<2 | 1<<3); 274 gpio_set_pin_input(B2);
271 PORTD &= ~(1<<2 | 1<<3); 275 gpio_set_pin_input(B3);
272 DDRC &= ~(1<<6 | 1<<7); 276 gpio_set_pin_input(D2);
273 PORTC &= ~(1<<6 | 1<<7); 277 gpio_set_pin_input(D3);
278 gpio_set_pin_input(C6);
279 gpio_set_pin_input(C7);
274} 280}
275 281
276static void select_row(uint8_t row) 282static void select_row(uint8_t row)
@@ -290,36 +296,36 @@ static void select_row(uint8_t row)
290 // Output low(DDR:1, PORT:0) to select 296 // Output low(DDR:1, PORT:0) to select
291 switch (row) { 297 switch (row) {
292 case 8: 298 case 8:
293 DDRB |= (1<<0); 299 gpio_set_pin_output(B0);
294 PORTB &= ~(1<<0); 300 gpio_write_pin_low(B0);
295 break; 301 break;
296 case 9: 302 case 9:
297 DDRB |= (1<<1); 303 gpio_set_pin_output(B1);
298 PORTB &= ~(1<<1); 304 gpio_write_pin_low(B1);
299 break; 305 break;
300 case 10: 306 case 10:
301 DDRB |= (1<<2); 307 gpio_set_pin_output(B2);
302 PORTB &= ~(1<<2); 308 gpio_write_pin_low(B2);
303 break; 309 break;
304 case 11: 310 case 11:
305 DDRB |= (1<<3); 311 gpio_set_pin_output(B3);
306 PORTB &= ~(1<<3); 312 gpio_write_pin_low(B3);
307 break; 313 break;
308 case 12: 314 case 12:
309 DDRD |= (1<<2); 315 gpio_set_pin_output(D2);
310 PORTD &= ~(1<<3); 316 gpio_write_pin_low(D2);
311 break; 317 break;
312 case 13: 318 case 13:
313 DDRD |= (1<<3); 319 gpio_set_pin_output(D3);
314 PORTD &= ~(1<<3); 320 gpio_write_pin_low(D3);
315 break; 321 break;
316 case 14: 322 case 14:
317 DDRC |= (1<<6); 323 gpio_set_pin_output(C6);
318 PORTC &= ~(1<<6); 324 gpio_write_pin_low(C6);
319 break; 325 break;
320 case 15: 326 case 15:
321 DDRC |= (1<<7); 327 gpio_set_pin_output(C7);
322 PORTC &= ~(1<<7); 328 gpio_write_pin_low(C7);
323 break; 329 break;
324 } 330 }
325 } 331 }
diff --git a/keyboards/handwired/gamenum/gamenum.c b/keyboards/handwired/gamenum/gamenum.c
index 25493d94c3..08735c29ba 100644
--- a/keyboards/handwired/gamenum/gamenum.c
+++ b/keyboards/handwired/gamenum/gamenum.c
@@ -3,11 +3,11 @@
3void matrix_init_kb(void) { 3void matrix_init_kb(void) {
4 // put your keyboard start-up code here 4 // put your keyboard start-up code here
5 // runs once when the firmware starts up 5 // runs once when the firmware starts up
6 DDRC |= (1<<6); 6 gpio_set_pin_output(C6);
7 PORTC &= ~(1<<6); 7 gpio_write_pin_low(C6);
8 8
9 DDRD |= (1<<4); 9 gpio_set_pin_output(D4);
10 PORTD &= ~(1<<4); 10 gpio_write_pin_low(D4);
11 11
12 matrix_init_user(); 12 matrix_init_user();
13 13
diff --git a/keyboards/handwired/gamenum/keymaps/default/keymap.c b/keyboards/handwired/gamenum/keymaps/default/keymap.c
index 8b768850c8..86bad4ebac 100644
--- a/keyboards/handwired/gamenum/keymaps/default/keymap.c
+++ b/keyboards/handwired/gamenum/keymaps/default/keymap.c
@@ -33,22 +33,22 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
33 switch(keycode) { 33 switch(keycode) {
34 case TO(HDN): 34 case TO(HDN):
35 if (record->event.pressed) { 35 if (record->event.pressed) {
36 PORTC |= (1 << 6); // PC6 goes high 36 gpio_write_pin_high(C6);
37 } 37 }
38 38
39 return true; 39 return true;
40 40
41 case TO(OSY): 41 case TO(OSY):
42 if (record->event.pressed) { 42 if (record->event.pressed) {
43 PORTC &= ~(1 << 6); // PC6 goes high 43 gpio_write_pin_low(C6);
44 PORTD |= (1<<4); 44 gpio_write_pin_high(D4);
45 } 45 }
46 46
47 return true; 47 return true;
48 48
49 case TO(DEF): 49 case TO(DEF):
50 if (record->event.pressed) { 50 if (record->event.pressed) {
51 PORTD &= ~(1 << 4); // PC6 goes high 51 gpio_write_pin_low(D4);
52 } 52 }
53 53
54 return true; 54 return true;
diff --git a/keyboards/handwired/retro_refit/retro_refit.c b/keyboards/handwired/retro_refit/retro_refit.c
index b7e1ec03fa..f23ef1fd40 100644
--- a/keyboards/handwired/retro_refit/retro_refit.c
+++ b/keyboards/handwired/retro_refit/retro_refit.c
@@ -6,8 +6,8 @@ void matrix_init_kb(void) {
6 // runs once when the firmware starts up 6 // runs once when the firmware starts up
7 7
8 // Disable status LED on KB, enable status LED on Teensy (KB_STATUS = !TEENSY_STATUS) 8 // Disable status LED on KB, enable status LED on Teensy (KB_STATUS = !TEENSY_STATUS)
9 DDRD |= (1<<6); 9 gpio_set_pin_output(D6);
10 PORTD |= (1<<6); 10 gpio_write_pin_high(D6);
11 11
12 matrix_init_user(); 12 matrix_init_user();
13}; 13};
diff --git a/keyboards/hotdox/hotdox.h b/keyboards/hotdox/hotdox.h
index b933344439..d0b6c401f9 100644
--- a/keyboards/hotdox/hotdox.h
+++ b/keyboards/hotdox/hotdox.h
@@ -4,17 +4,46 @@
4#include <stdint.h> 4#include <stdint.h>
5#include <stdbool.h> 5#include <stdbool.h>
6 6
7#define HOTDOX_BOARD_LED_PIN B7
8#define HOTDOX_RIGHT_LED_1_PIN B5
9#define HOTDOX_RIGHT_LED_2_PIN B6
10#define HOTDOX_RIGHT_LED_3_PIN B4
11
7void init_ergodox(void); 12void init_ergodox(void);
8 13
9inline void ergodox_board_led_on(void) { DDRB |= (1<<PB7); PORTB |= (1<<PB7); } 14inline void ergodox_board_led_on(void) {
10inline void ergodox_right_led_1_on(void) { DDRB |= (1<<PB5); PORTB &= ~(1<<PB5); } 15 gpio_set_pin_output(HOTDOX_BOARD_LED_PIN);
11inline void ergodox_right_led_2_on(void) { DDRB |= (1<<PB6); PORTB &= ~(1<<PB6); } 16 gpio_write_pin_high(HOTDOX_BOARD_LED_PIN);
12inline void ergodox_right_led_3_on(void) { DDRB |= (1<<PB4); PORTB &= ~(1<<PB4); } 17}
18inline void ergodox_right_led_1_on(void) {
19 gpio_set_pin_output(HOTDOX_RIGHT_LED_1_PIN);
20 gpio_write_pin_low(HOTDOX_RIGHT_LED_1_PIN);
21}
22inline void ergodox_right_led_2_on(void) {
23 gpio_set_pin_output(HOTDOX_RIGHT_LED_2_PIN);
24 gpio_write_pin_low(HOTDOX_RIGHT_LED_2_PIN);
25}
26inline void ergodox_right_led_3_on(void) {
27 gpio_set_pin_output(HOTDOX_RIGHT_LED_3_PIN);
28 gpio_write_pin_low(HOTDOX_RIGHT_LED_3_PIN);
29}
13 30
14inline void ergodox_board_led_off(void) { DDRB |= (1<<PB7); PORTB &= ~(1<<PB7); } 31inline void ergodox_board_led_off(void) {
15inline void ergodox_right_led_1_off(void) { DDRB |= (1<<PB5); PORTB |= (1<<PB5); } 32 gpio_set_pin_output(HOTDOX_BOARD_LED_PIN);
16inline void ergodox_right_led_2_off(void) { DDRB |= (1<<PB6); PORTB |= (1<<PB6); } 33 gpio_write_pin_low(HOTDOX_BOARD_LED_PIN);
17inline void ergodox_right_led_3_off(void) { DDRB |= (1<<PB4); PORTB |= (1<<PB4); } 34}
35inline void ergodox_right_led_1_off(void) {
36 gpio_set_pin_output(HOTDOX_RIGHT_LED_1_PIN);
37 gpio_write_pin_high(HOTDOX_RIGHT_LED_1_PIN);
38}
39inline void ergodox_right_led_2_off(void) {
40 gpio_set_pin_output(HOTDOX_RIGHT_LED_2_PIN);
41 gpio_write_pin_high(HOTDOX_RIGHT_LED_2_PIN);
42}
43inline void ergodox_right_led_3_off(void) {
44 gpio_set_pin_output(HOTDOX_RIGHT_LED_3_PIN);
45 gpio_write_pin_high(HOTDOX_RIGHT_LED_3_PIN);
46}
18 47
19inline void ergodox_right_led_on(uint8_t l) { 48inline void ergodox_right_led_on(uint8_t l) {
20 switch (l) { 49 switch (l) {
diff --git a/keyboards/hotdox/matrix.c b/keyboards/hotdox/matrix.c
index 04b6d72b75..df2f9fcddf 100644
--- a/keyboards/hotdox/matrix.c
+++ b/keyboards/hotdox/matrix.c
@@ -163,14 +163,15 @@ void matrix_print(void)
163static void init_cols(void) 163static void init_cols(void)
164{ 164{
165 // Pro Micro 165 // Pro Micro
166 DDRB &= ~(1<<PB0 | 1<<PB1 | 1<<PB2 | 1<<PB3); 166 gpio_set_pin_input_high(B0);
167 PORTB |= (1<<PB0 | 1<<PB1 | 1<<PB2 | 1<<PB3); 167 gpio_set_pin_input_high(B1);
168 gpio_set_pin_input_high(B2);
169 gpio_set_pin_input_high(B3);
168 170
169 DDRD &= ~(1<<PD2 | 1<<PD3); 171 gpio_set_pin_input_high(D2);
170 PORTD |= (1<<PD2 | 1<<PD3); 172 gpio_set_pin_input_high(D3);
171 173
172 DDRC &= ~(1<<PC6); 174 gpio_set_pin_input_high(C6);
173 PORTC |= (1<<PC6);
174 175
175 left_init(); 176 left_init();
176} 177}
@@ -195,8 +196,12 @@ static matrix_row_t read_cols(uint8_t row)
195static void unselect_rows(void) 196static void unselect_rows(void)
196{ 197{
197 // Pro Micro 198 // Pro Micro
198 DDRF &= ~(1<<PF7 | 1<< PF6 | 1<<PF5 | 1<<PF4 | 1<<PF1 | 1<<PF0); 199 gpio_set_pin_input(F0);
199 PORTF &= ~(1<<PF7 | 1<< PF6 | 1<<PF5 | 1<<PF4 | 1<<PF1 | 1<<PF0); 200 gpio_set_pin_input(F1);
201 gpio_set_pin_input(F4);
202 gpio_set_pin_input(F5);
203 gpio_set_pin_input(F6);
204 gpio_set_pin_input(F7);
200 205
201 left_unselect_rows(); 206 left_unselect_rows();
202} 207}
@@ -206,28 +211,28 @@ static void select_row(uint8_t row)
206 // Pro Micro 211 // Pro Micro
207 switch (row) { 212 switch (row) {
208 case 5: 213 case 5:
209 DDRF |= (1<<PF0); 214 gpio_set_pin_output(F0);
210 PORTF &= ~(1<<PF0); 215 gpio_write_pin_low(F0);
211 break; 216 break;
212 case 4: 217 case 4:
213 DDRF |= (1<<PF1); 218 gpio_set_pin_output(F1);
214 PORTF &= ~(1<<PF1); 219 gpio_write_pin_low(F1);
215 break; 220 break;
216 case 3: 221 case 3:
217 DDRF |= (1<<PF4); 222 gpio_set_pin_output(F4);
218 PORTF &= ~(1<<PF4); 223 gpio_write_pin_low(F4);
219 break; 224 break;
220 case 2: 225 case 2:
221 DDRF |= (1<<PF5); 226 gpio_set_pin_output(F5);
222 PORTF &= ~(1<<PF5); 227 gpio_write_pin_low(F5);
223 break; 228 break;
224 case 1: 229 case 1:
225 DDRF |= (1<<PF6); 230 gpio_set_pin_output(F6);
226 PORTF &= ~(1<<PF6); 231 gpio_write_pin_low(F6);
227 break; 232 break;
228 case 0: 233 case 0:
229 DDRF |= (1<<PF7); 234 gpio_set_pin_output(F7);
230 PORTF &= ~(1<<PF7); 235 gpio_write_pin_low(F7);
231 break; 236 break;
232 } 237 }
233 238
diff --git a/keyboards/keyboardio/model01/leds.c b/keyboards/keyboardio/model01/leds.c
index 656e176bfa..c9a037906a 100644
--- a/keyboards/keyboardio/model01/leds.c
+++ b/keyboards/keyboardio/model01/leds.c
@@ -65,12 +65,11 @@ static void set_color_all(uint8_t r, uint8_t g, uint8_t b) {
65 65
66static void init(void) { 66static void init(void) {
67 // Enable high current pathway to LEDs - this does violate the USB spec though! (1.6 amps...) 67 // Enable high current pathway to LEDs - this does violate the USB spec though! (1.6 amps...)
68 DDRE |= _BV(6); 68 gpio_set_pin_output(E6);
69 PORTE &= ~_BV(6); 69 gpio_write_pin_low(E6);
70 70
71 // Overcurrent check input 71 // Overcurrent check input
72 DDRB &= ~_BV(4); 72 gpio_set_pin_input(B4);
73 PORTB &= ~_BV(4);
74} 73}
75 74
76static void flush(void) { 75static void flush(void) {
diff --git a/keyboards/keyboardio/model01/matrix.c b/keyboards/keyboardio/model01/matrix.c
index 20359ca971..72948fc0b7 100644
--- a/keyboards/keyboardio/model01/matrix.c
+++ b/keyboards/keyboardio/model01/matrix.c
@@ -69,8 +69,8 @@ static int i2c_set_keyscan_interval(int hand, int delay) {
69 69
70void matrix_init(void) { 70void matrix_init(void) {
71 /* Ensure scanner power is on - else right hand will not work */ 71 /* Ensure scanner power is on - else right hand will not work */
72 DDRC |= _BV(7); 72 gpio_set_pin_output(C7);
73 PORTC |= _BV(7); 73 gpio_write_pin_high(C7);
74 74
75 i2c_init(); 75 i2c_init();
76 i2c_set_keyscan_interval(LEFT, 2); 76 i2c_set_keyscan_interval(LEFT, 2);
diff --git a/keyboards/kira/kira75/kira75.h b/keyboards/kira/kira75/kira75.h
index 8001d69e40..95afb40e46 100644
--- a/keyboards/kira/kira75/kira75.h
+++ b/keyboards/kira/kira75/kira75.h
@@ -18,9 +18,22 @@
18 18
19#include "quantum.h" 19#include "quantum.h"
20 20
21#define KIRA75_CAPS_LOCK_LED_PIN D7
22#define KIRA75_NUM_LOCK_LED_PIN D6
23
21// Functions for setting LEDs on toggle keys 24// Functions for setting LEDs on toggle keys
22inline void caps_led_on(void) { DDRD |= (1<<7); PORTD &= ~(1<<7); } 25inline void caps_led_on(void) {
23inline void caps_led_off(void) { DDRD &= ~(1<<7); PORTD &= ~(1<<7); } 26 gpio_set_pin_output(KIRA75_CAPS_LOCK_LED_PIN);
27 gpio_write_pin_low(KIRA75_CAPS_LOCK_LED_PIN);
28}
29inline void caps_led_off(void) {
30 gpio_set_pin_input(KIRA75_CAPS_LOCK_LED_PIN);
31}
24 32
25inline void num_led_on(void) { DDRD |= (1<<6); PORTD &= ~(1<<6); } 33inline void num_led_on(void) {
26inline void num_led_off(void) { DDRD &= ~(1<<6); PORTD &= ~(1<<6); } 34 gpio_set_pin_output(KIRA75_NUM_LOCK_LED_PIN);
35 gpio_write_pin_low(KIRA75_NUM_LOCK_LED_PIN);
36}
37inline void num_led_off(void) {
38 gpio_set_pin_input(KIRA75_NUM_LOCK_LED_PIN);
39}
diff --git a/keyboards/kmini/matrix.c b/keyboards/kmini/matrix.c
index 92565e937a..da177a7a35 100755
--- a/keyboards/kmini/matrix.c
+++ b/keyboards/kmini/matrix.c
@@ -194,11 +194,13 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
194 * Caps lock uses its own pin E2 194 * Caps lock uses its own pin E2
195 */ 195 */
196static void init_rows(void) { 196static void init_rows(void) {
197 DDRD &= ~((1<<0)| (1<<1) | (1<<2) | (1<<3) | (1<<5)); // IN 197 gpio_set_pin_input(D0);
198 PORTD &= ~((1<<0)| (1<<1) | (1<<2) | (1<<3) | (1<<5)); // LO 198 gpio_set_pin_input(D1);
199 gpio_set_pin_input(D2);
200 gpio_set_pin_input(D3);
201 gpio_set_pin_input(D5);
199 202
200 DDRE &= ~(1<<2); // IN 203 gpio_set_pin_input_high(E2);
201 PORTE |= (1<<2); // HI
202} 204}
203 205
204/* Columns 0 - 16 206/* Columns 0 - 16
@@ -224,87 +226,103 @@ static void init_rows(void) {
224 * col 16: B4 226 * col 16: B4
225 */ 227 */
226static void unselect_cols(void) { 228static void unselect_cols(void) {
227 DDRB |= (1<<5) | (1<<6) | (1<<0) | (1<<7) | (1<<4); // OUT 229 gpio_set_pin_output(B0);
228 PORTB &= ~((1<<5) | (1<<6) | (1<<0) | (1<<7) | (1<<4)); // LO 230 gpio_set_pin_output(B4);
229 231 gpio_set_pin_output(B5);
230 DDRD |= (1<<4) | (1<<6) | (1<<7); // OUT 232 gpio_set_pin_output(B6);
231 PORTD &= ~((1<<4) | (1<<6) | (1<<7)); // LO 233 gpio_set_pin_output(B7);
232 234 gpio_write_pin_low(B0);
233 DDRE |= (1<<6); // OUT 235 gpio_write_pin_low(B4);
234 PORTE &= ~((1<<6)); // LO 236 gpio_write_pin_low(B5);
235 237 gpio_write_pin_low(B6);
236 DDRF |= (1<<0) | (1<<1); // OUT 238 gpio_write_pin_low(B7);
237 PORTF &= ~((1<<0) | (1<<1)); // LO 239
238 240 gpio_set_pin_output(D4);
239 DDRC |= (1<<7) | (1<<6); // OUT 241 gpio_set_pin_output(D6);
240 PORTC &= ~((1<<7) | (1<<6)); // LO 242 gpio_set_pin_output(D7);
243 gpio_write_pin_low(D4);
244 gpio_write_pin_low(D6);
245 gpio_write_pin_low(D7);
246
247 gpio_set_pin_output(E6);
248 gpio_write_pin_low(E6);
249
250 gpio_set_pin_output(F0);
251 gpio_set_pin_output(F1);
252 gpio_write_pin_low(F0);
253 gpio_write_pin_low(F1);
254
255 gpio_set_pin_output(C6);
256 gpio_set_pin_output(C7);
257 gpio_write_pin_low(C6);
258 gpio_write_pin_low(C7);
241} 259}
242 260
243static void select_col(uint8_t col) 261static void select_col(uint8_t col)
244{ 262{
245 switch (col) { 263 switch (col) {
246 case 0: 264 case 0:
247 PORTB |= (1<<5); // HI 265 gpio_write_pin_high(B5); // HI
248 break; 266 break;
249 case 1: 267 case 1:
250 PORTB |= (1<<6); // HI 268 gpio_write_pin_high(B6); // HI
251 break; 269 break;
252 case 2: 270 case 2:
253 PORTC |= (1<<6); // HI 271 gpio_write_pin_high(C6); // HI
254 break; 272 break;
255 case 3: 273 case 3:
256 PORTC |= (1<<6); // HI 274 gpio_write_pin_high(C6); // HI
257 PORTF |= (1<<0); // HI 275 gpio_write_pin_high(F0); // HI
258 break; 276 break;
259 case 4: 277 case 4:
260 PORTC |= (1<<6); // HI 278 gpio_write_pin_high(C6); // HI
261 PORTF |= (1<<1); // HI 279 gpio_write_pin_high(F1); // HI
262 break; 280 break;
263 case 5: 281 case 5:
264 PORTC |= (1<<6); // HI 282 gpio_write_pin_high(C6); // HI
265 PORTF |= (1<<0); // HI 283 gpio_write_pin_high(F0); // HI
266 PORTF |= (1<<1); // HI 284 gpio_write_pin_high(F1); // HI
267 break; 285 break;
268 case 6: 286 case 6:
269 PORTC |= (1<<6); // HI 287 gpio_write_pin_high(C6); // HI
270 PORTC |= (1<<7); // HI 288 gpio_write_pin_high(C7); // HI
271 break; 289 break;
272 case 7: 290 case 7:
273 PORTC |= (1<<6); // HI 291 gpio_write_pin_high(C6); // HI
274 PORTF |= (1<<0); // HI 292 gpio_write_pin_high(F0); // HI
275 PORTC |= (1<<7); // HI 293 gpio_write_pin_high(C7); // HI
276 break; 294 break;
277 case 8: 295 case 8:
278 PORTC |= (1<<6); // HI 296 gpio_write_pin_high(C6); // HI
279 PORTF |= (1<<1); // HI 297 gpio_write_pin_high(F1); // HI
280 PORTC |= (1<<7); // HI 298 gpio_write_pin_high(C7); // HI
281 break; 299 break;
282 case 9: 300 case 9:
283 PORTC |= (1<<6); // HI 301 gpio_write_pin_high(C6); // HI
284 PORTF |= (1<<0); // HI 302 gpio_write_pin_high(F0); // HI
285 PORTF |= (1<<1); // HI 303 gpio_write_pin_high(F1); // HI
286 PORTC |= (1<<7); // HI 304 gpio_write_pin_high(C7); // HI
287 break; 305 break;
288 case 10: 306 case 10:
289 PORTE |= (1<<6); // HI 307 gpio_write_pin_high(E6); // HI
290 break; 308 break;
291 case 11: 309 case 11:
292 PORTB |= (1<<0); // HI 310 gpio_write_pin_high(B0); // HI
293 break; 311 break;
294 case 12: 312 case 12:
295 PORTB |= (1<<7); // HI 313 gpio_write_pin_high(B7); // HI
296 break; 314 break;
297 case 13: 315 case 13:
298 PORTD |= (1<<4); // HI 316 gpio_write_pin_high(D4); // HI
299 break; 317 break;
300 case 14: 318 case 14:
301 PORTD |= (1<<6); // HI 319 gpio_write_pin_high(D6); // HI
302 break; 320 break;
303 case 15: 321 case 15:
304 PORTD |= (1<<7); // HI 322 gpio_write_pin_high(D7); // HI
305 break; 323 break;
306 case 16: 324 case 16:
307 PORTB |= (1<<4); // HI 325 gpio_write_pin_high(B4); // HI
308 break; 326 break;
309 } 327 }
310} 328}
diff --git a/keyboards/knops/mini/keymaps/default-gsm-newbs/keymap.c b/keyboards/knops/mini/keymaps/default-gsm-newbs/keymap.c
index 5a629f57ff..059c7a54db 100644
--- a/keyboards/knops/mini/keymaps/default-gsm-newbs/keymap.c
+++ b/keyboards/knops/mini/keymaps/default-gsm-newbs/keymap.c
@@ -135,51 +135,51 @@ void set_switch_led(int ledId, bool state) {
135 if(state) { 135 if(state) {
136 switch(ledId) { 136 switch(ledId) {
137 case 1: 137 case 1:
138 PORTD |= (1<<7); 138 gpio_write_pin_high(D7);
139 break; 139 break;
140 case 2: 140 case 2:
141 if((PINB & (1 << 7)) != 0) { 141 if(gpio_read_pin(B7)) {
142 PORTC |= (1<<6); 142 gpio_write_pin_high(C6);
143 } else { 143 } else {
144 PORTC |= (1<<7); 144 gpio_write_pin_high(C7);
145 } 145 }
146 break; 146 break;
147 case 3: 147 case 3:
148 PORTD |= (1<<4); 148 gpio_write_pin_high(D4);
149 break; 149 break;
150 case 4: 150 case 4:
151 PORTE |= (1<<6); 151 gpio_write_pin_high(E6);
152 break; 152 break;
153 case 5: 153 case 5:
154 PORTB |= (1<<4); 154 gpio_write_pin_high(B4);
155 break; 155 break;
156 case 6: 156 case 6:
157 PORTD |= (1<<6); 157 gpio_write_pin_high(D6);
158 break; 158 break;
159 } 159 }
160 } else { 160 } else {
161 switch(ledId) { 161 switch(ledId) {
162 case 1: 162 case 1:
163 PORTD &= ~(1<<7); 163 gpio_write_pin_low(D7);
164 break; 164 break;
165 case 2: 165 case 2:
166 if((PINB & (1 << 7)) != 0) { 166 if(gpio_read_pin(B7)) {
167 PORTC &= ~(1<<6); 167 gpio_write_pin_low(C6);
168 } else { 168 } else {
169 PORTC &= ~(1<<7); 169 gpio_write_pin_low(C7);
170 } 170 }
171 break; 171 break;
172 case 3: 172 case 3:
173 PORTD &= ~(1<<4); 173 gpio_write_pin_low(D4);
174 break; 174 break;
175 case 4: 175 case 4:
176 PORTE &= ~(1<<6); 176 gpio_write_pin_low(E6);
177 break; 177 break;
178 case 5: 178 case 5:
179 PORTB &= ~(1<<4); 179 gpio_write_pin_low(B4);
180 break; 180 break;
181 case 6: 181 case 6:
182 PORTD &= ~(1<<6); 182 gpio_write_pin_low(D6);
183 break; 183 break;
184 } 184 }
185 } 185 }
@@ -187,88 +187,88 @@ void set_switch_led(int ledId, bool state) {
187 187
188 188
189void set_layer_led(int layerId) { 189void set_layer_led(int layerId) {
190 PORTD |= (1<<5); 190 gpio_write_pin_high(D5);
191 PORTB &= ~(1<<6); 191 gpio_write_pin_low(B6);
192 PORTB |= (1<<0); 192 gpio_write_pin_high(B0);
193 switch(layerId) { 193 switch(layerId) {
194 case 0: 194 case 0:
195 PORTD &= ~(1<<5); 195 gpio_write_pin_low(D5);
196 break; 196 break;
197 case 1: 197 case 1:
198 PORTB |= (1<<6); 198 gpio_write_pin_high(B6);
199 break; 199 break;
200 case 2: 200 case 2:
201 PORTB &= ~(1<<0); 201 gpio_write_pin_low(B0);
202 break; 202 break;
203 } 203 }
204} 204}
205 205
206void led_init_ports_user(void) { 206void led_init_ports_user(void) {
207 // led voor switch #1 207 // led voor switch #1
208 DDRD |= (1<<7); 208 gpio_set_pin_output(D7);
209 PORTD &= ~(1<<7); 209 gpio_write_pin_low(D7);
210 210
211 // led voor switch #2 211 // led voor switch #2
212 DDRC |= (1<<6); 212 gpio_set_pin_output(C6);
213 DDRC |= (1<<7); 213 gpio_set_pin_output(C7);
214 PORTC &= ~(1<<6); 214 gpio_write_pin_low(C6);
215 PORTC &= ~(1<<7); 215 gpio_write_pin_low(C7);
216 216
217 // led voor switch #3 217 // led voor switch #3
218 DDRD |= (1<<4); 218 gpio_set_pin_output(D4);
219 PORTD &= ~(1<<4); 219 gpio_write_pin_low(D4);
220 220
221 // led voor switch #4 221 // led voor switch #4
222 DDRE |= (1<<6); 222 gpio_set_pin_output(E6);
223 PORTE &= ~(1<<6); 223 gpio_write_pin_low(E6);
224 224
225 // led voor switch #5 225 // led voor switch #5
226 DDRB |= (1<<4); 226 gpio_set_pin_output(B4);
227 PORTB &= ~(1<<4); 227 gpio_write_pin_low(B4);
228 228
229 // led voor switch #6 229 // led voor switch #6
230 DDRD |= (1<<6); 230 gpio_set_pin_output(D6);
231 PORTD &= ~(1<<6); 231 gpio_write_pin_low(D6);
232 232
233 /* 233 /*
234 DDRD |= (1<<7); 234 gpio_set_pin_output(D7);
235 PORTD |= (1<<7); 235 gpio_write_pin_high(D7);
236 236
237 DDRC |= (1<<6); 237 gpio_set_pin_output(C6);
238 PORTC |= (1<<6); 238 gpio_write_pin_high(C6);
239 239
240 DDRD |= (1<<4); 240 gpio_set_pin_output(D4);
241 PORTD |= (1<<4); 241 gpio_write_pin_high(D4);
242 242
243 DDRE |= (1<<6); 243 gpio_set_pin_output(E6);
244 PORTE |= (1<<6); 244 gpio_write_pin_high(E6);
245 245
246 DDRB |= (1<<4); 246 gpio_set_pin_output(B4);
247 PORTB |= (1<<4); 247 gpio_write_pin_high(B4);
248 248
249 DDRD |= (1<<6); 249 gpio_set_pin_output(D6);
250 PORTD |= (1<<6); 250 gpio_write_pin_high(D6);
251 // */ 251 // */
252 252
253 DDRD |= (1<<5); 253 gpio_set_pin_output(D5);
254 DDRB |= (1<<6); 254 gpio_set_pin_output(B6);
255 DDRB |= (1<<0); 255 gpio_set_pin_output(B0);
256 //led_set_layer(0); 256 //led_set_layer(0);
257} 257}
258 258
259void matrix_init_user(void) { 259void matrix_init_user(void) {
260 led_init_ports_user(); 260 led_init_ports_user();
261 261
262 PORTB |= (1 << 7); 262 gpio_write_pin_high(B7);
263 DDRB &= ~(1<<7); 263 gpio_set_pin_input(B7);
264 264
265 PORTD |= (1<<7); 265 gpio_write_pin_high(D7);
266 PORTC |= (1<<6); 266 gpio_write_pin_high(C6);
267 PORTC |= (1<<7); 267 gpio_write_pin_high(C7);
268 PORTD |= (1<<4); 268 gpio_write_pin_high(D4);
269 PORTE |= (1<<6); 269 gpio_write_pin_high(E6);
270 PORTB |= (1<<4); 270 gpio_write_pin_high(B4);
271 PORTD |= (1<<6); 271 gpio_write_pin_high(D6);
272 272
273 set_layer_led(0); 273 set_layer_led(0);
274} 274}
diff --git a/keyboards/knops/mini/keymaps/default/keymap.c b/keyboards/knops/mini/keymaps/default/keymap.c
index de990cc597..6f879c6738 100644
--- a/keyboards/knops/mini/keymaps/default/keymap.c
+++ b/keyboards/knops/mini/keymaps/default/keymap.c
@@ -61,51 +61,51 @@ void set_switch_led(int ledId, bool state) {
61 if(state) { 61 if(state) {
62 switch(ledId) { 62 switch(ledId) {
63 case 1: 63 case 1:
64 PORTD |= (1<<7); 64 gpio_write_pin_high(D7);
65 break; 65 break;
66 case 2: 66 case 2:
67 if((PINB & (1 << 7)) != 0) { 67 if(gpio_read_pin(B7)) {
68 PORTC |= (1<<6); 68 gpio_write_pin_high(C6);
69 } else { 69 } else {
70 PORTC |= (1<<7); 70 gpio_write_pin_high(C7);
71 } 71 }
72 break; 72 break;
73 case 3: 73 case 3:
74 PORTD |= (1<<4); 74 gpio_write_pin_high(D4);
75 break; 75 break;
76 case 4: 76 case 4:
77 PORTE |= (1<<6); 77 gpio_write_pin_high(E6);
78 break; 78 break;
79 case 5: 79 case 5:
80 PORTB |= (1<<4); 80 gpio_write_pin_high(B4);
81 break; 81 break;
82 case 6: 82 case 6:
83 PORTD |= (1<<6); 83 gpio_write_pin_high(D6);
84 break; 84 break;
85 } 85 }
86 } else { 86 } else {
87 switch(ledId) { 87 switch(ledId) {
88 case 1: 88 case 1:
89 PORTD &= ~(1<<7); 89 gpio_write_pin_low(D7);
90 break; 90 break;
91 case 2: 91 case 2:
92 if((PINB & (1 << 7)) != 0) { 92 if(gpio_read_pin(B7)) {
93 PORTC &= ~(1<<6); 93 gpio_write_pin_low(C6);
94 } else { 94 } else {
95 PORTC &= ~(1<<7); 95 gpio_write_pin_low(C7);
96 } 96 }
97 break; 97 break;
98 case 3: 98 case 3:
99 PORTD &= ~(1<<4); 99 gpio_write_pin_low(D4);
100 break; 100 break;
101 case 4: 101 case 4:
102 PORTE &= ~(1<<6); 102 gpio_write_pin_low(E6);
103 break; 103 break;
104 case 5: 104 case 5:
105 PORTB &= ~(1<<4); 105 gpio_write_pin_low(B4);
106 break; 106 break;
107 case 6: 107 case 6:
108 PORTD &= ~(1<<6); 108 gpio_write_pin_low(D6);
109 break; 109 break;
110 } 110 }
111 } 111 }
@@ -113,88 +113,88 @@ void set_switch_led(int ledId, bool state) {
113 113
114 114
115void set_layer_led(int layerId) { 115void set_layer_led(int layerId) {
116 PORTD |= (1<<5); 116 gpio_write_pin_high(D5);
117 PORTB &= ~(1<<6); 117 gpio_write_pin_low(B6);
118 PORTB |= (1<<0); 118 gpio_write_pin_high(B0);
119 switch(layerId) { 119 switch(layerId) {
120 case 0: 120 case 0:
121 PORTD &= ~(1<<5); 121 gpio_write_pin_low(D5);
122 break; 122 break;
123 case 1: 123 case 1:
124 PORTB |= (1<<6); 124 gpio_write_pin_high(B6);
125 break; 125 break;
126 case 2: 126 case 2:
127 PORTB &= ~(1<<0); 127 gpio_write_pin_low(B0);
128 break; 128 break;
129 } 129 }
130} 130}
131 131
132void led_init_ports_user(void) { 132void led_init_ports_user(void) {
133 // led voor switch #1 133 // led voor switch #1
134 DDRD |= (1<<7); 134 gpio_set_pin_output(D7);
135 PORTD &= ~(1<<7); 135 gpio_write_pin_low(D7);
136 136
137 // led voor switch #2 137 // led voor switch #2
138 DDRC |= (1<<6); 138 gpio_set_pin_output(C6);
139 DDRC |= (1<<7); 139 gpio_set_pin_output(C7);
140 PORTC &= ~(1<<6); 140 gpio_write_pin_low(C6);
141 PORTC &= ~(1<<7); 141 gpio_write_pin_low(C7);
142 142
143 // led voor switch #3 143 // led voor switch #3
144 DDRD |= (1<<4); 144 gpio_set_pin_output(D4);
145 PORTD &= ~(1<<4); 145 gpio_write_pin_low(D4);
146 146
147 // led voor switch #4 147 // led voor switch #4
148 DDRE |= (1<<6); 148 gpio_set_pin_output(E6);
149 PORTE &= ~(1<<6); 149 gpio_write_pin_low(E6);
150 150
151 // led voor switch #5 151 // led voor switch #5
152 DDRB |= (1<<4); 152 gpio_set_pin_output(B4);
153 PORTB &= ~(1<<4); 153 gpio_write_pin_low(B4);
154 154
155 // led voor switch #6 155 // led voor switch #6
156 DDRD |= (1<<6); 156 gpio_set_pin_output(D6);
157 PORTD &= ~(1<<6); 157 gpio_write_pin_low(D6);
158 158
159 /* 159 /*
160 DDRD |= (1<<7); 160 gpio_set_pin_output(D7);
161 PORTD |= (1<<7); 161 gpio_write_pin_high(D7);
162 162
163 DDRC |= (1<<6); 163 gpio_set_pin_output(C6);
164 PORTC |= (1<<6); 164 gpio_write_pin_high(C6);
165 165
166 DDRD |= (1<<4); 166 gpio_set_pin_output(D4);
167 PORTD |= (1<<4); 167 gpio_write_pin_high(D4);
168 168
169 DDRE |= (1<<6); 169 gpio_set_pin_output(E6);
170 PORTE |= (1<<6); 170 gpio_write_pin_high(E6);
171 171
172 DDRB |= (1<<4); 172 gpio_set_pin_output(B4);
173 PORTB |= (1<<4); 173 gpio_write_pin_high(B4);
174 174
175 DDRD |= (1<<6); 175 gpio_set_pin_output(D6);
176 PORTD |= (1<<6); 176 gpio_write_pin_high(D6);
177 // */ 177 // */
178 178
179 DDRD |= (1<<5); 179 gpio_set_pin_output(D5);
180 DDRB |= (1<<6); 180 gpio_set_pin_output(B6);
181 DDRB |= (1<<0); 181 gpio_set_pin_output(B0);
182 //led_set_layer(0); 182 //led_set_layer(0);
183} 183}
184 184
185void matrix_init_user(void) { 185void matrix_init_user(void) {
186 led_init_ports_user(); 186 led_init_ports_user();
187 187
188 PORTB |= (1 << 7); 188 gpio_write_pin_high(B7);
189 DDRB &= ~(1<<7); 189 gpio_set_pin_input(B7);
190 190
191 PORTD |= (1<<7); 191 gpio_write_pin_high(D7);
192 PORTC |= (1<<6); 192 gpio_write_pin_high(C6);
193 PORTC |= (1<<7); 193 gpio_write_pin_high(C7);
194 PORTD |= (1<<4); 194 gpio_write_pin_high(D4);
195 PORTE |= (1<<6); 195 gpio_write_pin_high(E6);
196 PORTB |= (1<<4); 196 gpio_write_pin_high(B4);
197 PORTD |= (1<<6); 197 gpio_write_pin_high(D6);
198 198
199 set_layer_led(0); 199 set_layer_led(0);
200} 200}
diff --git a/keyboards/lazydesigners/the50/the50.c b/keyboards/lazydesigners/the50/the50.c
index 35c678fd5e..bf0391bfb4 100644
--- a/keyboards/lazydesigners/the50/the50.c
+++ b/keyboards/lazydesigners/the50/the50.c
@@ -1,9 +1,12 @@
1#include "the50.h" 1#include "the50.h"
2 2
3#define THE50_LED_PIN B7
4
3void the50_led_on(void) { 5void the50_led_on(void) {
4 DDRB |= (1 << 7); PORTB &= ~(1 << 7); 6 gpio_set_pin_output(THE50_LED_PIN);
7 gpio_write_pin_low(THE50_LED_PIN);
5} 8}
6 9
7void the50_led_off(void) { 10void the50_led_off(void) {
8 DDRB &= ~(1 << 7); PORTB &= ~(1 << 7); 11 gpio_set_pin_input(THE50_LED_PIN);
9} 12}
diff --git a/keyboards/mitosis/mitosis.c b/keyboards/mitosis/mitosis.c
index ea3d1c99d7..2d3627b56b 100644
--- a/keyboards/mitosis/mitosis.c
+++ b/keyboards/mitosis/mitosis.c
@@ -1,10 +1,12 @@
1#include "mitosis.h" 1#include "mitosis.h"
2 2
3void led_init(void) { 3void led_init(void) {
4 DDRD |= (1<<1); // Pin to green, set as output 4 gpio_set_pin_output(MITOSIS_GREEN_LED_PIN);
5 PORTD |= (1<<1); // Turn it off 5 gpio_write_pin_high(MITOSIS_GREEN_LED_PIN);
6 DDRF |= (1<<4) | (1<<5); // Pins to red and blue, set as output 6 gpio_set_pin_output(MITOSIS_BLUE_LED_PIN);
7 PORTF |= (1<<4) | (1<<5); // Turn them off 7 gpio_write_pin_high(MITOSIS_BLUE_LED_PIN);
8 gpio_set_pin_output(MITOSIS_RED_LED_PIN);
9 gpio_write_pin_high(MITOSIS_RED_LED_PIN);
8} 10}
9 11
10void matrix_init_kb(void) { 12void matrix_init_kb(void) {
diff --git a/keyboards/mitosis/mitosis.h b/keyboards/mitosis/mitosis.h
index 04ef56503f..b194115703 100644
--- a/keyboards/mitosis/mitosis.h
+++ b/keyboards/mitosis/mitosis.h
@@ -2,12 +2,16 @@
2 2
3#include "quantum.h" 3#include "quantum.h"
4 4
5#define red_led_off PORTF |= (1<<5) 5#define MITOSIS_RED_LED_PIN F5
6#define red_led_on PORTF &= ~(1<<5) 6#define MITOSIS_GREEN_LED_PIN D1
7#define blu_led_off PORTF |= (1<<4) 7#define MITOSIS_BLUE_LED_PIN F4
8#define blu_led_on PORTF &= ~(1<<4) 8
9#define grn_led_off PORTD |= (1<<1) 9#define red_led_off gpio_write_pin_high(MITOSIS_RED_LED_PIN)
10#define grn_led_on PORTD &= ~(1<<1) 10#define red_led_on gpio_write_pin_low(MITOSIS_RED_LED_PIN)
11#define blu_led_off gpio_write_pin_high(MITOSIS_BLUE_LED_PIN)
12#define blu_led_on gpio_write_pin_low(MITOSIS_BLUE_LED_PIN)
13#define grn_led_off gpio_write_pin_high(MITOSIS_GREEN_LED_PIN)
14#define grn_led_on gpio_write_pin_low(MITOSIS_GREEN_LED_PIN)
11 15
12#define set_led_off red_led_off; grn_led_off; blu_led_off 16#define set_led_off red_led_off; grn_led_off; blu_led_off
13#define set_led_red red_led_on; grn_led_off; blu_led_off 17#define set_led_red red_led_on; grn_led_off; blu_led_off
@@ -17,27 +21,3 @@
17#define set_led_magenta red_led_on; grn_led_off; blu_led_on 21#define set_led_magenta red_led_on; grn_led_off; blu_led_on
18#define set_led_cyan red_led_off; grn_led_on; blu_led_on 22#define set_led_cyan red_led_off; grn_led_on; blu_led_on
19#define set_led_white red_led_on; grn_led_on; blu_led_on 23#define set_led_white red_led_on; grn_led_on; blu_led_on
20
21/*
22#define LED_B 5
23#define LED_R 6
24#define LED_G 7
25
26#define all_leds_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
27
28#define red_led_on PORTF |= (1<<LED_R)
29#define red_led_off PORTF &= ~(1<<LED_R)
30#define grn_led_on PORTF |= (1<<LED_G)
31#define grn_led_off PORTF &= ~(1<<LED_G)
32#define blu_led_on PORTF |= (1<<LED_B)
33#define blu_led_off PORTF &= ~(1<<LED_B)
34
35#define set_led_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
36#define set_led_red PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_G) | (1<<LED_R)
37#define set_led_blue PORTF = PORTF & ~(1<<LED_G) & ~(1<<LED_R) | (1<<LED_B)
38#define set_led_green PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_R) | (1<<LED_G)
39#define set_led_yellow PORTF = PORTF & ~(1<<LED_B) | (1<<LED_R) | (1<<LED_G)
40#define set_led_magenta PORTF = PORTF & ~(1<<LED_G) | (1<<LED_R) | (1<<LED_B)
41#define set_led_cyan PORTF = PORTF & ~(1<<LED_R) | (1<<LED_B) | (1<<LED_G)
42#define set_led_white PORTF |= (1<<LED_B) | (1<<LED_R) | (1<<LED_G)
43*/
diff --git a/keyboards/noxary/268/keymaps/sixtyeight/keymap.c b/keyboards/noxary/268/keymaps/sixtyeight/keymap.c
index 3527cf7ccc..ab67958264 100644
--- a/keyboards/noxary/268/keymaps/sixtyeight/keymap.c
+++ b/keyboards/noxary/268/keymaps/sixtyeight/keymap.c
@@ -72,10 +72,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
72 72
73bool led_update_user(led_t led_state) { 73bool led_update_user(led_t led_state) {
74 if (led_state.caps_lock) { 74 if (led_state.caps_lock) {
75 DDRB |= (1 << 6); PORTB |= (1 << 6); 75 gpio_set_pin_output(B6);
76 gpio_write_pin_high(B6);
76 } 77 }
77 else { 78 else {
78 DDRB &= ~(1 << 6); PORTB &= ~(1 << 6); 79 gpio_set_pin_input(B6);
79 } 80 }
80 return false; 81 return false;
81} 82}
diff --git a/keyboards/org60/org60.h b/keyboards/org60/org60.h
index 49687c8716..1fa92dceb2 100644
--- a/keyboards/org60/org60.h
+++ b/keyboards/org60/org60.h
@@ -3,6 +3,9 @@
3#include "quantum.h" 3#include "quantum.h"
4#include "led.h" 4#include "led.h"
5 5
6#define ORG60_CAPS_LOCK_LED_PIN B2
7#define ORG60_BACKLIGHT_PIN F5
8
6/* Org60 LEDs 9/* Org60 LEDs
7 * GPIO pads 10 * GPIO pads
8 * 0 F7 not connected 11 * 0 F7 not connected
@@ -12,8 +15,18 @@
12 * B2 Capslock LED 15 * B2 Capslock LED
13 * B0 not connected 16 * B0 not connected
14 */ 17 */
15inline void org60_caps_led_on(void) { DDRB |= (1<<2); PORTB &= ~(1<<2); } 18inline void org60_caps_led_on(void) {
16inline void org60_bl_led_on(void) { DDRF |= (1<<5); PORTF &= ~(1<<5); } 19 gpio_set_pin_output(ORG60_CAPS_LOCK_LED_PIN);
20 gpio_write_pin_low(ORG60_CAPS_LOCK_LED_PIN);
21}
22inline void org60_bl_led_on(void) {
23 gpio_set_pin_output(ORG60_BACKLIGHT_PIN);
24 gpio_write_pin_low(ORG60_BACKLIGHT_PIN);
25}
17 26
18inline void org60_caps_led_off(void) { DDRB &= ~(1<<2); PORTB &= ~(1<<2); } 27inline void org60_caps_led_off(void) {
19inline void org60_bl_led_off(void) { DDRF &= ~(1<<5); PORTF &= ~(1<<5); } 28 gpio_set_pin_input(ORG60_CAPS_LOCK_LED_PIN);
29}
30inline void org60_bl_led_off(void) {
31 gpio_set_pin_input(ORG60_BACKLIGHT_PIN);
32}
diff --git a/keyboards/planck/light/light.c b/keyboards/planck/light/light.c
index 44bd89dc11..8bbb8119c9 100644
--- a/keyboards/planck/light/light.c
+++ b/keyboards/planck/light/light.c
@@ -99,8 +99,8 @@ led_config_t g_led_config = { {
99void matrix_init_kb(void) { 99void matrix_init_kb(void) {
100 100
101 // Turn status LED on 101 // Turn status LED on
102 DDRD |= (1<<6); 102 gpio_set_pin_output(D6);
103 PORTD |= (1<<6); 103 gpio_write_pin_high(D6);
104 104
105 matrix_init_user(); 105 matrix_init_user();
106} 106}
diff --git a/keyboards/satt/comet46/keymaps/default-rgbled/keymap.c b/keyboards/satt/comet46/keymaps/default-rgbled/keymap.c
index 1e96bd7fbc..f6fb044049 100644
--- a/keyboards/satt/comet46/keymaps/default-rgbled/keymap.c
+++ b/keyboards/satt/comet46/keymaps/default-rgbled/keymap.c
@@ -146,18 +146,20 @@ layer_state_t layer_state_set_user(layer_state_t state) {
146 146
147// settings for LED on receiver 147// settings for LED on receiver
148void led_init(void) { 148void led_init(void) {
149 DDRD |= (1<<1); 149 gpio_set_pin_output(D1);
150 PORTD |= (1<<1); 150 gpio_write_pin_high(D1);
151 DDRF |= (1<<4) | (1<<5); 151 gpio_set_pin_output(F4);
152 PORTF |= (1<<4) | (1<<5); 152 gpio_write_pin_high(F4);
153 gpio_set_pin_output(F5);
154 gpio_write_pin_high(F5);
153} 155}
154 156
155#define red_led_off PORTF |= (1<<5) 157#define red_led_off gpio_write_pin_high(F5)
156#define red_led_on PORTF &= ~(1<<5) 158#define red_led_on gpio_write_pin_low(F5)
157#define blu_led_off PORTF |= (1<<4) 159#define blu_led_off gpio_write_pin_high(F4)
158#define blu_led_on PORTF &= ~(1<<4) 160#define blu_led_on gpio_write_pin_low(F4)
159#define grn_led_off PORTD |= (1<<1) 161#define grn_led_off gpio_write_pin_high(D1)
160#define grn_led_on PORTD &= ~(1<<1) 162#define grn_led_on gpio_write_pin_low(D1)
161 163
162#define set_led_off red_led_off; grn_led_off; blu_led_off 164#define set_led_off red_led_off; grn_led_off; blu_led_off
163#define set_led_red red_led_on; grn_led_off; blu_led_off 165#define set_led_red red_led_on; grn_led_off; blu_led_off
diff --git a/keyboards/sirius/uni660/rev1/rev1.c b/keyboards/sirius/uni660/rev1/rev1.c
index 7cc75ee22a..9bfc46c37e 100644
--- a/keyboards/sirius/uni660/rev1/rev1.c
+++ b/keyboards/sirius/uni660/rev1/rev1.c
@@ -1,12 +1,12 @@
1#include "rev1.h" 1#include "rev1.h"
2 2
3void led_init(void) { 3void led_init(void) {
4 setPinOutput(D1); // Pin to green, set as output 4 gpio_set_pin_output(UNI660_GREEN_LED_PIN);
5 writePinHigh(D1); // Turn it off 5 gpio_write_pin_high(UNI660_GREEN_LED_PIN);
6 setPinOutput(F4); // Pins to red and blue, set as output 6 gpio_set_pin_output(UNI660_BLUE_LED_PIN);
7 setPinOutput(F5); 7 gpio_write_pin_high(UNI660_BLUE_LED_PIN);
8 writePinHigh(F4); // Turn them off 8 gpio_set_pin_output(UNI660_RED_LED_PIN);
9 writePinHigh(F5); 9 gpio_write_pin_high(UNI660_RED_LED_PIN);
10} 10}
11 11
12void matrix_init_kb(void) { 12void matrix_init_kb(void) {
diff --git a/keyboards/sirius/uni660/rev1/rev1.h b/keyboards/sirius/uni660/rev1/rev1.h
index 06a7176fbd..5baf9d4236 100644
--- a/keyboards/sirius/uni660/rev1/rev1.h
+++ b/keyboards/sirius/uni660/rev1/rev1.h
@@ -2,12 +2,16 @@
2 2
3#include "quantum.h" 3#include "quantum.h"
4 4
5#define red_led_off writePinHigh(F5) 5#define UNI660_RED_LED_PIN F5
6#define red_led_on writePinLow(F5) 6#define UNI660_GREEN_LED_PIN D1
7#define blu_led_off writePinHigh(F4) 7#define UNI660_BLUE_LED_PIN F4
8#define blu_led_on writePinLow(F4) 8
9#define grn_led_off writePinHigh(D1) 9#define red_led_off gpio_write_pin_high(UNI660_RED_LED_PIN)
10#define grn_led_on writePinLow(D1) 10#define red_led_on gpio_write_pin_low(UNI660_RED_LED_PIN)
11#define blu_led_off gpio_write_pin_high(UNI660_BLUE_LED_PIN)
12#define blu_led_on gpio_write_pin_low(UNI660_BLUE_LED_PIN)
13#define grn_led_off gpio_write_pin_high(UNI660_GREEN_LED_PIN)
14#define grn_led_on gpio_write_pin_low(UNI660_GREEN_LED_PIN)
11 15
12#define set_led_off red_led_off; grn_led_off; blu_led_off 16#define set_led_off red_led_off; grn_led_off; blu_led_off
13#define set_led_red red_led_on; grn_led_off; blu_led_off 17#define set_led_red red_led_on; grn_led_off; blu_led_off
@@ -17,27 +21,3 @@
17#define set_led_magenta red_led_on; grn_led_off; blu_led_on 21#define set_led_magenta red_led_on; grn_led_off; blu_led_on
18#define set_led_cyan red_led_off; grn_led_on; blu_led_on 22#define set_led_cyan red_led_off; grn_led_on; blu_led_on
19#define set_led_white red_led_on; grn_led_on; blu_led_on 23#define set_led_white red_led_on; grn_led_on; blu_led_on
20
21/*
22#define LED_B 5
23#define LED_R 6
24#define LED_G 7
25
26#define all_leds_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
27
28#define red_led_on PORTF |= (1<<LED_R)
29#define red_led_off PORTF &= ~(1<<LED_R)
30#define grn_led_on PORTF |= (1<<LED_G)
31#define grn_led_off PORTF &= ~(1<<LED_G)
32#define blu_led_on PORTF |= (1<<LED_B)
33#define blu_led_off PORTF &= ~(1<<LED_B)
34
35#define set_led_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
36#define set_led_red PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_G) | (1<<LED_R)
37#define set_led_blue PORTF = PORTF & ~(1<<LED_G) & ~(1<<LED_R) | (1<<LED_B)
38#define set_led_green PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_R) | (1<<LED_G)
39#define set_led_yellow PORTF = PORTF & ~(1<<LED_B) | (1<<LED_R) | (1<<LED_G)
40#define set_led_magenta PORTF = PORTF & ~(1<<LED_G) | (1<<LED_R) | (1<<LED_B)
41#define set_led_cyan PORTF = PORTF & ~(1<<LED_R) | (1<<LED_B) | (1<<LED_G)
42#define set_led_white PORTF |= (1<<LED_B) | (1<<LED_R) | (1<<LED_G)
43*/
diff --git a/keyboards/sirius/uni660/rev2/rev2.c b/keyboards/sirius/uni660/rev2/rev2.c
index 2c2515c0ed..9207ed1e4f 100644
--- a/keyboards/sirius/uni660/rev2/rev2.c
+++ b/keyboards/sirius/uni660/rev2/rev2.c
@@ -1,12 +1,12 @@
1#include "rev2.h" 1#include "rev2.h"
2 2
3void led_init(void) { 3void led_init(void) {
4 setPinOutput(D1); // Pin to green, set as output 4 gpio_set_pin_output(UNI660_GREEN_LED_PIN);
5 writePinHigh(D1); // Turn it off 5 gpio_write_pin_high(UNI660_GREEN_LED_PIN);
6 setPinOutput(F4); // Pins to red and blue, set as output 6 gpio_set_pin_output(UNI660_BLUE_LED_PIN);
7 setPinOutput(F5); 7 gpio_write_pin_high(UNI660_BLUE_LED_PIN);
8 writePinHigh(F4); // Turn them off 8 gpio_set_pin_output(UNI660_RED_LED_PIN);
9 writePinHigh(F5); 9 gpio_write_pin_high(UNI660_RED_LED_PIN);
10} 10}
11 11
12void matrix_init_kb(void) { 12void matrix_init_kb(void) {
diff --git a/keyboards/sirius/uni660/rev2/rev2.h b/keyboards/sirius/uni660/rev2/rev2.h
index 06a7176fbd..5baf9d4236 100644
--- a/keyboards/sirius/uni660/rev2/rev2.h
+++ b/keyboards/sirius/uni660/rev2/rev2.h
@@ -2,12 +2,16 @@
2 2
3#include "quantum.h" 3#include "quantum.h"
4 4
5#define red_led_off writePinHigh(F5) 5#define UNI660_RED_LED_PIN F5
6#define red_led_on writePinLow(F5) 6#define UNI660_GREEN_LED_PIN D1
7#define blu_led_off writePinHigh(F4) 7#define UNI660_BLUE_LED_PIN F4
8#define blu_led_on writePinLow(F4) 8
9#define grn_led_off writePinHigh(D1) 9#define red_led_off gpio_write_pin_high(UNI660_RED_LED_PIN)
10#define grn_led_on writePinLow(D1) 10#define red_led_on gpio_write_pin_low(UNI660_RED_LED_PIN)
11#define blu_led_off gpio_write_pin_high(UNI660_BLUE_LED_PIN)
12#define blu_led_on gpio_write_pin_low(UNI660_BLUE_LED_PIN)
13#define grn_led_off gpio_write_pin_high(UNI660_GREEN_LED_PIN)
14#define grn_led_on gpio_write_pin_low(UNI660_GREEN_LED_PIN)
11 15
12#define set_led_off red_led_off; grn_led_off; blu_led_off 16#define set_led_off red_led_off; grn_led_off; blu_led_off
13#define set_led_red red_led_on; grn_led_off; blu_led_off 17#define set_led_red red_led_on; grn_led_off; blu_led_off
@@ -17,27 +21,3 @@
17#define set_led_magenta red_led_on; grn_led_off; blu_led_on 21#define set_led_magenta red_led_on; grn_led_off; blu_led_on
18#define set_led_cyan red_led_off; grn_led_on; blu_led_on 22#define set_led_cyan red_led_off; grn_led_on; blu_led_on
19#define set_led_white red_led_on; grn_led_on; blu_led_on 23#define set_led_white red_led_on; grn_led_on; blu_led_on
20
21/*
22#define LED_B 5
23#define LED_R 6
24#define LED_G 7
25
26#define all_leds_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
27
28#define red_led_on PORTF |= (1<<LED_R)
29#define red_led_off PORTF &= ~(1<<LED_R)
30#define grn_led_on PORTF |= (1<<LED_G)
31#define grn_led_off PORTF &= ~(1<<LED_G)
32#define blu_led_on PORTF |= (1<<LED_B)
33#define blu_led_off PORTF &= ~(1<<LED_B)
34
35#define set_led_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
36#define set_led_red PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_G) | (1<<LED_R)
37#define set_led_blue PORTF = PORTF & ~(1<<LED_G) & ~(1<<LED_R) | (1<<LED_B)
38#define set_led_green PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_R) | (1<<LED_G)
39#define set_led_yellow PORTF = PORTF & ~(1<<LED_B) | (1<<LED_R) | (1<<LED_G)
40#define set_led_magenta PORTF = PORTF & ~(1<<LED_G) | (1<<LED_R) | (1<<LED_B)
41#define set_led_cyan PORTF = PORTF & ~(1<<LED_R) | (1<<LED_B) | (1<<LED_G)
42#define set_led_white PORTF |= (1<<LED_B) | (1<<LED_R) | (1<<LED_G)
43*/
diff --git a/keyboards/sirius/unigo66/main.c b/keyboards/sirius/unigo66/main.c
index 4f8e2f0c94..577ba1be99 100644
--- a/keyboards/sirius/unigo66/main.c
+++ b/keyboards/sirius/unigo66/main.c
@@ -1,7 +1,5 @@
1#include <avr/io.h>
2#include <avr/wdt.h> 1#include <avr/wdt.h>
3#include <avr/power.h> 2#include <avr/power.h>
4#include <util/delay.h>
5 3
6// LUFA 4// LUFA
7#include "lufa.h" 5#include "lufa.h"
@@ -9,6 +7,8 @@
9#include "sendchar.h" 7#include "sendchar.h"
10#include "debug.h" 8#include "debug.h"
11#include "keyboard.h" 9#include "keyboard.h"
10#include "gpio.h"
11#include "wait.h"
12#include "led.h" 12#include "led.h"
13 13
14/* LED ping configuration */ 14/* LED ping configuration */
@@ -16,16 +16,16 @@
16//#define LEONARDO_LED 16//#define LEONARDO_LED
17#if defined(TMK_LED) 17#if defined(TMK_LED)
18// For TMK converter and Teensy 18// For TMK converter and Teensy
19#define LED_TX_INIT (DDRD |= (1<<6)) 19#define LED_TX_INIT gpio_set_pin_output(D6)
20#define LED_TX_ON (PORTD |= (1<<6)) 20#define LED_TX_ON gpio_write_pin_high(D6)
21#define LED_TX_OFF (PORTD &= ~(1<<6)) 21#define LED_TX_OFF gpio_write_pin_low(D6)
22#define LED_TX_TOGGLE (PORTD ^= (1<<6)) 22#define LED_TX_TOGGLE gpio_toggle_pin(D6)
23#elif defined(LEONARDO_LED) 23#elif defined(LEONARDO_LED)
24// For Leonardo(TX LED) 24// For Leonardo(TX LED)
25#define LED_TX_INIT (DDRD |= (1<<5)) 25#define LED_TX_INIT gpio_set_pin_output(D5)
26#define LED_TX_ON (PORTD &= ~(1<<5)) 26#define LED_TX_ON gpio_write_pin_low(D5)
27#define LED_TX_OFF (PORTD |= (1<<5)) 27#define LED_TX_OFF gpio_write_pin_high(D5)
28#define LED_TX_TOGGLE (PORTD ^= (1<<5)) 28#define LED_TX_TOGGLE gpio_toggle_pin(D5)
29#else 29#else
30#define LED_TX_INIT 30#define LED_TX_INIT
31#define LED_TX_ON 31#define LED_TX_ON
diff --git a/keyboards/sixkeyboard/matrix.c b/keyboards/sixkeyboard/matrix.c
index ddbd41ac55..24cb647297 100644
--- a/keyboards/sixkeyboard/matrix.c
+++ b/keyboards/sixkeyboard/matrix.c
@@ -71,13 +71,12 @@ uint8_t matrix_cols(void)
71 71
72void matrix_init(void) 72void matrix_init(void)
73{ 73{
74 74 gpio_set_pin_input_high(C7);
75 DDRC &= ~(1<<7); 75 gpio_set_pin_input_high(B5);
76 PORTC |= (1<<7); 76 gpio_set_pin_input_high(B7);
77 DDRB &= ~(1<<7 | 1<<5); 77 gpio_set_pin_input_high(D1);
78 PORTB |= (1<<7 | 1<<5); 78 gpio_set_pin_input_high(D4);
79 DDRD &= ~(1<<6 | 1<<4 | 1<<1); 79 gpio_set_pin_input_high(D6);
80 PORTD |= (1<<6 | 1<<4 | 1<<1);
81 80
82 for (uint8_t i=0; i < MATRIX_ROWS; i++) { 81 for (uint8_t i=0; i < MATRIX_ROWS; i++) {
83 matrix[i] = 0; 82 matrix[i] = 0;
diff --git a/keyboards/sixkeyboard/sixkeyboard.c b/keyboards/sixkeyboard/sixkeyboard.c
index 7667ee7f44..5a5c818d13 100644
--- a/keyboards/sixkeyboard/sixkeyboard.c
+++ b/keyboards/sixkeyboard/sixkeyboard.c
@@ -4,27 +4,26 @@ void matrix_init_kb(void) {
4 // put your keyboard start-up code here 4 // put your keyboard start-up code here
5 // runs once when the firmware starts up 5 // runs once when the firmware starts up
6 6
7 DDRC |= (1<<4); 7 gpio_set_pin_output(C4);
8 PORTC &= ~(1<<4); 8 gpio_write_pin_low(C4);
9 9
10 gpio_set_pin_output(C6);
11 gpio_write_pin_low(C6);
10 12
11 DDRC |= (1<<6); 13 gpio_set_pin_output(B6);
12 PORTC &= ~(1<<6); 14 gpio_write_pin_low(B6);
13 15
14 DDRB |= (1<<6); 16 gpio_set_pin_output(B4);
15 PORTB &= ~(1<<6); 17 gpio_write_pin_low(B4);
16 18
17 DDRB |= (1<<4); 19 gpio_set_pin_output(D5);
18 PORTB &= ~(1<<4); 20 gpio_write_pin_low(D5);
19 21
20 DDRD |= (1<<5); 22 gpio_set_pin_output(D2);
21 PORTD &= ~(1<<5); 23 gpio_write_pin_low(D2);
22 24
23 DDRD |= (1<<2); 25 gpio_set_pin_output(D3);
24 PORTD &= ~(1<<2); 26 gpio_write_pin_low(D3);
25
26 DDRD |= (1<<3);
27 PORTD &= ~(1<<3);
28 27
29 matrix_init_user(); 28 matrix_init_user();
30}; \ No newline at end of file 29}; \ No newline at end of file
diff --git a/keyboards/tmo50/tmo50.c b/keyboards/tmo50/tmo50.c
index 80eb286f45..635b9db003 100644
--- a/keyboards/tmo50/tmo50.c
+++ b/keyboards/tmo50/tmo50.c
@@ -19,14 +19,14 @@ void matrix_init_kb(void) {
19 // put your keyboard start-up code here 19 // put your keyboard start-up code here
20 // runs once when the firmware starts up 20 // runs once when the firmware starts up
21 21
22 DDRB |= (1 << PB0); //init B0 22 gpio_set_pin_output(B0);
23 PORTB &= ~(1 << PB0); //turn on B0 23 gpio_write_pin_low(B0);
24 DDRB |= (1 << PB1); 24 gpio_set_pin_output(B1);
25 PORTB |= (1<<PB1); //turn off B1 25 gpio_write_pin_high(B1);
26 DDRB |= (1 << PB2); 26 gpio_set_pin_output(B2);
27 PORTB |= (1<<PB2); 27 gpio_write_pin_high(B2);
28 DDRB |= (1 << PB3); 28 gpio_set_pin_output(B3);
29 PORTB |= (1<<PB3); 29 gpio_write_pin_high(B3);
30 30
31 matrix_init_user(); 31 matrix_init_user();
32} 32}
@@ -49,32 +49,16 @@ bool process_indicator_led_kb(layer_state_t state)
49 if(process_indicator_led_user(state)) 49 if(process_indicator_led_user(state))
50 { 50 {
51 // if on layer 0, turn on B0 LED, otherwise off. 51 // if on layer 0, turn on B0 LED, otherwise off.
52 if (get_highest_layer(state) == 0) { 52 gpio_write_pin(B0, get_highest_layer(state) != 0);
53 PORTB &= ~(1<<PB0);
54 } else {
55 PORTB |= (1<<PB0);
56 }
57 53
58 // if on layer 1, turn on B1 LED, otherwise off. 54 // if on layer 1, turn on B1 LED, otherwise off.
59 if (get_highest_layer(state) == 1) { 55 gpio_write_pin(B1, get_highest_layer(state) != 1);
60 PORTB &= ~(1<<PB1);
61 } else {
62 PORTB |= (1<<PB1);
63 }
64 56
65 // if on layer 2, turn on B2 LED, otherwise off. 57 // if on layer 2, turn on B2 LED, otherwise off.
66 if (get_highest_layer(state) == 2) { 58 gpio_write_pin(B2, get_highest_layer(state) != 2);
67 PORTB &= ~(1<<PB2);
68 } else {
69 PORTB |= (1<<PB2);
70 }
71 59
72 // if on layer 3, turn on B3 LED, otherwise off. 60 // if on layer 3, turn on B3 LED, otherwise off.
73 if (get_highest_layer(state) == 3) { 61 gpio_write_pin(B3, get_highest_layer(state) != 3);
74 PORTB &= ~(1<<PB3);
75 } else {
76 PORTB |= (1<<PB3);
77 }
78 } 62 }
79 63
80 return true; 64 return true;
diff --git a/keyboards/v60_type_r/config.h b/keyboards/v60_type_r/config.h
index 4354cb32c3..c8b7da2ae8 100644
--- a/keyboards/v60_type_r/config.h
+++ b/keyboards/v60_type_r/config.h
@@ -19,9 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20#define RGB_STEP 16 20#define RGB_STEP 16
21 21
22#define RGB_RED_PIN PF6 22#define RGB_RED_PIN F6
23#define RGB_GREEN_PIN PF5 23#define RGB_GREEN_PIN F5
24#define RGB_BLUE_PIN PF4 24#define RGB_BLUE_PIN F4
25 25
26/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ 26/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
27#define LOCKING_SUPPORT_ENABLE 27#define LOCKING_SUPPORT_ENABLE
diff --git a/keyboards/v60_type_r/v60_type_r.c b/keyboards/v60_type_r/v60_type_r.c
index 540c5ec6ec..6bace804e2 100644
--- a/keyboards/v60_type_r/v60_type_r.c
+++ b/keyboards/v60_type_r/v60_type_r.c
@@ -115,18 +115,22 @@ void rgb_timer_init(void) {
115} 115}
116 116
117void rgb_init(void) { 117void rgb_init(void) {
118 DDRF |= (_BV(PF6) | _BV(PF5) | _BV(PF4)); 118 gpio_set_pin_output(F4);
119 PORTF |= (_BV(PF6) | _BV(PF5) | _BV(PF4)); 119 gpio_set_pin_output(F5);
120 gpio_set_pin_output(F6);
121 gpio_write_pin_high(F4);
122 gpio_write_pin_high(F5);
123 gpio_write_pin_high(F6);
120 124
121 rgb_timer_init(); 125 rgb_timer_init();
122} 126}
123 127
124void set_rgb_pin_on(uint8_t pin) { 128void set_rgb_pin_on(pin_t pin) {
125 PORTF &= ~_BV(pin); 129 gpio_write_pin_low(pin);
126} 130}
127 131
128void set_rgb_pin_off(uint8_t pin) { 132void set_rgb_pin_off(pin_t pin) {
129 PORTF |= _BV(pin); 133 gpio_write_pin_high(pin);
130} 134}
131 135
132ISR(TIMER3_COMPA_vect) 136ISR(TIMER3_COMPA_vect)
diff --git a/keyboards/viktus/omnikey_bh/keymaps/default/keymap.c b/keyboards/viktus/omnikey_bh/keymaps/default/keymap.c
index e5fb6bf902..ad63d05023 100644
--- a/keyboards/viktus/omnikey_bh/keymaps/default/keymap.c
+++ b/keyboards/viktus/omnikey_bh/keymaps/default/keymap.c
@@ -23,24 +23,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
23}; 23};
24 24
25bool led_update_user(led_t led_state) { 25bool led_update_user(led_t led_state) {
26 DDRB |= (1 << 4) | (1 << 5) | (1 << 6); 26 gpio_set_pin_output(B4);
27 gpio_set_pin_output(B5);
28 gpio_set_pin_output(B6);
27 29
28 if (led_state.num_lock) { 30 gpio_write_pin(B4, led_state.num_lock);
29 PORTB |= (1 << 4); 31 gpio_write_pin(B5, led_state.caps_lock);
30 } else { 32 gpio_write_pin(B6, led_state.scroll_lock);
31 PORTB &= ~(1 << 4);
32 }
33 33
34 if (led_state.caps_lock) {
35 PORTB |= (1 << 5);
36 } else {
37 PORTB &= ~(1 << 5);
38 }
39
40 if (led_state.scroll_lock) {
41 PORTB |= (1 << 6);
42 } else {
43 PORTB &= ~(1 << 6);
44 }
45 return false; 34 return false;
46} 35}
diff --git a/keyboards/wilba_tech/wt_rgb_backlight.c b/keyboards/wilba_tech/wt_rgb_backlight.c
index 02bcdd610b..936286c2ee 100644
--- a/keyboards/wilba_tech/wt_rgb_backlight.c
+++ b/keyboards/wilba_tech/wt_rgb_backlight.c
@@ -2629,15 +2629,12 @@ void backlight_debug_led( bool state )
2629{ 2629{
2630 if (state) 2630 if (state)
2631 { 2631 {
2632 // Output high. 2632 gpio_set_pin_output(E6);
2633 DDRE |= (1<<6); 2633 gpio_write_pin_high(E6);
2634 PORTE |= (1<<6);
2635 } 2634 }
2636 else 2635 else
2637 { 2636 {
2638 // Output low. 2637 gpio_set_pin_input(E6);
2639 DDRE &= ~(1<<6);
2640 PORTE &= ~(1<<6);
2641 } 2638 }
2642} 2639}
2643#endif // defined(RGB_DEBUGGING_ONLY) 2640#endif // defined(RGB_DEBUGGING_ONLY)
diff --git a/keyboards/xiudi/xd60/xd60.h b/keyboards/xiudi/xd60/xd60.h
index 3d3c1ae885..c399b2965d 100644
--- a/keyboards/xiudi/xd60/xd60.h
+++ b/keyboards/xiudi/xd60/xd60.h
@@ -2,6 +2,9 @@
2 2
3#include "quantum.h" 3#include "quantum.h"
4 4
5#define XD60_CAPS_LOCK_LED_PIN B2
6#define XD60_BACKLIGHT_PIN F5
7
5/* XD60 LEDs 8/* XD60 LEDs
6 * GPIO pads 9 * GPIO pads
7 * 0 F7 not connected 10 * 0 F7 not connected
@@ -11,8 +14,18 @@
11 * B2 Capslock LED 14 * B2 Capslock LED
12 * B0 not connected 15 * B0 not connected
13 */ 16 */
14inline void xd60_caps_led_on(void) { DDRB |= (1<<2); PORTB &= ~(1<<2); } 17inline void xd60_caps_led_on(void) {
15inline void xd60_bl_led_on(void) { DDRF |= (1<<5); PORTF &= ~(1<<5); } 18 gpio_set_pin_output(XD60_CAPS_LOCK_LED_PIN);
19 gpio_write_pin_low(XD60_CAPS_LOCK_LED_PIN);
20}
21inline void xd60_bl_led_on(void) {
22 gpio_set_pin_output(XD60_BACKLIGHT_PIN);
23 gpio_write_pin_low(XD60_BACKLIGHT_PIN);
24}
16 25
17inline void xd60_caps_led_off(void) { DDRB &= ~(1<<2); PORTB &= ~(1<<2); } 26inline void xd60_caps_led_off(void) {
18inline void xd60_bl_led_off(void) { DDRF &= ~(1<<5); PORTF &= ~(1<<5); } 27 gpio_set_pin_input(XD60_CAPS_LOCK_LED_PIN);
28}
29inline void xd60_bl_led_off(void) {
30 gpio_set_pin_input(XD60_BACKLIGHT_PIN);
31}
diff --git a/keyboards/ydkb/yd68/keymaps/default/keymap.c b/keyboards/ydkb/yd68/keymaps/default/keymap.c
index 45b3144b9c..44fe57da6a 100644
--- a/keyboards/ydkb/yd68/keymaps/default/keymap.c
+++ b/keyboards/ydkb/yd68/keymaps/default/keymap.c
@@ -43,7 +43,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
43 case YD68_RGB_PWR: 43 case YD68_RGB_PWR:
44 if (record->event.pressed) { 44 if (record->event.pressed) {
45 // when keycode YD68_RGB_PWR is pressed 45 // when keycode YD68_RGB_PWR is pressed
46 PORTE ^= (1<<2); 46 gpio_toggle_pin(E2);
47 } else { 47 } else {
48 // when keycode YD68_RGB_PWR is released 48 // when keycode YD68_RGB_PWR is released
49 } 49 }