aboutsummaryrefslogtreecommitdiff
path: root/keyboards/tmo50/tmo50.c
diff options
context:
space:
mode:
authorRyan <[email protected]>2024-05-02 19:48:49 +1000
committerGitHub <[email protected]>2024-05-02 10:48:49 +0100
commit61c7c1f74cc5365501a3038181df551df11f719e (patch)
tree67b134bfd3ba45660765f5c2c46b8d3f535b5b69 /keyboards/tmo50/tmo50.c
parent7220715dd1619dfb073db78cfc23998a67994655 (diff)
downloadqmk_firmware-61c7c1f74cc5365501a3038181df551df11f719e.tar.gz
qmk_firmware-61c7c1f74cc5365501a3038181df551df11f719e.zip
Convert some AVR GPIO operations to macros (#23424)
Diffstat (limited to 'keyboards/tmo50/tmo50.c')
-rw-r--r--keyboards/tmo50/tmo50.c40
1 files changed, 12 insertions, 28 deletions
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) {
// put your keyboard start-up code here
// runs once when the firmware starts up
- DDRB |= (1 << PB0); //init B0
- PORTB &= ~(1 << PB0); //turn on B0
- DDRB |= (1 << PB1);
- PORTB |= (1<<PB1); //turn off B1
- DDRB |= (1 << PB2);
- PORTB |= (1<<PB2);
- DDRB |= (1 << PB3);
- PORTB |= (1<<PB3);
+ gpio_set_pin_output(B0);
+ gpio_write_pin_low(B0);
+ gpio_set_pin_output(B1);
+ gpio_write_pin_high(B1);
+ gpio_set_pin_output(B2);
+ gpio_write_pin_high(B2);
+ gpio_set_pin_output(B3);
+ gpio_write_pin_high(B3);
matrix_init_user();
}
@@ -49,32 +49,16 @@ bool process_indicator_led_kb(layer_state_t state)
if(process_indicator_led_user(state))
{
// if on layer 0, turn on B0 LED, otherwise off.
- if (get_highest_layer(state) == 0) {
- PORTB &= ~(1<<PB0);
- } else {
- PORTB |= (1<<PB0);
- }
+ gpio_write_pin(B0, get_highest_layer(state) != 0);
// if on layer 1, turn on B1 LED, otherwise off.
- if (get_highest_layer(state) == 1) {
- PORTB &= ~(1<<PB1);
- } else {
- PORTB |= (1<<PB1);
- }
+ gpio_write_pin(B1, get_highest_layer(state) != 1);
// if on layer 2, turn on B2 LED, otherwise off.
- if (get_highest_layer(state) == 2) {
- PORTB &= ~(1<<PB2);
- } else {
- PORTB |= (1<<PB2);
- }
+ gpio_write_pin(B2, get_highest_layer(state) != 2);
// if on layer 3, turn on B3 LED, otherwise off.
- if (get_highest_layer(state) == 3) {
- PORTB &= ~(1<<PB3);
- } else {
- PORTB |= (1<<PB3);
- }
+ gpio_write_pin(B3, get_highest_layer(state) != 3);
}
return true;