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 /platforms | |
| parent | 6810aaf0130113e267e20fb506d874cc858f5f67 (diff) | |
Update GPIO macro usages in core (#23093)
Diffstat (limited to 'platforms')
| -rw-r--r-- | platforms/avr/drivers/audio_pwm_hardware.c | 4 | ||||
| -rw-r--r-- | platforms/avr/drivers/backlight_pwm.c | 6 | ||||
| -rw-r--r-- | platforms/avr/drivers/ps2/ps2_io.c | 20 | ||||
| -rw-r--r-- | platforms/avr/drivers/serial.c | 10 | ||||
| -rw-r--r-- | platforms/avr/drivers/spi_master.c | 16 | ||||
| -rw-r--r-- | platforms/chibios/drivers/serial.c | 12 | ||||
| -rw-r--r-- | platforms/chibios/drivers/spi_master.c | 14 | ||||
| -rw-r--r-- | platforms/chibios/drivers/ws2812_bitbang.c | 8 |
8 files changed, 45 insertions, 45 deletions
diff --git a/platforms/avr/drivers/audio_pwm_hardware.c b/platforms/avr/drivers/audio_pwm_hardware.c index 6799cf2fdd..d484fba00f 100644 --- a/platforms/avr/drivers/audio_pwm_hardware.c +++ b/platforms/avr/drivers/audio_pwm_hardware.c | |||
| @@ -216,12 +216,12 @@ void channel_2_stop(void) { | |||
| 216 | void audio_driver_initialize(void) { | 216 | void audio_driver_initialize(void) { |
| 217 | #ifdef AUDIO1_PIN_SET | 217 | #ifdef AUDIO1_PIN_SET |
| 218 | channel_1_stop(); | 218 | channel_1_stop(); |
| 219 | setPinOutput(AUDIO1_PIN); | 219 | gpio_set_pin_output(AUDIO1_PIN); |
| 220 | #endif | 220 | #endif |
| 221 | 221 | ||
| 222 | #ifdef AUDIO2_PIN_SET | 222 | #ifdef AUDIO2_PIN_SET |
| 223 | channel_2_stop(); | 223 | channel_2_stop(); |
| 224 | setPinOutput(AUDIO2_PIN); | 224 | gpio_set_pin_output(AUDIO2_PIN); |
| 225 | #endif | 225 | #endif |
| 226 | 226 | ||
| 227 | // TCCR3A / TCCR3B: Timer/Counter #3 Control Registers TCCR3A/TCCR3B, TCCR1A/TCCR1B | 227 | // TCCR3A / TCCR3B: Timer/Counter #3 Control Registers TCCR3A/TCCR3B, TCCR1A/TCCR1B |
diff --git a/platforms/avr/drivers/backlight_pwm.c b/platforms/avr/drivers/backlight_pwm.c index 74d25753a4..f6ab9391e2 100644 --- a/platforms/avr/drivers/backlight_pwm.c +++ b/platforms/avr/drivers/backlight_pwm.c | |||
| @@ -291,11 +291,11 @@ ISR(TIMERx_OVF_vect) { | |||
| 291 | #endif // BACKLIGHT_BREATHING | 291 | #endif // BACKLIGHT_BREATHING |
| 292 | 292 | ||
| 293 | void backlight_init_ports(void) { | 293 | void backlight_init_ports(void) { |
| 294 | setPinOutput(BACKLIGHT_PIN); | 294 | gpio_set_pin_output(BACKLIGHT_PIN); |
| 295 | #if BACKLIGHT_ON_STATE == 1 | 295 | #if BACKLIGHT_ON_STATE == 1 |
| 296 | writePinLow(BACKLIGHT_PIN); | 296 | gpio_write_pin_low(BACKLIGHT_PIN); |
| 297 | #else | 297 | #else |
| 298 | writePinHigh(BACKLIGHT_PIN); | 298 | gpio_write_pin_high(BACKLIGHT_PIN); |
| 299 | #endif | 299 | #endif |
| 300 | 300 | ||
| 301 | // I could write a wall of text here to explain... but TL;DW | 301 | // I could write a wall of text here to explain... but TL;DW |
diff --git a/platforms/avr/drivers/ps2/ps2_io.c b/platforms/avr/drivers/ps2/ps2_io.c index b75a1ab0be..fb87474372 100644 --- a/platforms/avr/drivers/ps2/ps2_io.c +++ b/platforms/avr/drivers/ps2/ps2_io.c | |||
| @@ -19,18 +19,18 @@ void clock_init(void) {} | |||
| 19 | 19 | ||
| 20 | void clock_lo(void) { | 20 | void clock_lo(void) { |
| 21 | // Transition from input with pull-up to output low via Hi-Z instead of output high | 21 | // Transition from input with pull-up to output low via Hi-Z instead of output high |
| 22 | writePinLow(PS2_CLOCK_PIN); | 22 | gpio_write_pin_low(PS2_CLOCK_PIN); |
| 23 | setPinOutput(PS2_CLOCK_PIN); | 23 | gpio_set_pin_output(PS2_CLOCK_PIN); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | void clock_hi(void) { | 26 | void clock_hi(void) { |
| 27 | setPinInputHigh(PS2_CLOCK_PIN); | 27 | gpio_set_pin_input_high(PS2_CLOCK_PIN); |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | bool clock_in(void) { | 30 | bool clock_in(void) { |
| 31 | setPinInputHigh(PS2_CLOCK_PIN); | 31 | gpio_set_pin_input_high(PS2_CLOCK_PIN); |
| 32 | wait_us(1); | 32 | wait_us(1); |
| 33 | return readPin(PS2_CLOCK_PIN); | 33 | return gpio_read_pin(PS2_CLOCK_PIN); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | /* | 36 | /* |
| @@ -40,16 +40,16 @@ void data_init(void) {} | |||
| 40 | 40 | ||
| 41 | void data_lo(void) { | 41 | void data_lo(void) { |
| 42 | // Transition from input with pull-up to output low via Hi-Z instead of output high | 42 | // Transition from input with pull-up to output low via Hi-Z instead of output high |
| 43 | writePinLow(PS2_DATA_PIN); | 43 | gpio_write_pin_low(PS2_DATA_PIN); |
| 44 | setPinOutput(PS2_DATA_PIN); | 44 | gpio_set_pin_output(PS2_DATA_PIN); |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | void data_hi(void) { | 47 | void data_hi(void) { |
| 48 | setPinInputHigh(PS2_DATA_PIN); | 48 | gpio_set_pin_input_high(PS2_DATA_PIN); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | bool data_in(void) { | 51 | bool data_in(void) { |
| 52 | setPinInputHigh(PS2_DATA_PIN); | 52 | gpio_set_pin_input_high(PS2_DATA_PIN); |
| 53 | wait_us(1); | 53 | wait_us(1); |
| 54 | return readPin(PS2_DATA_PIN); | 54 | return gpio_read_pin(PS2_DATA_PIN); |
| 55 | } | 55 | } |
diff --git a/platforms/avr/drivers/serial.c b/platforms/avr/drivers/serial.c index 730d9b7a01..b529f9b45e 100644 --- a/platforms/avr/drivers/serial.c +++ b/platforms/avr/drivers/serial.c | |||
| @@ -239,28 +239,28 @@ inline static void serial_delay_half2(void) { | |||
| 239 | 239 | ||
| 240 | inline static void serial_output(void) ALWAYS_INLINE; | 240 | inline static void serial_output(void) ALWAYS_INLINE; |
| 241 | inline static void serial_output(void) { | 241 | inline static void serial_output(void) { |
| 242 | setPinOutput(SOFT_SERIAL_PIN); | 242 | gpio_set_pin_output(SOFT_SERIAL_PIN); |
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | // make the serial pin an input with pull-up resistor | 245 | // make the serial pin an input with pull-up resistor |
| 246 | inline static void serial_input_with_pullup(void) ALWAYS_INLINE; | 246 | inline static void serial_input_with_pullup(void) ALWAYS_INLINE; |
| 247 | inline static void serial_input_with_pullup(void) { | 247 | inline static void serial_input_with_pullup(void) { |
| 248 | setPinInputHigh(SOFT_SERIAL_PIN); | 248 | gpio_set_pin_input_high(SOFT_SERIAL_PIN); |
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | inline static uint8_t serial_read_pin(void) ALWAYS_INLINE; | 251 | inline static uint8_t serial_read_pin(void) ALWAYS_INLINE; |
| 252 | inline static uint8_t serial_read_pin(void) { | 252 | inline static uint8_t serial_read_pin(void) { |
| 253 | return !!readPin(SOFT_SERIAL_PIN); | 253 | return !!gpio_read_pin(SOFT_SERIAL_PIN); |
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | inline static void serial_low(void) ALWAYS_INLINE; | 256 | inline static void serial_low(void) ALWAYS_INLINE; |
| 257 | inline static void serial_low(void) { | 257 | inline static void serial_low(void) { |
| 258 | writePinLow(SOFT_SERIAL_PIN); | 258 | gpio_write_pin_low(SOFT_SERIAL_PIN); |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | inline static void serial_high(void) ALWAYS_INLINE; | 261 | inline static void serial_high(void) ALWAYS_INLINE; |
| 262 | inline static void serial_high(void) { | 262 | inline static void serial_high(void) { |
| 263 | writePinHigh(SOFT_SERIAL_PIN); | 263 | gpio_write_pin_high(SOFT_SERIAL_PIN); |
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | void soft_serial_initiator_init(void) { | 266 | void soft_serial_initiator_init(void) { |
diff --git a/platforms/avr/drivers/spi_master.c b/platforms/avr/drivers/spi_master.c index ae9df03c02..74b847c71a 100644 --- a/platforms/avr/drivers/spi_master.c +++ b/platforms/avr/drivers/spi_master.c | |||
| @@ -41,10 +41,10 @@ static uint8_t currentSlaveConfig = 0; | |||
| 41 | static bool currentSlave2X = false; | 41 | static bool currentSlave2X = false; |
| 42 | 42 | ||
| 43 | void spi_init(void) { | 43 | void spi_init(void) { |
| 44 | writePinHigh(SPI_SS_PIN); | 44 | gpio_write_pin_high(SPI_SS_PIN); |
| 45 | setPinOutput(SPI_SCK_PIN); | 45 | gpio_set_pin_output(SPI_SCK_PIN); |
| 46 | setPinOutput(SPI_MOSI_PIN); | 46 | gpio_set_pin_output(SPI_MOSI_PIN); |
| 47 | setPinInput(SPI_MISO_PIN); | 47 | gpio_set_pin_input(SPI_MISO_PIN); |
| 48 | 48 | ||
| 49 | SPCR = (_BV(SPE) | _BV(MSTR)); | 49 | SPCR = (_BV(SPE) | _BV(MSTR)); |
| 50 | } | 50 | } |
| @@ -105,8 +105,8 @@ bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) { | |||
| 105 | SPSR |= _BV(SPI2X); | 105 | SPSR |= _BV(SPI2X); |
| 106 | } | 106 | } |
| 107 | currentSlavePin = slavePin; | 107 | currentSlavePin = slavePin; |
| 108 | setPinOutput(currentSlavePin); | 108 | gpio_set_pin_output(currentSlavePin); |
| 109 | writePinLow(currentSlavePin); | 109 | gpio_write_pin_low(currentSlavePin); |
| 110 | 110 | ||
| 111 | return true; | 111 | return true; |
| 112 | } | 112 | } |
| @@ -169,8 +169,8 @@ spi_status_t spi_receive(uint8_t *data, uint16_t length) { | |||
| 169 | 169 | ||
| 170 | void spi_stop(void) { | 170 | void spi_stop(void) { |
| 171 | if (currentSlavePin != NO_PIN) { | 171 | if (currentSlavePin != NO_PIN) { |
| 172 | setPinOutput(currentSlavePin); | 172 | gpio_set_pin_output(currentSlavePin); |
| 173 | writePinHigh(currentSlavePin); | 173 | gpio_write_pin_high(currentSlavePin); |
| 174 | currentSlavePin = NO_PIN; | 174 | currentSlavePin = NO_PIN; |
| 175 | SPSR &= ~(_BV(SPI2X)); | 175 | SPSR &= ~(_BV(SPI2X)); |
| 176 | SPCR &= ~(currentSlaveConfig); | 176 | SPCR &= ~(currentSlaveConfig); |
diff --git a/platforms/chibios/drivers/serial.c b/platforms/chibios/drivers/serial.c index f199716a2b..fa8481d2dc 100644 --- a/platforms/chibios/drivers/serial.c +++ b/platforms/chibios/drivers/serial.c | |||
| @@ -62,25 +62,25 @@ inline static void serial_delay_blip(void) { | |||
| 62 | wait_us(1); | 62 | wait_us(1); |
| 63 | } | 63 | } |
| 64 | inline static void serial_output(void) { | 64 | inline static void serial_output(void) { |
| 65 | setPinOutput(SOFT_SERIAL_PIN); | 65 | gpio_set_pin_output(SOFT_SERIAL_PIN); |
| 66 | } | 66 | } |
| 67 | inline static void serial_input(void) { | 67 | inline static void serial_input(void) { |
| 68 | setPinInputHigh(SOFT_SERIAL_PIN); | 68 | gpio_set_pin_input_high(SOFT_SERIAL_PIN); |
| 69 | } | 69 | } |
| 70 | inline static bool serial_read_pin(void) { | 70 | inline static bool serial_read_pin(void) { |
| 71 | return !!readPin(SOFT_SERIAL_PIN); | 71 | return !!gpio_read_pin(SOFT_SERIAL_PIN); |
| 72 | } | 72 | } |
| 73 | inline static void serial_low(void) { | 73 | inline static void serial_low(void) { |
| 74 | writePinLow(SOFT_SERIAL_PIN); | 74 | gpio_write_pin_low(SOFT_SERIAL_PIN); |
| 75 | } | 75 | } |
| 76 | inline static void serial_high(void) { | 76 | inline static void serial_high(void) { |
| 77 | writePinHigh(SOFT_SERIAL_PIN); | 77 | gpio_write_pin_high(SOFT_SERIAL_PIN); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | void interrupt_handler(void *arg); | 80 | void interrupt_handler(void *arg); |
| 81 | 81 | ||
| 82 | // Use thread + palWaitLineTimeout instead of palSetLineCallback | 82 | // Use thread + palWaitLineTimeout instead of palSetLineCallback |
| 83 | // - Methods like setPinOutput and palEnableLineEvent/palDisableLineEvent | 83 | // - Methods like gpio_set_pin_output and palEnableLineEvent/palDisableLineEvent |
| 84 | // cause the interrupt to lock up, which would limit to only receiving data... | 84 | // cause the interrupt to lock up, which would limit to only receiving data... |
| 85 | static THD_WORKING_AREA(waThread1, 128); | 85 | static THD_WORKING_AREA(waThread1, 128); |
| 86 | static THD_FUNCTION(Thread1, arg) { | 86 | static THD_FUNCTION(Thread1, arg) { |
diff --git a/platforms/chibios/drivers/spi_master.c b/platforms/chibios/drivers/spi_master.c index 481a2e422a..57fc53d49f 100644 --- a/platforms/chibios/drivers/spi_master.c +++ b/platforms/chibios/drivers/spi_master.c | |||
| @@ -32,12 +32,12 @@ __attribute__((weak)) void spi_init(void) { | |||
| 32 | is_initialised = true; | 32 | is_initialised = true; |
| 33 | 33 | ||
| 34 | // Try releasing special pins for a short time | 34 | // Try releasing special pins for a short time |
| 35 | setPinInput(SPI_SCK_PIN); | 35 | gpio_set_pin_input(SPI_SCK_PIN); |
| 36 | if (SPI_MOSI_PIN != NO_PIN) { | 36 | if (SPI_MOSI_PIN != NO_PIN) { |
| 37 | setPinInput(SPI_MOSI_PIN); | 37 | gpio_set_pin_input(SPI_MOSI_PIN); |
| 38 | } | 38 | } |
| 39 | if (SPI_MISO_PIN != NO_PIN) { | 39 | if (SPI_MISO_PIN != NO_PIN) { |
| 40 | setPinInput(SPI_MISO_PIN); | 40 | gpio_set_pin_input(SPI_MISO_PIN); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | chThdSleepMilliseconds(10); | 43 | chThdSleepMilliseconds(10); |
| @@ -271,10 +271,10 @@ bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) { | |||
| 271 | #if SPI_SELECT_MODE == SPI_SELECT_MODE_PAD | 271 | #if SPI_SELECT_MODE == SPI_SELECT_MODE_PAD |
| 272 | spiConfig.ssport = PAL_PORT(slavePin); | 272 | spiConfig.ssport = PAL_PORT(slavePin); |
| 273 | spiConfig.sspad = PAL_PAD(slavePin); | 273 | spiConfig.sspad = PAL_PAD(slavePin); |
| 274 | setPinOutput(slavePin); | 274 | gpio_set_pin_output(slavePin); |
| 275 | #elif SPI_SELECT_MODE == SPI_SELECT_MODE_NONE | 275 | #elif SPI_SELECT_MODE == SPI_SELECT_MODE_NONE |
| 276 | if (slavePin != NO_PIN) { | 276 | if (slavePin != NO_PIN) { |
| 277 | setPinOutput(slavePin); | 277 | gpio_set_pin_output(slavePin); |
| 278 | } | 278 | } |
| 279 | #else | 279 | #else |
| 280 | # error "Unsupported SPI_SELECT_MODE" | 280 | # error "Unsupported SPI_SELECT_MODE" |
| @@ -284,7 +284,7 @@ bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) { | |||
| 284 | spiSelect(&SPI_DRIVER); | 284 | spiSelect(&SPI_DRIVER); |
| 285 | #if SPI_SELECT_MODE == SPI_SELECT_MODE_NONE | 285 | #if SPI_SELECT_MODE == SPI_SELECT_MODE_NONE |
| 286 | if (slavePin != NO_PIN) { | 286 | if (slavePin != NO_PIN) { |
| 287 | writePinLow(slavePin); | 287 | gpio_write_pin_low(slavePin); |
| 288 | } | 288 | } |
| 289 | #endif | 289 | #endif |
| 290 | 290 | ||
| @@ -319,7 +319,7 @@ void spi_stop(void) { | |||
| 319 | if (spiStarted) { | 319 | if (spiStarted) { |
| 320 | #if SPI_SELECT_MODE == SPI_SELECT_MODE_NONE | 320 | #if SPI_SELECT_MODE == SPI_SELECT_MODE_NONE |
| 321 | if (currentSlavePin != NO_PIN) { | 321 | if (currentSlavePin != NO_PIN) { |
| 322 | writePinHigh(currentSlavePin); | 322 | gpio_write_pin_high(currentSlavePin); |
| 323 | } | 323 | } |
| 324 | #endif | 324 | #endif |
| 325 | spiUnselect(&SPI_DRIVER); | 325 | spiUnselect(&SPI_DRIVER); |
diff --git a/platforms/chibios/drivers/ws2812_bitbang.c b/platforms/chibios/drivers/ws2812_bitbang.c index 883a845d88..593377068b 100644 --- a/platforms/chibios/drivers/ws2812_bitbang.c +++ b/platforms/chibios/drivers/ws2812_bitbang.c | |||
| @@ -57,15 +57,15 @@ void sendByte(uint8_t byte) { | |||
| 57 | // using something like wait_ns(is_one ? T1L : T0L) here throws off timings | 57 | // using something like wait_ns(is_one ? T1L : T0L) here throws off timings |
| 58 | if (is_one) { | 58 | if (is_one) { |
| 59 | // 1 | 59 | // 1 |
| 60 | writePinHigh(WS2812_DI_PIN); | 60 | gpio_write_pin_high(WS2812_DI_PIN); |
| 61 | wait_ns(WS2812_T1H); | 61 | wait_ns(WS2812_T1H); |
| 62 | writePinLow(WS2812_DI_PIN); | 62 | gpio_write_pin_low(WS2812_DI_PIN); |
| 63 | wait_ns(WS2812_T1L); | 63 | wait_ns(WS2812_T1L); |
| 64 | } else { | 64 | } else { |
| 65 | // 0 | 65 | // 0 |
| 66 | writePinHigh(WS2812_DI_PIN); | 66 | gpio_write_pin_high(WS2812_DI_PIN); |
| 67 | wait_ns(WS2812_T0H); | 67 | wait_ns(WS2812_T0H); |
| 68 | writePinLow(WS2812_DI_PIN); | 68 | gpio_write_pin_low(WS2812_DI_PIN); |
| 69 | wait_ns(WS2812_T0L); | 69 | wait_ns(WS2812_T0L); |
| 70 | } | 70 | } |
| 71 | } | 71 | } |
