Convert some AVR GPIO operations to macros (#23424)
This commit is contained in:
parent
7220715dd1
commit
61c7c1f74c
71 changed files with 877 additions and 840 deletions
|
@ -23,24 +23,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
};
|
||||
|
||||
bool led_update_user(led_t led_state) {
|
||||
DDRB |= (1 << 4) | (1 << 5) | (1 << 6);
|
||||
gpio_set_pin_output(B4);
|
||||
gpio_set_pin_output(B5);
|
||||
gpio_set_pin_output(B6);
|
||||
|
||||
if (led_state.num_lock) {
|
||||
PORTB |= (1 << 4);
|
||||
} else {
|
||||
PORTB &= ~(1 << 4);
|
||||
}
|
||||
gpio_write_pin(B4, led_state.num_lock);
|
||||
gpio_write_pin(B5, led_state.caps_lock);
|
||||
gpio_write_pin(B6, led_state.scroll_lock);
|
||||
|
||||
if (led_state.caps_lock) {
|
||||
PORTB |= (1 << 5);
|
||||
} else {
|
||||
PORTB &= ~(1 << 5);
|
||||
}
|
||||
|
||||
if (led_state.scroll_lock) {
|
||||
PORTB |= (1 << 6);
|
||||
} else {
|
||||
PORTB &= ~(1 << 6);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue