summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2024-02-18 17:08:27 +1100
committerGitHub <noreply@github.com>2024-02-18 17:08:27 +1100
commit2d1aed78a67b3d2b002cc739ef087963b05b76b8 (patch)
treeea681d02e547332cffa6b7aec6c16ef37ad70ee3 /quantum
parent6810aaf0130113e267e20fb506d874cc858f5f67 (diff)
Update GPIO macro usages in core (#23093)
Diffstat (limited to 'quantum')
-rw-r--r--quantum/backlight/backlight_driver_common.c10
-rw-r--r--quantum/dip_switch.c4
-rw-r--r--quantum/encoder.c8
-rw-r--r--quantum/haptic.c8
-rw-r--r--quantum/haptic.h16
-rw-r--r--quantum/joystick.c2
-rw-r--r--quantum/led.c30
-rw-r--r--quantum/matrix.c14
-rw-r--r--quantum/pointing_device/pointing_device.c8
-rw-r--r--quantum/split_common/split_util.c16
10 files changed, 58 insertions, 58 deletions
diff --git a/quantum/backlight/backlight_driver_common.c b/quantum/backlight/backlight_driver_common.c
index 8c3fe461d7..fb2770ee3c 100644
--- a/quantum/backlight/backlight_driver_common.c
+++ b/quantum/backlight/backlight_driver_common.c
@@ -26,23 +26,23 @@ static const pin_t backlight_pin = BACKLIGHT_PIN;
static inline void backlight_on(pin_t backlight_pin) {
#if BACKLIGHT_ON_STATE == 0
- writePinLow(backlight_pin);
+ gpio_write_pin_low(backlight_pin);
#else
- writePinHigh(backlight_pin);
+ gpio_write_pin_high(backlight_pin);
#endif
}
static inline void backlight_off(pin_t backlight_pin) {
#if BACKLIGHT_ON_STATE == 0
- writePinHigh(backlight_pin);
+ gpio_write_pin_high(backlight_pin);
#else
- writePinLow(backlight_pin);
+ gpio_write_pin_low(backlight_pin);
#endif
}
void backlight_pins_init(void) {
// Setup backlight pin as output and output to off state.
- FOR_EACH_LED(setPinOutput(backlight_pin); backlight_off(backlight_pin);)
+ FOR_EACH_LED(gpio_set_pin_output(backlight_pin); backlight_off(backlight_pin);)
}
void backlight_pins_on(void) {
diff --git a/quantum/dip_switch.c b/quantum/dip_switch.c
index e901f3e0c4..69cf665291 100644
--- a/quantum/dip_switch.c
+++ b/quantum/dip_switch.c
@@ -94,7 +94,7 @@ void dip_switch_init(void) {
}
# endif
for (uint8_t i = 0; i < NUM_DIP_SWITCHES; i++) {
- setPinInputHigh(dip_switch_pad[i]);
+ gpio_set_pin_input_high(dip_switch_pad[i]);
}
dip_switch_read(true);
#endif
@@ -123,7 +123,7 @@ void dip_switch_read(bool forced) {
for (uint8_t i = 0; i < NUM_DIP_SWITCHES; i++) {
#ifdef DIP_SWITCH_PINS
- dip_switch_state[i] = !readPin(dip_switch_pad[i]);
+ dip_switch_state[i] = !gpio_read_pin(dip_switch_pad[i]);
#endif
#ifdef DIP_SWITCH_MATRIX_GRID
dip_switch_state[i] = peek_matrix(dip_switch_pad[i].row, dip_switch_pad[i].col, read_raw);
diff --git a/quantum/encoder.c b/quantum/encoder.c
index 7ab194ed52..efb780c474 100644
--- a/quantum/encoder.c
+++ b/quantum/encoder.c
@@ -162,12 +162,12 @@ void encoder_init(void) {
#endif // defined(SPLIT_KEYBOARD) && defined(ENCODER_RESOLUTIONS)
for (uint8_t i = 0; i < thisCount; i++) {
- setPinInputHigh(encoders_pad_a[i]);
- setPinInputHigh(encoders_pad_b[i]);
+ gpio_set_pin_input_high(encoders_pad_a[i]);
+ gpio_set_pin_input_high(encoders_pad_b[i]);
}
encoder_wait_pullup_charge();
for (uint8_t i = 0; i < thisCount; i++) {
- encoder_state[i] = (readPin(encoders_pad_a[i]) << 0) | (readPin(encoders_pad_b[i]) << 1);
+ encoder_state[i] = (gpio_read_pin(encoders_pad_a[i]) << 0) | (gpio_read_pin(encoders_pad_b[i]) << 1);
}
}
@@ -247,7 +247,7 @@ static bool encoder_update(uint8_t index, uint8_t state) {
bool encoder_read(void) {
bool changed = false;
for (uint8_t i = 0; i < thisCount; i++) {
- uint8_t new_status = (readPin(encoders_pad_a[i]) << 0) | (readPin(encoders_pad_b[i]) << 1);
+ uint8_t new_status = (gpio_read_pin(encoders_pad_a[i]) << 0) | (gpio_read_pin(encoders_pad_b[i]) << 1);
if ((encoder_state[i] & 0x3) != new_status) {
encoder_state[i] <<= 2;
encoder_state[i] |= new_status;
diff --git a/quantum/haptic.c b/quantum/haptic.c
index a1fea29625..6a466293a7 100644
--- a/quantum/haptic.c
+++ b/quantum/haptic.c
@@ -96,10 +96,10 @@ void haptic_init(void) {
#endif
eeconfig_debug_haptic();
#ifdef HAPTIC_ENABLE_PIN
- setPinOutput(HAPTIC_ENABLE_PIN);
+ gpio_set_pin_output(HAPTIC_ENABLE_PIN);
#endif
#ifdef HAPTIC_ENABLE_STATUS_LED
- setPinOutput(HAPTIC_ENABLE_STATUS_LED);
+ gpio_set_pin_output(HAPTIC_ENABLE_STATUS_LED);
#endif
}
@@ -356,9 +356,9 @@ void haptic_shutdown(void) {
void haptic_notify_usb_device_state_change(void) {
update_haptic_enable_gpios();
#if defined(HAPTIC_ENABLE_PIN)
- setPinOutput(HAPTIC_ENABLE_PIN);
+ gpio_set_pin_output(HAPTIC_ENABLE_PIN);
#endif
#if defined(HAPTIC_ENABLE_STATUS_LED)
- setPinOutput(HAPTIC_ENABLE_STATUS_LED);
+ gpio_set_pin_output(HAPTIC_ENABLE_STATUS_LED);
#endif
}
diff --git a/quantum/haptic.h b/quantum/haptic.h
index 5bd1a71916..b283d5d268 100644
--- a/quantum/haptic.h
+++ b/quantum/haptic.h
@@ -84,22 +84,22 @@ void haptic_notify_usb_device_state_change(void);
# ifndef HAPTIC_ENABLE_PIN
# error HAPTIC_ENABLE_PIN not defined
# endif
-# define HAPTIC_ENABLE_PIN_WRITE_ACTIVE() writePinLow(HAPTIC_ENABLE_PIN)
-# define HAPTIC_ENABLE_PIN_WRITE_INACTIVE() writePinHigh(HAPTIC_ENABLE_PIN)
+# define HAPTIC_ENABLE_PIN_WRITE_ACTIVE() gpio_write_pin_low(HAPTIC_ENABLE_PIN)
+# define HAPTIC_ENABLE_PIN_WRITE_INACTIVE() gpio_write_pin_high(HAPTIC_ENABLE_PIN)
#else
-# define HAPTIC_ENABLE_PIN_WRITE_ACTIVE() writePinHigh(HAPTIC_ENABLE_PIN)
-# define HAPTIC_ENABLE_PIN_WRITE_INACTIVE() writePinLow(HAPTIC_ENABLE_PIN)
+# define HAPTIC_ENABLE_PIN_WRITE_ACTIVE() gpio_write_pin_high(HAPTIC_ENABLE_PIN)
+# define HAPTIC_ENABLE_PIN_WRITE_INACTIVE() gpio_write_pin_low(HAPTIC_ENABLE_PIN)
#endif
#ifdef HAPTIC_ENABLE_STATUS_LED_ACTIVE_LOW
# ifndef HAPTIC_ENABLE_STATUS_LED
# error HAPTIC_ENABLE_STATUS_LED not defined
# endif
-# define HAPTIC_ENABLE_STATUS_LED_WRITE_ACTIVE() writePinLow(HAPTIC_ENABLE_STATUS_LED)
-# define HAPTIC_ENABLE_STATUS_LED_WRITE_INACTIVE() writePinHigh(HAPTIC_ENABLE_STATUS_LED)
+# define HAPTIC_ENABLE_STATUS_LED_WRITE_ACTIVE() gpio_write_pin_low(HAPTIC_ENABLE_STATUS_LED)
+# define HAPTIC_ENABLE_STATUS_LED_WRITE_INACTIVE() gpio_write_pin_high(HAPTIC_ENABLE_STATUS_LED)
#else
-# define HAPTIC_ENABLE_STATUS_LED_WRITE_ACTIVE() writePinHigh(HAPTIC_ENABLE_STATUS_LED)
-# define HAPTIC_ENABLE_STATUS_LED_WRITE_INACTIVE() writePinLow(HAPTIC_ENABLE_STATUS_LED)
+# define HAPTIC_ENABLE_STATUS_LED_WRITE_ACTIVE() gpio_write_pin_high(HAPTIC_ENABLE_STATUS_LED)
+# define HAPTIC_ENABLE_STATUS_LED_WRITE_INACTIVE() gpio_write_pin_low(HAPTIC_ENABLE_STATUS_LED)
#endif
#ifndef HAPTIC_OFF_IN_LOW_POWER
diff --git a/quantum/joystick.c b/quantum/joystick.c
index 3e9edeb8e2..32f19b2cd9 100644
--- a/quantum/joystick.c
+++ b/quantum/joystick.c
@@ -43,7 +43,7 @@ __attribute__((weak)) void joystick_axis_init(uint8_t axis) {
if (axis >= JOYSTICK_AXIS_COUNT) return;
#if defined(JOYSTICK_ANALOG)
- setPinInput(joystick_axes[axis].input_pin);
+ gpio_set_pin_input(joystick_axes[axis].input_pin);
#endif
}
diff --git a/quantum/led.c b/quantum/led.c
index 1e7ee9db76..e2b5985109 100644
--- a/quantum/led.c
+++ b/quantum/led.c
@@ -98,19 +98,19 @@ __attribute__((weak)) void led_update_ports(led_t led_state) {
#endif
#ifdef LED_NUM_LOCK_PIN
- writePin(LED_NUM_LOCK_PIN, led_state.num_lock);
+ gpio_write_pin(LED_NUM_LOCK_PIN, led_state.num_lock);
#endif
#ifdef LED_CAPS_LOCK_PIN
- writePin(LED_CAPS_LOCK_PIN, led_state.caps_lock);
+ gpio_write_pin(LED_CAPS_LOCK_PIN, led_state.caps_lock);
#endif
#ifdef LED_SCROLL_LOCK_PIN
- writePin(LED_SCROLL_LOCK_PIN, led_state.scroll_lock);
+ gpio_write_pin(LED_SCROLL_LOCK_PIN, led_state.scroll_lock);
#endif
#ifdef LED_COMPOSE_PIN
- writePin(LED_COMPOSE_PIN, led_state.compose);
+ gpio_write_pin(LED_COMPOSE_PIN, led_state.compose);
#endif
#ifdef LED_KANA_PIN
- writePin(LED_KANA_PIN, led_state.kana);
+ gpio_write_pin(LED_KANA_PIN, led_state.kana);
#endif
}
@@ -118,24 +118,24 @@ __attribute__((weak)) void led_update_ports(led_t led_state) {
*/
__attribute__((weak)) void led_init_ports(void) {
#ifdef LED_NUM_LOCK_PIN
- setPinOutput(LED_NUM_LOCK_PIN);
- writePin(LED_NUM_LOCK_PIN, !LED_PIN_ON_STATE);
+ gpio_set_pin_output(LED_NUM_LOCK_PIN);
+ gpio_write_pin(LED_NUM_LOCK_PIN, !LED_PIN_ON_STATE);
#endif
#ifdef LED_CAPS_LOCK_PIN
- setPinOutput(LED_CAPS_LOCK_PIN);
- writePin(LED_CAPS_LOCK_PIN, !LED_PIN_ON_STATE);
+ gpio_set_pin_output(LED_CAPS_LOCK_PIN);
+ gpio_write_pin(LED_CAPS_LOCK_PIN, !LED_PIN_ON_STATE);
#endif
#ifdef LED_SCROLL_LOCK_PIN
- setPinOutput(LED_SCROLL_LOCK_PIN);
- writePin(LED_SCROLL_LOCK_PIN, !LED_PIN_ON_STATE);
+ gpio_set_pin_output(LED_SCROLL_LOCK_PIN);
+ gpio_write_pin(LED_SCROLL_LOCK_PIN, !LED_PIN_ON_STATE);
#endif
#ifdef LED_COMPOSE_PIN
- setPinOutput(LED_COMPOSE_PIN);
- writePin(LED_COMPOSE_PIN, !LED_PIN_ON_STATE);
+ gpio_set_pin_output(LED_COMPOSE_PIN);
+ gpio_write_pin(LED_COMPOSE_PIN, !LED_PIN_ON_STATE);
#endif
#ifdef LED_KANA_PIN
- setPinOutput(LED_KANA_PIN);
- writePin(LED_KANA_PIN, !LED_PIN_ON_STATE);
+ gpio_set_pin_output(LED_KANA_PIN);
+ gpio_write_pin(LED_KANA_PIN, !LED_PIN_ON_STATE);
#endif
}
diff --git a/quantum/matrix.c b/quantum/matrix.c
index f087a215d4..d4586efac2 100644
--- a/quantum/matrix.c
+++ b/quantum/matrix.c
@@ -78,27 +78,27 @@ __attribute__((weak)) void matrix_read_rows_on_col(matrix_row_t current_matrix[]
static inline void setPinOutput_writeLow(pin_t pin) {
ATOMIC_BLOCK_FORCEON {
- setPinOutput(pin);
- writePinLow(pin);
+ gpio_set_pin_output(pin);
+ gpio_write_pin_low(pin);
}
}
static inline void setPinOutput_writeHigh(pin_t pin) {
ATOMIC_BLOCK_FORCEON {
- setPinOutput(pin);
- writePinHigh(pin);
+ gpio_set_pin_output(pin);
+ gpio_write_pin_high(pin);
}
}
static inline void setPinInputHigh_atomic(pin_t pin) {
ATOMIC_BLOCK_FORCEON {
- setPinInputHigh(pin);
+ gpio_set_pin_input_high(pin);
}
}
static inline uint8_t readMatrixPin(pin_t pin) {
if (pin != NO_PIN) {
- return (readPin(pin) == MATRIX_INPUT_PRESSED_STATE) ? 0 : 1;
+ return (gpio_read_pin(pin) == MATRIX_INPUT_PRESSED_STATE) ? 0 : 1;
} else {
return 1;
}
@@ -113,7 +113,7 @@ __attribute__((weak)) void matrix_init_pins(void) {
for (int col = 0; col < MATRIX_COLS; col++) {
pin_t pin = direct_pins[row][col];
if (pin != NO_PIN) {
- setPinInputHigh(pin);
+ gpio_set_pin_input_high(pin);
}
}
}
diff --git a/quantum/pointing_device/pointing_device.c b/quantum/pointing_device/pointing_device.c
index 2fa49ade8e..bcced166c0 100644
--- a/quantum/pointing_device/pointing_device.c
+++ b/quantum/pointing_device/pointing_device.c
@@ -149,9 +149,9 @@ __attribute__((weak)) void pointing_device_init(void) {
pointing_device_driver.init();
#ifdef POINTING_DEVICE_MOTION_PIN
# ifdef POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
- setPinInputHigh(POINTING_DEVICE_MOTION_PIN);
+ gpio_set_pin_input_high(POINTING_DEVICE_MOTION_PIN);
# else
- setPinInput(POINTING_DEVICE_MOTION_PIN);
+ gpio_set_pin_input(POINTING_DEVICE_MOTION_PIN);
# endif
#endif
}
@@ -247,9 +247,9 @@ __attribute__((weak)) bool pointing_device_task(void) {
# error POINTING_DEVICE_MOTION_PIN not supported when sharing the pointing device report between sides.
# endif
# ifdef POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
- if (!readPin(POINTING_DEVICE_MOTION_PIN))
+ if (!gpio_read_pin(POINTING_DEVICE_MOTION_PIN))
# else
- if (readPin(POINTING_DEVICE_MOTION_PIN))
+ if (gpio_read_pin(POINTING_DEVICE_MOTION_PIN))
# endif
{
#endif
diff --git a/quantum/split_common/split_util.c b/quantum/split_common/split_util.c
index 2f592bd4cf..96f19bfd84 100644
--- a/quantum/split_common/split_util.c
+++ b/quantum/split_common/split_util.c
@@ -123,14 +123,14 @@ void split_watchdog_task(void) {
void matrix_io_delay(void);
static uint8_t peek_matrix_intersection(pin_t out_pin, pin_t in_pin) {
- setPinInputHigh(in_pin);
- setPinOutput(out_pin);
- writePinLow(out_pin);
+ gpio_set_pin_input_high(in_pin);
+ gpio_set_pin_output(out_pin);
+ gpio_write_pin_low(out_pin);
// It's almost unnecessary, but wait until it's down to low, just in case.
wait_us(1);
- uint8_t pin_state = readPin(in_pin);
+ uint8_t pin_state = gpio_read_pin(in_pin);
// Set out_pin to a setting that is less susceptible to noise.
- setPinInputHigh(out_pin);
+ gpio_set_pin_input_high(out_pin);
matrix_io_delay(); // Wait for the pull-up to go HIGH.
return pin_state;
}
@@ -138,13 +138,13 @@ static uint8_t peek_matrix_intersection(pin_t out_pin, pin_t in_pin) {
__attribute__((weak)) bool is_keyboard_left_impl(void) {
#if defined(SPLIT_HAND_PIN)
- setPinInput(SPLIT_HAND_PIN);
+ gpio_set_pin_input(SPLIT_HAND_PIN);
wait_us(100);
// Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand
# ifdef SPLIT_HAND_PIN_LOW_IS_LEFT
- return !readPin(SPLIT_HAND_PIN);
+ return !gpio_read_pin(SPLIT_HAND_PIN);
# else
- return readPin(SPLIT_HAND_PIN);
+ return gpio_read_pin(SPLIT_HAND_PIN);
# endif
#elif defined(SPLIT_HAND_MATRIX_GRID)
# ifdef SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT