aboutsummaryrefslogtreecommitdiff
path: root/keyboards/crawlpad
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/crawlpad
parent7220715dd1619dfb073db78cfc23998a67994655 (diff)
downloadqmk_firmware-61c7c1f74cc5365501a3038181df551df11f719e.tar.gz
qmk_firmware-61c7c1f74cc5365501a3038181df551df11f719e.zip
Convert some AVR GPIO operations to macros (#23424)
Diffstat (limited to 'keyboards/crawlpad')
-rwxr-xr-xkeyboards/crawlpad/keymaps/default/keymap.c35
1 files changed, 13 insertions, 22 deletions
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) {
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case BL1:
- if (record->event.pressed) {
- PORTB |= (1 << 4);
- } else {
- PORTB &= ~(1 << 4);
- }
+ gpio_write_pin(B4, record->event.pressed);
return false;
case BL2:
- if (record->event.pressed) {
- PORTB |= (1 << 5);
- } else {
- PORTB &= ~(1 << 5);
- }
+ gpio_write_pin(B5, record->event.pressed);
return false;
case BL3:
- if (record->event.pressed) {
- PORTB |= (1 << 6);
- } else {
- PORTB &= ~(1 << 6);
- }
+ gpio_write_pin(B6, record->event.pressed);
return false;
case BL4:
- if (record->event.pressed) {
- PORTB |= (1 << 7);
- } else {
- PORTB &= ~(1 << 7);
- }
+ gpio_write_pin(B7, record->event.pressed);
return false;
}
return true;
@@ -73,6 +57,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
void matrix_init_user(void) {
/* set LED row pins to output and low */
- DDRB |= (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7);
- PORTB &= ~(1 << 4) & ~(1 << 5) & ~(1 << 6) & ~(1 << 7);
+ gpio_set_pin_output(B4);
+ gpio_set_pin_output(B5);
+ gpio_set_pin_output(B6);
+ gpio_set_pin_output(B7);
+
+ gpio_write_pin_low(B4);
+ gpio_write_pin_low(B5);
+ gpio_write_pin_low(B6);
+ gpio_write_pin_low(B7);
}