summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2024-02-17 00:18:26 +1100
committerGitHub <noreply@github.com>2024-02-17 00:18:26 +1100
commitb8646bc40bd616167da150f6da4eda372f7de23d (patch)
tree8029e1180ff0666a07d8ef896461333a836611fa
parent6890c1aeb82c0c2239841db57e1bd99c3a0651a5 (diff)
Update naming convention for GPIO control macros (#23085)
-rw-r--r--docs/custom_quantum_functions.md10
-rw-r--r--docs/feature_led_indicators.md12
-rw-r--r--docs/gpio_control.md38
-rw-r--r--docs/i2c_driver.md4
-rw-r--r--platforms/arm_atsam/gpio.h24
-rw-r--r--platforms/avr/gpio.h22
-rw-r--r--platforms/chibios/gpio.h34
-rw-r--r--platforms/gpio.h19
-rw-r--r--quantum/encoder/tests/mock.c4
-rw-r--r--quantum/encoder/tests/mock.h8
-rw-r--r--quantum/encoder/tests/mock_split.c4
-rw-r--r--quantum/encoder/tests/mock_split.h8
12 files changed, 102 insertions, 85 deletions
diff --git a/docs/custom_quantum_functions.md b/docs/custom_quantum_functions.md
index 957633837c..bc3b28bbba 100644
--- a/docs/custom_quantum_functions.md
+++ b/docs/custom_quantum_functions.md
@@ -119,11 +119,11 @@ void keyboard_pre_init_user(void) {
119 // Call the keyboard pre init code. 119 // Call the keyboard pre init code.
120 120
121 // Set our LED pins as output 121 // Set our LED pins as output
122 setPinOutput(B0); 122 gpio_set_pin_output(B0);
123 setPinOutput(B1); 123 gpio_set_pin_output(B1);
124 setPinOutput(B2); 124 gpio_set_pin_output(B2);
125 setPinOutput(B3); 125 gpio_set_pin_output(B3);
126 setPinOutput(B4); 126 gpio_set_pin_output(B4);
127} 127}
128``` 128```
129 129
diff --git a/docs/feature_led_indicators.md b/docs/feature_led_indicators.md
index 1f71cdb1c8..b35a174490 100644
--- a/docs/feature_led_indicators.md
+++ b/docs/feature_led_indicators.md
@@ -56,16 +56,16 @@ This is a template indicator function that can be implemented on keyboard level
56bool led_update_kb(led_t led_state) { 56bool led_update_kb(led_t led_state) {
57 bool res = led_update_user(led_state); 57 bool res = led_update_user(led_state);
58 if(res) { 58 if(res) {
59 // writePin sets the pin high for 1 and low for 0. 59 // gpio_write_pin sets the pin high for 1 and low for 0.
60 // In this example the pins are inverted, setting 60 // In this example the pins are inverted, setting
61 // it low/0 turns it on, and high/1 turns the LED off. 61 // it low/0 turns it on, and high/1 turns the LED off.
62 // This behavior depends on whether the LED is between the pin 62 // This behavior depends on whether the LED is between the pin
63 // and VCC or the pin and GND. 63 // and VCC or the pin and GND.
64 writePin(B0, !led_state.num_lock); 64 gpio_write_pin(B0, !led_state.num_lock);
65 writePin(B1, !led_state.caps_lock); 65 gpio_write_pin(B1, !led_state.caps_lock);
66 writePin(B2, !led_state.scroll_lock); 66 gpio_write_pin(B2, !led_state.scroll_lock);
67 writePin(B3, !led_state.compose); 67 gpio_write_pin(B3, !led_state.compose);
68 writePin(B4, !led_state.kana); 68 gpio_write_pin(B4, !led_state.kana);
69 } 69 }
70 return res; 70 return res;
71} 71}
diff --git a/docs/gpio_control.md b/docs/gpio_control.md
index 12413dfc8e..90798fc87b 100644
--- a/docs/gpio_control.md
+++ b/docs/gpio_control.md
@@ -2,29 +2,29 @@
2 2
3QMK has a GPIO control abstraction layer which is microcontroller agnostic. This is done to allow easy access to pin control across different platforms. 3QMK has a GPIO control abstraction layer which is microcontroller agnostic. This is done to allow easy access to pin control across different platforms.
4 4
5## Functions :id=functions 5## Macros :id=macros
6 6
7The following functions provide basic control of GPIOs and are found in `platforms/<platform>/gpio.h`. 7The following macros provide basic control of GPIOs and are found in `platforms/<platform>/gpio.h`.
8 8
9| Function | Description | Old AVR Examples | Old ChibiOS/ARM Examples | 9|Macro |Description |
10|------------------------------|-----------------------------------------------------|-------------------------------------------------|--------------------------------------------------| 10|-------------------------------------|---------------------------------------------------------------------|
11| `setPinInput(pin)` | Set pin as input with high impedance (High-Z) | `DDRB &= ~(1<<2)` | `palSetLineMode(pin, PAL_MODE_INPUT)` | 11|`gpio_set_pin_input(pin)` |Set pin as input with high impedance (High-Z) |
12| `setPinInputHigh(pin)` | Set pin as input with builtin pull-up resistor | `DDRB &= ~(1<<2); PORTB \|= (1<<2)` | `palSetLineMode(pin, PAL_MODE_INPUT_PULLUP)` | 12|`gpio_set_pin_input_high(pin)` |Set pin as input with builtin pull-up resistor |
13| `setPinInputLow(pin)` | Set pin as input with builtin pull-down resistor | N/A (Not supported on AVR) | `palSetLineMode(pin, PAL_MODE_INPUT_PULLDOWN)` | 13|`gpio_set_pin_input_low(pin)` |Set pin as input with builtin pull-down resistor (unavailable on AVR)|
14| `setPinOutput(pin)` | Set pin as output (alias of `setPinOutputPushPull`) | `DDRB \|= (1<<2)` | `palSetLineMode(pin, PAL_MODE_OUTPUT_PUSHPULL)` | 14|`gpio_set_pin_output(pin)` |Set pin as output (alias of `gpio_set_pin_output_push_pull`) |
15| `setPinOutputPushPull(pin)` | Set pin as output, push/pull mode | `DDRB \|= (1<<2)` | `palSetLineMode(pin, PAL_MODE_OUTPUT_PUSHPULL)` | 15|`gpio_set_pin_output_push_pull(pin)` |Set pin as output, push/pull mode |
16| `setPinOutputOpenDrain(pin)` | Set pin as output, open-drain mode | N/A (Not implemented on AVR) | `palSetLineMode(pin, PAL_MODE_OUTPUT_OPENDRAIN)` | 16|`gpio_set_pin_output_open_drain(pin)`|Set pin as output, open-drain mode (unavailable on AVR and ATSAM) |
17| `writePinHigh(pin)` | Set pin level as high, assuming it is an output | `PORTB \|= (1<<2)` | `palSetLine(pin)` | 17|`gpio_write_pin_high(pin)` |Set pin level as high, assuming it is an output |
18| `writePinLow(pin)` | Set pin level as low, assuming it is an output | `PORTB &= ~(1<<2)` | `palClearLine(pin)` | 18|`gpio_write_pin_low(pin)` |Set pin level as low, assuming it is an output |
19| `writePin(pin, level)` | Set pin level, assuming it is an output | `(level) ? PORTB \|= (1<<2) : PORTB &= ~(1<<2)` | `(level) ? palSetLine(pin) : palClearLine(pin)` | 19|`gpio_write_pin(pin, level)` |Set pin level, assuming it is an output |
20| `readPin(pin)` | Returns the level of the pin | `_SFR_IO8(pin >> 4) & _BV(pin & 0xF)` | `palReadLine(pin)` | 20|`gpio_read_pin(pin)` |Returns the level of the pin |
21| `togglePin(pin)` | Invert pin level, assuming it is an output | `PORTB ^= (1<<2)` | `palToggleLine(pin)` | 21|`gpio_toggle_pin(pin)` |Invert pin level, assuming it is an output |
22 22
23## Advanced Settings :id=advanced-settings 23## Advanced Settings :id=advanced-settings
24 24
25Each microcontroller can have multiple advanced settings regarding its GPIO. This abstraction layer does not limit the use of architecture-specific functions. Advanced users should consult the datasheet of their desired device and include any needed libraries. For AVR, the standard avr/io.h library is used; for STM32, the ChibiOS [PAL library](https://chibios.sourceforge.net/docs3/hal/group___p_a_l.html) is used. 25Each microcontroller can have multiple advanced settings regarding its GPIO. This abstraction layer does not limit the use of architecture-specific functions. Advanced users should consult the datasheet of their desired device. For AVR, the standard `avr/io.h` library is used; for STM32, the ChibiOS [PAL library](https://chibios.sourceforge.net/docs3/hal/group___p_a_l.html) is used.
26 26
27## Atomic Operation 27## Atomic Operation :id=atomic-operation
28 28
29The above functions are not always guaranteed to work atomically. Therefore, if you want to prevent interruptions in the middle of operations when using multiple combinations of the above functions, use the following `ATOMIC_BLOCK_FORCEON` macro. 29The above functions are not always guaranteed to work atomically. Therefore, if you want to prevent interruptions in the middle of operations when using multiple combinations of the above functions, use the following `ATOMIC_BLOCK_FORCEON` macro.
30 30
diff --git a/docs/i2c_driver.md b/docs/i2c_driver.md
index 868715a62c..9a3c08b90b 100644
--- a/docs/i2c_driver.md
+++ b/docs/i2c_driver.md
@@ -127,8 +127,8 @@ This function is weakly defined, meaning it can be overridden if necessary for y
127 127
128```c 128```c
129void i2c_init(void) { 129void i2c_init(void) {
130 setPinInput(B6); // Try releasing special pins for a short time 130 gpio_set_pin_input(B6); // Try releasing special pins for a short time
131 setPinInput(B7); 131 gpio_set_pin_input(B7);
132 wait_ms(10); // Wait for the release to happen 132 wait_ms(10); // Wait for the release to happen
133 133
134 palSetPadMode(GPIOB, 6, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); // Set B6 to I2C function 134 palSetPadMode(GPIOB, 6, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); // Set B6 to I2C function
diff --git a/platforms/arm_atsam/gpio.h b/platforms/arm_atsam/gpio.h
index a42aaff54d..fd8caeab0b 100644
--- a/platforms/arm_atsam/gpio.h
+++ b/platforms/arm_atsam/gpio.h
@@ -15,7 +15,7 @@
15 */ 15 */
16#pragma once 16#pragma once
17 17
18#include "stdint.h" 18#include <stdint.h>
19#include "samd51j18a.h" 19#include "samd51j18a.h"
20 20
21#include "pin_defs.h" 21#include "pin_defs.h"
@@ -26,13 +26,13 @@ typedef uint8_t pin_t;
26#define SAMD_PIN(pin) ((pin)&0x1f) 26#define SAMD_PIN(pin) ((pin)&0x1f)
27#define SAMD_PIN_MASK(pin) (1 << ((pin)&0x1f)) 27#define SAMD_PIN_MASK(pin) (1 << ((pin)&0x1f))
28 28
29#define setPinInput(pin) \ 29#define gpio_set_pin_input(pin) \
30 do { \ 30 do { \
31 PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.INEN = 1; \ 31 PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.INEN = 1; \
32 PORT->Group[SAMD_PORT(pin)].DIRCLR.reg = SAMD_PIN_MASK(pin); \ 32 PORT->Group[SAMD_PORT(pin)].DIRCLR.reg = SAMD_PIN_MASK(pin); \
33 } while (0) 33 } while (0)
34 34
35#define setPinInputHigh(pin) \ 35#define gpio_set_pin_input_high(pin) \
36 do { \ 36 do { \
37 PORT->Group[SAMD_PORT(pin)].DIRCLR.reg = SAMD_PIN_MASK(pin); \ 37 PORT->Group[SAMD_PORT(pin)].DIRCLR.reg = SAMD_PIN_MASK(pin); \
38 PORT->Group[SAMD_PORT(pin)].OUTSET.reg = SAMD_PIN_MASK(pin); \ 38 PORT->Group[SAMD_PORT(pin)].OUTSET.reg = SAMD_PIN_MASK(pin); \
@@ -40,7 +40,7 @@ typedef uint8_t pin_t;
40 PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.PULLEN = 1; \ 40 PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.PULLEN = 1; \
41 } while (0) 41 } while (0)
42 42
43#define setPinInputLow(pin) \ 43#define gpio_set_pin_input_low(pin) \
44 do { \ 44 do { \
45 PORT->Group[SAMD_PORT(pin)].DIRCLR.reg = SAMD_PIN_MASK(pin); \ 45 PORT->Group[SAMD_PORT(pin)].DIRCLR.reg = SAMD_PIN_MASK(pin); \
46 PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \ 46 PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \
@@ -48,27 +48,27 @@ typedef uint8_t pin_t;
48 PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.PULLEN = 1; \ 48 PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.PULLEN = 1; \
49 } while (0) 49 } while (0)
50 50
51#define setPinOutputPushPull(pin) \ 51#define gpio_set_pin_output_push_pull(pin) \
52 do { \ 52 do { \
53 PORT->Group[SAMD_PORT(pin)].DIRSET.reg = SAMD_PIN_MASK(pin); \ 53 PORT->Group[SAMD_PORT(pin)].DIRSET.reg = SAMD_PIN_MASK(pin); \
54 PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \ 54 PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \
55 } while (0) 55 } while (0)
56 56
57#define setPinOutputOpenDrain(pin) _Static_assert(0, "arm_atsam platform does not implement an open-drain output") 57#define gpio_set_pin_output_open_drain(pin) _Static_assert(0, "Open-drain outputs are not available on ATSAM")
58 58
59#define setPinOutput(pin) setPinOutputPushPull(pin) 59#define gpio_set_pin_output(pin) gpio_set_pin_output_push_pull(pin)
60 60
61#define writePinHigh(pin) \ 61#define gpio_write_pin_high(pin) \
62 do { \ 62 do { \
63 PORT->Group[SAMD_PORT(pin)].OUTSET.reg = SAMD_PIN_MASK(pin); \ 63 PORT->Group[SAMD_PORT(pin)].OUTSET.reg = SAMD_PIN_MASK(pin); \
64 } while (0) 64 } while (0)
65 65
66#define writePinLow(pin) \ 66#define gpio_write_pin_low(pin) \
67 do { \ 67 do { \
68 PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \ 68 PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \
69 } while (0) 69 } while (0)
70 70
71#define writePin(pin, level) \ 71#define gpio_write_pin(pin, level) \
72 do { \ 72 do { \
73 if (level) \ 73 if (level) \
74 PORT->Group[SAMD_PORT(pin)].OUTSET.reg = SAMD_PIN_MASK(pin); \ 74 PORT->Group[SAMD_PORT(pin)].OUTSET.reg = SAMD_PIN_MASK(pin); \
@@ -76,6 +76,6 @@ typedef uint8_t pin_t;
76 PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \ 76 PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \
77 } while (0) 77 } while (0)
78 78
79#define readPin(pin) ((PORT->Group[SAMD_PORT(pin)].IN.reg & SAMD_PIN_MASK(pin)) != 0) 79#define gpio_read_pin(pin) ((PORT->Group[SAMD_PORT(pin)].IN.reg & SAMD_PIN_MASK(pin)) != 0)
80 80
81#define togglePin(pin) (PORT->Group[SAMD_PORT(pin)].OUTTGL.reg = SAMD_PIN_MASK(pin)) 81#define gpio_toggle_pin(pin) (PORT->Group[SAMD_PORT(pin)].OUTTGL.reg = SAMD_PIN_MASK(pin))
diff --git a/platforms/avr/gpio.h b/platforms/avr/gpio.h
index 95f15c28dc..6f089bc663 100644
--- a/platforms/avr/gpio.h
+++ b/platforms/avr/gpio.h
@@ -22,17 +22,17 @@ typedef uint8_t pin_t;
22 22
23/* Operation of GPIO by pin. */ 23/* Operation of GPIO by pin. */
24 24
25#define setPinInput(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) &= ~_BV((pin)&0xF)) 25#define gpio_set_pin_input(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) &= ~_BV((pin)&0xF))
26#define setPinInputHigh(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) |= _BV((pin)&0xF)) 26#define gpio_set_pin_input_high(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) |= _BV((pin)&0xF))
27#define setPinInputLow(pin) _Static_assert(0, "AVR processors cannot implement an input as pull low") 27#define gpio_set_pin_input_low(pin) _Static_assert(0, "GPIO pulldowns in input mode are not available on AVR")
28#define setPinOutputPushPull(pin) (DDRx_ADDRESS(pin) |= _BV((pin)&0xF)) 28#define gpio_set_pin_output_push_pull(pin) (DDRx_ADDRESS(pin) |= _BV((pin)&0xF))
29#define setPinOutputOpenDrain(pin) _Static_assert(0, "AVR platform does not implement an open-drain output") 29#define gpio_set_pin_output_open_drain(pin) _Static_assert(0, "Open-drain outputs are not available on AVR")
30#define setPinOutput(pin) setPinOutputPushPull(pin) 30#define gpio_set_pin_output(pin) gpio_set_pin_output_push_pull(pin)
31 31
32#define writePinHigh(pin) (PORTx_ADDRESS(pin) |= _BV((pin)&0xF)) 32#define gpio_write_pin_high(pin) (PORTx_ADDRESS(pin) |= _BV((pin)&0xF))
33#define writePinLow(pin) (PORTx_ADDRESS(pin) &= ~_BV((pin)&0xF)) 33#define gpio_write_pin_low(pin) (PORTx_ADDRESS(pin) &= ~_BV((pin)&0xF))
34#define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin)) 34#define gpio_write_pin(pin, level) ((level) ? gpio_write_pin_high(pin) : gpio_write_pin_low(pin))
35 35
36#define readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin)&0xF))) 36#define gpio_read_pin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin)&0xF)))
37 37
38#define togglePin(pin) (PORTx_ADDRESS(pin) ^= _BV((pin)&0xF)) 38#define gpio_toggle_pin(pin) (PORTx_ADDRESS(pin) ^= _BV((pin)&0xF))
diff --git a/platforms/chibios/gpio.h b/platforms/chibios/gpio.h
index 80551abac5..a8d6554f29 100644
--- a/platforms/chibios/gpio.h
+++ b/platforms/chibios/gpio.h
@@ -22,24 +22,24 @@ typedef ioline_t pin_t;
22 22
23/* Operation of GPIO by pin. */ 23/* Operation of GPIO by pin. */
24 24
25#define setPinInput(pin) palSetLineMode((pin), PAL_MODE_INPUT) 25#define gpio_set_pin_input(pin) palSetLineMode((pin), PAL_MODE_INPUT)
26#define setPinInputHigh(pin) palSetLineMode((pin), PAL_MODE_INPUT_PULLUP) 26#define gpio_set_pin_input_high(pin) palSetLineMode((pin), PAL_MODE_INPUT_PULLUP)
27#define setPinInputLow(pin) palSetLineMode((pin), PAL_MODE_INPUT_PULLDOWN) 27#define gpio_set_pin_input_low(pin) palSetLineMode((pin), PAL_MODE_INPUT_PULLDOWN)
28#define setPinOutputPushPull(pin) palSetLineMode((pin), PAL_MODE_OUTPUT_PUSHPULL) 28#define gpio_set_pin_output_push_pull(pin) palSetLineMode((pin), PAL_MODE_OUTPUT_PUSHPULL)
29#define setPinOutputOpenDrain(pin) palSetLineMode((pin), PAL_MODE_OUTPUT_OPENDRAIN) 29#define gpio_set_pin_output_open_drain(pin) palSetLineMode((pin), PAL_MODE_OUTPUT_OPENDRAIN)
30#define setPinOutput(pin) setPinOutputPushPull(pin) 30#define gpio_set_pin_output(pin) gpio_set_pin_output_push_pull(pin)
31 31
32#define writePinHigh(pin) palSetLine(pin) 32#define gpio_write_pin_high(pin) palSetLine(pin)
33#define writePinLow(pin) palClearLine(pin) 33#define gpio_write_pin_low(pin) palClearLine(pin)
34#define writePin(pin, level) \ 34#define gpio_write_pin(pin, level) \
35 do { \ 35 do { \
36 if (level) { \ 36 if (level) { \
37 writePinHigh(pin); \ 37 gpio_write_pin_high(pin); \
38 } else { \ 38 } else { \
39 writePinLow(pin); \ 39 gpio_write_pin_low(pin); \
40 } \ 40 } \
41 } while (0) 41 } while (0)
42 42
43#define readPin(pin) palReadLine(pin) 43#define gpio_read_pin(pin) palReadLine(pin)
44 44
45#define togglePin(pin) palToggleLine(pin) 45#define gpio_toggle_pin(pin) palToggleLine(pin)
diff --git a/platforms/gpio.h b/platforms/gpio.h
index b47f6f8e43..6a87e75b01 100644
--- a/platforms/gpio.h
+++ b/platforms/gpio.h
@@ -19,4 +19,21 @@
19 19
20#if __has_include_next("gpio.h") 20#if __has_include_next("gpio.h")
21# include_next "gpio.h" /* Include the platforms gpio.h */ 21# include_next "gpio.h" /* Include the platforms gpio.h */
22#endif \ No newline at end of file 22#endif
23
24// ======== DEPRECATED DEFINES - DO NOT USE ========
25
26#define setPinInput(pin) gpio_set_pin_input(pin)
27#define setPinInputHigh(pin) gpio_set_pin_input_high(pin)
28#define setPinInputLow(pin) gpio_set_pin_input_low(pin)
29#define setPinOutputPushPull(pin) gpio_set_pin_output_push_pull(pin)
30#define setPinOutputOpenDrain(pin) gpio_set_pin_output_open_drain(pin)
31#define setPinOutput(pin) gpio_set_pin_output_push_pull(pin)
32
33#define writePinHigh(pin) gpio_write_pin_high(pin)
34#define writePinLow(pin) gpio_write_pin_low(pin)
35#define writePin(pin, level) gpio_write_pin(pin, level)
36
37#define readPin(pin) gpio_read_pin(pin)
38
39#define togglePin(pin) gpio_toggle_pin(pin)
diff --git a/quantum/encoder/tests/mock.c b/quantum/encoder/tests/mock.c
index 61f2f8294d..1524e61ca4 100644
--- a/quantum/encoder/tests/mock.c
+++ b/quantum/encoder/tests/mock.c
@@ -19,14 +19,14 @@
19bool pins[32] = {0}; 19bool pins[32] = {0};
20bool pinIsInputHigh[32] = {0}; 20bool pinIsInputHigh[32] = {0};
21 21
22uint8_t mockSetPinInputHigh(pin_t pin) { 22uint8_t mock_set_pin_input_high(pin_t pin) {
23 // dprintf("Setting pin %d input high.", pin); 23 // dprintf("Setting pin %d input high.", pin);
24 pins[pin] = true; 24 pins[pin] = true;
25 pinIsInputHigh[pin] = true; 25 pinIsInputHigh[pin] = true;
26 return 0; 26 return 0;
27} 27}
28 28
29bool mockReadPin(pin_t pin) { 29bool mock_read_pin(pin_t pin) {
30 return pins[pin]; 30 return pins[pin];
31} 31}
32 32
diff --git a/quantum/encoder/tests/mock.h b/quantum/encoder/tests/mock.h
index 80c336b5ef..28774b82ab 100644
--- a/quantum/encoder/tests/mock.h
+++ b/quantum/encoder/tests/mock.h
@@ -24,11 +24,11 @@ typedef uint8_t pin_t;
24extern bool pins[]; 24extern bool pins[];
25extern bool pinIsInputHigh[]; 25extern bool pinIsInputHigh[];
26 26
27#define setPinInputHigh(pin) (mockSetPinInputHigh(pin)) 27#define gpio_set_pin_input_high(pin) (mock_set_pin_input_high(pin))
28#define readPin(pin) (mockReadPin(pin)) 28#define gpio_read_pin(pin) (mock_read_pin(pin))
29 29
30uint8_t mockSetPinInputHigh(pin_t pin); 30uint8_t mock_set_pin_input_high(pin_t pin);
31 31
32bool mockReadPin(pin_t pin); 32bool mock_read_pin(pin_t pin);
33 33
34bool setPin(pin_t pin, bool val); 34bool setPin(pin_t pin, bool val);
diff --git a/quantum/encoder/tests/mock_split.c b/quantum/encoder/tests/mock_split.c
index 5cc6cd19e1..f024c2058d 100644
--- a/quantum/encoder/tests/mock_split.c
+++ b/quantum/encoder/tests/mock_split.c
@@ -19,14 +19,14 @@
19bool pins[32] = {0}; 19bool pins[32] = {0};
20bool pinIsInputHigh[32] = {0}; 20bool pinIsInputHigh[32] = {0};
21 21
22uint8_t mockSetPinInputHigh(pin_t pin) { 22uint8_t mock_set_pin_input_high(pin_t pin) {
23 // dprintf("Setting pin %d input high.", pin); 23 // dprintf("Setting pin %d input high.", pin);
24 pins[pin] = true; 24 pins[pin] = true;
25 pinIsInputHigh[pin] = true; 25 pinIsInputHigh[pin] = true;
26 return 0; 26 return 0;
27} 27}
28 28
29bool mockReadPin(pin_t pin) { 29bool mock_read_pin(pin_t pin) {
30 return pins[pin]; 30 return pins[pin];
31} 31}
32 32
diff --git a/quantum/encoder/tests/mock_split.h b/quantum/encoder/tests/mock_split.h
index 2fc12f1830..8b4a141078 100644
--- a/quantum/encoder/tests/mock_split.h
+++ b/quantum/encoder/tests/mock_split.h
@@ -28,11 +28,11 @@ void encoder_update_raw(uint8_t* slave_state);
28extern bool pins[]; 28extern bool pins[];
29extern bool pinIsInputHigh[]; 29extern bool pinIsInputHigh[];
30 30
31#define setPinInputHigh(pin) (mockSetPinInputHigh(pin)) 31#define gpio_set_pin_input_high(pin) (mock_set_pin_input_high(pin))
32#define readPin(pin) (mockReadPin(pin)) 32#define gpio_read_pin(pin) (mock_read_pin(pin))
33 33
34uint8_t mockSetPinInputHigh(pin_t pin); 34uint8_t mock_set_pin_input_high(pin_t pin);
35 35
36bool mockReadPin(pin_t pin); 36bool mock_read_pin(pin_t pin);
37 37
38bool setPin(pin_t pin, bool val); 38bool setPin(pin_t pin, bool val);