diff options
author | Ryan <[email protected]> | 2024-05-03 15:21:29 +1000 |
---|---|---|
committer | GitHub <[email protected]> | 2024-05-03 15:21:29 +1000 |
commit | d09a06a1b354760fd0e64a453abade972900e885 (patch) | |
tree | 88d94640f4507ac8d7f570607423825bec3c6f89 /keyboards/hhkb | |
parent | 5426a7a129acf2ff5c8b435014747f1238e17965 (diff) | |
download | qmk_firmware-d09a06a1b354760fd0e64a453abade972900e885.tar.gz qmk_firmware-d09a06a1b354760fd0e64a453abade972900e885.zip |
Update GPIO API usage in keyboard code (#23361)
Diffstat (limited to 'keyboards/hhkb')
-rw-r--r-- | keyboards/hhkb/yang/matrix.c | 20 | ||||
-rw-r--r-- | keyboards/hhkb/yang/yang.c | 62 |
2 files changed, 41 insertions, 41 deletions
diff --git a/keyboards/hhkb/yang/matrix.c b/keyboards/hhkb/yang/matrix.c index c82c77bed3..d82aaf5a0c 100644 --- a/keyboards/hhkb/yang/matrix.c +++ b/keyboards/hhkb/yang/matrix.c @@ -34,12 +34,12 @@ uint8_t power_save_level; static uint32_t matrix_last_modified = 0; -static inline void key_strobe_high(void) { writePinLow(B6); } -static inline void key_strobe_low(void) { writePinHigh(B6); } -static inline bool key_state(void) { return readPin(D7); } -static inline void key_prev_on(void) { writePinHigh(B7); } -static inline void key_prev_off(void) { writePinLow(B7); } -static inline bool key_power_state(void) { return !readPin(D6); } +static inline void key_strobe_high(void) { gpio_write_pin_low(B6); } +static inline void key_strobe_low(void) { gpio_write_pin_high(B6); } +static inline bool key_state(void) { return gpio_read_pin(D7); } +static inline void key_prev_on(void) { gpio_write_pin_high(B7); } +static inline void key_prev_off(void) { gpio_write_pin_low(B7); } +static inline bool key_power_state(void) { return !gpio_read_pin(D6); } static inline void suspend_power_down_longer(void) { uint8_t times = 60; @@ -52,8 +52,8 @@ void matrix_power_up(void) { DDRB = 0xFF; PORTB = 0x40; // switch MOS FET on - setPinOutput(D6); - writePinLow(D6); + gpio_set_pin_output(D6); + gpio_write_pin_low(D6); } void matrix_power_down(void) { @@ -62,8 +62,8 @@ void matrix_power_down(void) { DDRB = 0x00; PORTB = 0xFF; // switch MOS FET off - setPinOutput(D6); - writePinHigh(D6); + gpio_set_pin_output(D6); + gpio_write_pin_high(D6); } static inline void key_select_row(uint8_t row) { PORTB = (PORTB & 0b11111000) | ((row)&0b111); } diff --git a/keyboards/hhkb/yang/yang.c b/keyboards/hhkb/yang/yang.c index 548f0dd734..3aba711b1f 100644 --- a/keyboards/hhkb/yang/yang.c +++ b/keyboards/hhkb/yang/yang.c @@ -21,13 +21,13 @@ extern uint8_t power_save_level; void hhkb_led_on(uint8_t led) { switch (led) { case 1: - writePinHigh(F4); + gpio_write_pin_high(F4); break; case 2: - writePinHigh(F2); + gpio_write_pin_high(F2); break; case 3: - writePinHigh(F0); + gpio_write_pin_high(F0); break; } } @@ -35,55 +35,55 @@ void hhkb_led_on(uint8_t led) { void hhkb_led_off(uint8_t led) { switch (led) { case 1: - writePinLow(F4); + gpio_write_pin_low(F4); break; case 2: - writePinLow(F2); + gpio_write_pin_low(F2); break; case 3: - writePinLow(F0); + gpio_write_pin_low(F0); break; } } void keyboard_pre_init_kb(void) { // BT power up - setPinOutput(D5); - writePinLow(D5); + gpio_set_pin_output(D5); + gpio_write_pin_low(D5); // Row selectors - setPinOutput(B0); - setPinOutput(B1); - setPinOutput(B2); + gpio_set_pin_output(B0); + gpio_set_pin_output(B1); + gpio_set_pin_output(B2); // Col selectors - setPinOutput(B3); - setPinOutput(B4); - setPinOutput(B5); + gpio_set_pin_output(B3); + gpio_set_pin_output(B4); + gpio_set_pin_output(B5); // Key strobe - setPinOutput(B6); - writePinHigh(B6); + gpio_set_pin_output(B6); + gpio_write_pin_high(B6); // Key: input with pull-up - setPinInputHigh(D7); + gpio_set_pin_input_high(D7); // Unused pins on Pro2 ANSI // Input with pull up to save power - setPinInputHigh(C6); - setPinInputHigh(C7); + gpio_set_pin_input_high(C6); + gpio_set_pin_input_high(C7); // LED pin configuration - setPinOutput(F0); - setPinOutput(F1); - setPinOutput(F4); - writePinLow(F0); - writePinLow(F1); - writePinLow(F4); + gpio_set_pin_output(F0); + gpio_set_pin_output(F1); + gpio_set_pin_output(F4); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); + gpio_write_pin_low(F4); // Turn on switch PCB - setPinOutput(D6); - writePinLow(D6); + gpio_set_pin_output(D6); + gpio_write_pin_low(D6); keyboard_pre_init_user(); } @@ -93,7 +93,7 @@ void suspend_power_down_kb(void) { // Disable UART TX to avoid current leakage UCSR1B &= ~_BV(TXEN1); // Power down BLE module - writePinHigh(D5); + gpio_write_pin_high(D5); } suspend_power_down_user(); @@ -101,7 +101,7 @@ void suspend_power_down_kb(void) { void suspend_wakeup_init_kb(void) { // Power up BLE module - writePinLow(D5); + gpio_write_pin_low(D5); // Enable UART TX UCSR1B |= _BV(TXEN1); @@ -111,8 +111,8 @@ void suspend_wakeup_init_kb(void) { layer_state_t layer_state_set_kb(layer_state_t state) { state = layer_state_set_user(state); - writePin(F1, IS_LAYER_ON_STATE(state, 1)); - writePin(F0, IS_LAYER_ON_STATE(state, 2)); + gpio_write_pin(F1, IS_LAYER_ON_STATE(state, 1)); + gpio_write_pin(F0, IS_LAYER_ON_STATE(state, 2)); return state; } |