diff options
author | Ryan <[email protected]> | 2024-02-18 17:08:27 +1100 |
---|---|---|
committer | GitHub <[email protected]> | 2024-02-18 17:08:27 +1100 |
commit | 2d1aed78a67b3d2b002cc739ef087963b05b76b8 (patch) | |
tree | ea681d02e547332cffa6b7aec6c16ef37ad70ee3 /tmk_core | |
parent | 6810aaf0130113e267e20fb506d874cc858f5f67 (diff) | |
download | qmk_firmware-2d1aed78a67b3d2b002cc739ef087963b05b76b8.tar.gz qmk_firmware-2d1aed78a67b3d2b002cc739ef087963b05b76b8.zip |
Update GPIO macro usages in core (#23093)
Diffstat (limited to 'tmk_core')
-rw-r--r-- | tmk_core/protocol/arm_atsam/shift_register.c | 24 | ||||
-rw-r--r-- | tmk_core/protocol/arm_atsam/spi_master.c | 8 | ||||
-rw-r--r-- | tmk_core/protocol/usb_util.c | 4 |
3 files changed, 18 insertions, 18 deletions
diff --git a/tmk_core/protocol/arm_atsam/shift_register.c b/tmk_core/protocol/arm_atsam/shift_register.c index 3adb682aa8..e81db4a19d 100644 --- a/tmk_core/protocol/arm_atsam/shift_register.c +++ b/tmk_core/protocol/arm_atsam/shift_register.c @@ -28,27 +28,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # define CLOCK_DELAY 10 void shift_init_impl(void) { - setPinOutput(SR_EXP_RCLK_PIN); - setPinOutput(SPI_DATAOUT_PIN); - setPinOutput(SPI_SCLK_PIN); + gpio_set_pin_output(SR_EXP_RCLK_PIN); + gpio_set_pin_output(SPI_DATAOUT_PIN); + gpio_set_pin_output(SPI_SCLK_PIN); } void shift_out_impl(const uint8_t *data, uint16_t length) { - writePinLow(SR_EXP_RCLK_PIN); + gpio_write_pin_low(SR_EXP_RCLK_PIN); for (uint16_t i = 0; i < length; i++) { uint8_t val = data[i]; // shift out lsb first for (uint8_t bit = 0; bit < 8; bit++) { - writePin(SPI_DATAOUT_PIN, !!(val & (1 << bit))); - writePin(SPI_SCLK_PIN, true); + gpio_write_pin(SPI_DATAOUT_PIN, !!(val & (1 << bit))); + gpio_write_pin(SPI_SCLK_PIN, true); wait_us(CLOCK_DELAY); - writePin(SPI_SCLK_PIN, false); + gpio_write_pin(SPI_SCLK_PIN, false); wait_us(CLOCK_DELAY); } } - writePinHigh(SR_EXP_RCLK_PIN); + gpio_write_pin_high(SR_EXP_RCLK_PIN); return SPI_STATUS_SUCCESS; } @@ -74,13 +74,13 @@ void shift_out(const uint8_t *data, uint16_t length) { } void shift_enable(void) { - setPinOutput(SR_EXP_OE_PIN); - writePinLow(SR_EXP_OE_PIN); + gpio_set_pin_output(SR_EXP_OE_PIN); + gpio_write_pin_low(SR_EXP_OE_PIN); } void shift_disable(void) { - setPinOutput(SR_EXP_OE_PIN); - writePinHigh(SR_EXP_OE_PIN); + gpio_set_pin_output(SR_EXP_OE_PIN); + gpio_write_pin_high(SR_EXP_OE_PIN); } void shift_init(void) { diff --git a/tmk_core/protocol/arm_atsam/spi_master.c b/tmk_core/protocol/arm_atsam/spi_master.c index 3be82fac1d..fedb9654fd 100644 --- a/tmk_core/protocol/arm_atsam/spi_master.c +++ b/tmk_core/protocol/arm_atsam/spi_master.c @@ -60,8 +60,8 @@ bool spi_start(pin_t csPin, bool lsbFirst, uint8_t mode, uint16_t divisor) { } currentSelectPin = csPin; - setPinOutput(currentSelectPin); - writePinLow(currentSelectPin); + gpio_set_pin_output(currentSelectPin); + gpio_write_pin_low(currentSelectPin); SPI_SERCOM->SPI.CTRLA.bit.DORD = lsbFirst; // Data Order - LSB is transferred first SPI_SERCOM->SPI.CTRLA.bit.CPOL = 1; // Clock Polarity - SCK high when idle. Leading edge of cycle is falling. Trailing rising. @@ -94,8 +94,8 @@ spi_status_t spi_transmit(const uint8_t *data, uint16_t length) { void spi_stop(void) { if (currentSelectPin != NO_PIN) { - setPinOutput(currentSelectPin); - writePinHigh(currentSelectPin); + gpio_set_pin_output(currentSelectPin); + gpio_write_pin_high(currentSelectPin); currentSelectPin = NO_PIN; } } diff --git a/tmk_core/protocol/usb_util.c b/tmk_core/protocol/usb_util.c index 3b3be4a767..a130e8b5e3 100644 --- a/tmk_core/protocol/usb_util.c +++ b/tmk_core/protocol/usb_util.c @@ -26,9 +26,9 @@ __attribute__((weak)) bool usb_connected_state(void) { __attribute__((weak)) bool usb_vbus_state(void) { #ifdef USB_VBUS_PIN - setPinInput(USB_VBUS_PIN); + gpio_set_pin_input(USB_VBUS_PIN); wait_us(5); - return readPin(USB_VBUS_PIN); + return gpio_read_pin(USB_VBUS_PIN); #else return true; #endif |