diff options
| author | Ryan <fauxpark@gmail.com> | 2024-02-18 17:08:27 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-18 17:08:27 +1100 |
| commit | 2d1aed78a67b3d2b002cc739ef087963b05b76b8 (patch) | |
| tree | ea681d02e547332cffa6b7aec6c16ef37ad70ee3 /tmk_core/protocol | |
| parent | 6810aaf0130113e267e20fb506d874cc858f5f67 (diff) | |
Update GPIO macro usages in core (#23093)
Diffstat (limited to 'tmk_core/protocol')
| -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/>. | |||
| 28 | # define CLOCK_DELAY 10 | 28 | # define CLOCK_DELAY 10 |
| 29 | 29 | ||
| 30 | void shift_init_impl(void) { | 30 | void shift_init_impl(void) { |
| 31 | setPinOutput(SR_EXP_RCLK_PIN); | 31 | gpio_set_pin_output(SR_EXP_RCLK_PIN); |
| 32 | setPinOutput(SPI_DATAOUT_PIN); | 32 | gpio_set_pin_output(SPI_DATAOUT_PIN); |
| 33 | setPinOutput(SPI_SCLK_PIN); | 33 | gpio_set_pin_output(SPI_SCLK_PIN); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | void shift_out_impl(const uint8_t *data, uint16_t length) { | 36 | void shift_out_impl(const uint8_t *data, uint16_t length) { |
| 37 | writePinLow(SR_EXP_RCLK_PIN); | 37 | gpio_write_pin_low(SR_EXP_RCLK_PIN); |
| 38 | for (uint16_t i = 0; i < length; i++) { | 38 | for (uint16_t i = 0; i < length; i++) { |
| 39 | uint8_t val = data[i]; | 39 | uint8_t val = data[i]; |
| 40 | 40 | ||
| 41 | // shift out lsb first | 41 | // shift out lsb first |
| 42 | for (uint8_t bit = 0; bit < 8; bit++) { | 42 | for (uint8_t bit = 0; bit < 8; bit++) { |
| 43 | writePin(SPI_DATAOUT_PIN, !!(val & (1 << bit))); | 43 | gpio_write_pin(SPI_DATAOUT_PIN, !!(val & (1 << bit))); |
| 44 | writePin(SPI_SCLK_PIN, true); | 44 | gpio_write_pin(SPI_SCLK_PIN, true); |
| 45 | wait_us(CLOCK_DELAY); | 45 | wait_us(CLOCK_DELAY); |
| 46 | 46 | ||
| 47 | writePin(SPI_SCLK_PIN, false); | 47 | gpio_write_pin(SPI_SCLK_PIN, false); |
| 48 | wait_us(CLOCK_DELAY); | 48 | wait_us(CLOCK_DELAY); |
| 49 | } | 49 | } |
| 50 | } | 50 | } |
| 51 | writePinHigh(SR_EXP_RCLK_PIN); | 51 | gpio_write_pin_high(SR_EXP_RCLK_PIN); |
| 52 | return SPI_STATUS_SUCCESS; | 52 | return SPI_STATUS_SUCCESS; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| @@ -74,13 +74,13 @@ void shift_out(const uint8_t *data, uint16_t length) { | |||
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | void shift_enable(void) { | 76 | void shift_enable(void) { |
| 77 | setPinOutput(SR_EXP_OE_PIN); | 77 | gpio_set_pin_output(SR_EXP_OE_PIN); |
| 78 | writePinLow(SR_EXP_OE_PIN); | 78 | gpio_write_pin_low(SR_EXP_OE_PIN); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | void shift_disable(void) { | 81 | void shift_disable(void) { |
| 82 | setPinOutput(SR_EXP_OE_PIN); | 82 | gpio_set_pin_output(SR_EXP_OE_PIN); |
| 83 | writePinHigh(SR_EXP_OE_PIN); | 83 | gpio_write_pin_high(SR_EXP_OE_PIN); |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | void shift_init(void) { | 86 | 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) { | |||
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | currentSelectPin = csPin; | 62 | currentSelectPin = csPin; |
| 63 | setPinOutput(currentSelectPin); | 63 | gpio_set_pin_output(currentSelectPin); |
| 64 | writePinLow(currentSelectPin); | 64 | gpio_write_pin_low(currentSelectPin); |
| 65 | 65 | ||
| 66 | SPI_SERCOM->SPI.CTRLA.bit.DORD = lsbFirst; // Data Order - LSB is transferred first | 66 | SPI_SERCOM->SPI.CTRLA.bit.DORD = lsbFirst; // Data Order - LSB is transferred first |
| 67 | SPI_SERCOM->SPI.CTRLA.bit.CPOL = 1; // Clock Polarity - SCK high when idle. Leading edge of cycle is falling. Trailing rising. | 67 | 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) { | |||
| 94 | 94 | ||
| 95 | void spi_stop(void) { | 95 | void spi_stop(void) { |
| 96 | if (currentSelectPin != NO_PIN) { | 96 | if (currentSelectPin != NO_PIN) { |
| 97 | setPinOutput(currentSelectPin); | 97 | gpio_set_pin_output(currentSelectPin); |
| 98 | writePinHigh(currentSelectPin); | 98 | gpio_write_pin_high(currentSelectPin); |
| 99 | currentSelectPin = NO_PIN; | 99 | currentSelectPin = NO_PIN; |
| 100 | } | 100 | } |
| 101 | } | 101 | } |
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) { | |||
| 26 | 26 | ||
| 27 | __attribute__((weak)) bool usb_vbus_state(void) { | 27 | __attribute__((weak)) bool usb_vbus_state(void) { |
| 28 | #ifdef USB_VBUS_PIN | 28 | #ifdef USB_VBUS_PIN |
| 29 | setPinInput(USB_VBUS_PIN); | 29 | gpio_set_pin_input(USB_VBUS_PIN); |
| 30 | wait_us(5); | 30 | wait_us(5); |
| 31 | return readPin(USB_VBUS_PIN); | 31 | return gpio_read_pin(USB_VBUS_PIN); |
| 32 | #else | 32 | #else |
| 33 | return true; | 33 | return true; |
| 34 | #endif | 34 | #endif |
