diff options
61 files changed, 334 insertions, 334 deletions
diff --git a/drivers/bluetooth/bluefruit_le.cpp b/drivers/bluetooth/bluefruit_le.cpp index 39c14ddd13..218eca2195 100644 --- a/drivers/bluetooth/bluefruit_le.cpp +++ b/drivers/bluetooth/bluefruit_le.cpp | |||
| @@ -188,7 +188,7 @@ static bool sdep_recv_pkt(struct sdep_msg *msg, uint16_t timeout) { | |||
| 188 | bool ready = false; | 188 | bool ready = false; |
| 189 | 189 | ||
| 190 | do { | 190 | do { |
| 191 | ready = readPin(BLUEFRUIT_LE_IRQ_PIN); | 191 | ready = gpio_read_pin(BLUEFRUIT_LE_IRQ_PIN); |
| 192 | if (ready) { | 192 | if (ready) { |
| 193 | break; | 193 | break; |
| 194 | } | 194 | } |
| @@ -231,7 +231,7 @@ static void resp_buf_read_one(bool greedy) { | |||
| 231 | return; | 231 | return; |
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | if (readPin(BLUEFRUIT_LE_IRQ_PIN)) { | 234 | if (gpio_read_pin(BLUEFRUIT_LE_IRQ_PIN)) { |
| 235 | struct sdep_msg msg; | 235 | struct sdep_msg msg; |
| 236 | 236 | ||
| 237 | again: | 237 | again: |
| @@ -242,7 +242,7 @@ static void resp_buf_read_one(bool greedy) { | |||
| 242 | dprintf("recv latency %dms\n", TIMER_DIFF_16(timer_read(), last_send)); | 242 | dprintf("recv latency %dms\n", TIMER_DIFF_16(timer_read(), last_send)); |
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | if (greedy && resp_buf.peek(last_send) && readPin(BLUEFRUIT_LE_IRQ_PIN)) { | 245 | if (greedy && resp_buf.peek(last_send) && gpio_read_pin(BLUEFRUIT_LE_IRQ_PIN)) { |
| 246 | goto again; | 246 | goto again; |
| 247 | } | 247 | } |
| 248 | } | 248 | } |
| @@ -293,16 +293,16 @@ void bluefruit_le_init(void) { | |||
| 293 | state.configured = false; | 293 | state.configured = false; |
| 294 | state.is_connected = false; | 294 | state.is_connected = false; |
| 295 | 295 | ||
| 296 | setPinInput(BLUEFRUIT_LE_IRQ_PIN); | 296 | gpio_set_pin_input(BLUEFRUIT_LE_IRQ_PIN); |
| 297 | 297 | ||
| 298 | spi_init(); | 298 | spi_init(); |
| 299 | 299 | ||
| 300 | // Perform a hardware reset | 300 | // Perform a hardware reset |
| 301 | setPinOutput(BLUEFRUIT_LE_RST_PIN); | 301 | gpio_set_pin_output(BLUEFRUIT_LE_RST_PIN); |
| 302 | writePinHigh(BLUEFRUIT_LE_RST_PIN); | 302 | gpio_write_pin_high(BLUEFRUIT_LE_RST_PIN); |
| 303 | writePinLow(BLUEFRUIT_LE_RST_PIN); | 303 | gpio_write_pin_low(BLUEFRUIT_LE_RST_PIN); |
| 304 | wait_ms(10); | 304 | wait_ms(10); |
| 305 | writePinHigh(BLUEFRUIT_LE_RST_PIN); | 305 | gpio_write_pin_high(BLUEFRUIT_LE_RST_PIN); |
| 306 | 306 | ||
| 307 | wait_ms(1000); // Give it a second to initialize | 307 | wait_ms(1000); // Give it a second to initialize |
| 308 | 308 | ||
| @@ -508,7 +508,7 @@ void bluefruit_le_task(void) { | |||
| 508 | resp_buf_read_one(true); | 508 | resp_buf_read_one(true); |
| 509 | send_buf_send_one(SdepShortTimeout); | 509 | send_buf_send_one(SdepShortTimeout); |
| 510 | 510 | ||
| 511 | if (resp_buf.empty() && (state.event_flags & UsingEvents) && readPin(BLUEFRUIT_LE_IRQ_PIN)) { | 511 | if (resp_buf.empty() && (state.event_flags & UsingEvents) && gpio_read_pin(BLUEFRUIT_LE_IRQ_PIN)) { |
| 512 | // Must be an event update | 512 | // Must be an event update |
| 513 | if (at_command_P(PSTR("AT+EVENTSTATUS"), resbuf, sizeof(resbuf))) { | 513 | if (at_command_P(PSTR("AT+EVENTSTATUS"), resbuf, sizeof(resbuf))) { |
| 514 | uint32_t mask = strtoul(resbuf, NULL, 16); | 514 | uint32_t mask = strtoul(resbuf, NULL, 16); |
diff --git a/drivers/eeprom/eeprom_i2c.c b/drivers/eeprom/eeprom_i2c.c index a74a010415..0d3d5ccbe5 100644 --- a/drivers/eeprom/eeprom_i2c.c +++ b/drivers/eeprom/eeprom_i2c.c | |||
| @@ -57,8 +57,8 @@ void eeprom_driver_init(void) { | |||
| 57 | i2c_init(); | 57 | i2c_init(); |
| 58 | #if defined(EXTERNAL_EEPROM_WP_PIN) | 58 | #if defined(EXTERNAL_EEPROM_WP_PIN) |
| 59 | /* We are setting the WP pin to high in a way that requires at least two bit-flips to change back to 0 */ | 59 | /* We are setting the WP pin to high in a way that requires at least two bit-flips to change back to 0 */ |
| 60 | writePin(EXTERNAL_EEPROM_WP_PIN, 1); | 60 | gpio_write_pin(EXTERNAL_EEPROM_WP_PIN, 1); |
| 61 | setPinInputHigh(EXTERNAL_EEPROM_WP_PIN); | 61 | gpio_set_pin_input_high(EXTERNAL_EEPROM_WP_PIN); |
| 62 | #endif | 62 | #endif |
| 63 | } | 63 | } |
| 64 | 64 | ||
| @@ -100,8 +100,8 @@ void eeprom_write_block(const void *buf, void *addr, size_t len) { | |||
| 100 | uintptr_t target_addr = (uintptr_t)addr; | 100 | uintptr_t target_addr = (uintptr_t)addr; |
| 101 | 101 | ||
| 102 | #if defined(EXTERNAL_EEPROM_WP_PIN) | 102 | #if defined(EXTERNAL_EEPROM_WP_PIN) |
| 103 | setPinOutput(EXTERNAL_EEPROM_WP_PIN); | 103 | gpio_set_pin_output(EXTERNAL_EEPROM_WP_PIN); |
| 104 | writePin(EXTERNAL_EEPROM_WP_PIN, 0); | 104 | gpio_write_pin(EXTERNAL_EEPROM_WP_PIN, 0); |
| 105 | #endif | 105 | #endif |
| 106 | 106 | ||
| 107 | while (len > 0) { | 107 | while (len > 0) { |
| @@ -134,7 +134,7 @@ void eeprom_write_block(const void *buf, void *addr, size_t len) { | |||
| 134 | 134 | ||
| 135 | #if defined(EXTERNAL_EEPROM_WP_PIN) | 135 | #if defined(EXTERNAL_EEPROM_WP_PIN) |
| 136 | /* We are setting the WP pin to high in a way that requires at least two bit-flips to change back to 0 */ | 136 | /* We are setting the WP pin to high in a way that requires at least two bit-flips to change back to 0 */ |
| 137 | writePin(EXTERNAL_EEPROM_WP_PIN, 1); | 137 | gpio_write_pin(EXTERNAL_EEPROM_WP_PIN, 1); |
| 138 | setPinInputHigh(EXTERNAL_EEPROM_WP_PIN); | 138 | gpio_set_pin_input_high(EXTERNAL_EEPROM_WP_PIN); |
| 139 | #endif | 139 | #endif |
| 140 | } | 140 | } |
diff --git a/drivers/gpio/sn74x138.c b/drivers/gpio/sn74x138.c index 222e5db56c..1cf8e54f56 100644 --- a/drivers/gpio/sn74x138.c +++ b/drivers/gpio/sn74x138.c | |||
| @@ -27,39 +27,39 @@ static const pin_t address_pins[ADDRESS_PIN_COUNT] = SN74X138_ADDRESS_PINS; | |||
| 27 | 27 | ||
| 28 | void sn74x138_init(void) { | 28 | void sn74x138_init(void) { |
| 29 | for (int i = 0; i < ADDRESS_PIN_COUNT; i++) { | 29 | for (int i = 0; i < ADDRESS_PIN_COUNT; i++) { |
| 30 | setPinOutput(address_pins[i]); | 30 | gpio_set_pin_output(address_pins[i]); |
| 31 | writePinLow(address_pins[i]); | 31 | gpio_write_pin_low(address_pins[i]); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | #if defined(SN74X138_E1_PIN) | 34 | #if defined(SN74X138_E1_PIN) |
| 35 | setPinOutput(SN74X138_E1_PIN); | 35 | gpio_set_pin_output(SN74X138_E1_PIN); |
| 36 | writePinHigh(SN74X138_E1_PIN); | 36 | gpio_write_pin_high(SN74X138_E1_PIN); |
| 37 | #endif | 37 | #endif |
| 38 | 38 | ||
| 39 | #if defined(SN74X138_E2_PIN) | 39 | #if defined(SN74X138_E2_PIN) |
| 40 | setPinOutput(SN74X138_E2_PIN); | 40 | gpio_set_pin_output(SN74X138_E2_PIN); |
| 41 | writePinHigh(SN74X138_E2_PIN); | 41 | gpio_write_pin_high(SN74X138_E2_PIN); |
| 42 | #endif | 42 | #endif |
| 43 | #if defined(SN74X138_E3_PIN) | 43 | #if defined(SN74X138_E3_PIN) |
| 44 | setPinOutput(SN74X138_E3_PIN); | 44 | gpio_set_pin_output(SN74X138_E3_PIN); |
| 45 | writePinLow(SN74X138_E3_PIN); | 45 | gpio_write_pin_low(SN74X138_E3_PIN); |
| 46 | #endif | 46 | #endif |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | void sn74x138_set_enabled(bool enabled) { | 49 | void sn74x138_set_enabled(bool enabled) { |
| 50 | #if defined(SN74X138_E1_PIN) | 50 | #if defined(SN74X138_E1_PIN) |
| 51 | writePin(SN74X138_E1_PIN, !enabled); | 51 | gpio_write_pin(SN74X138_E1_PIN, !enabled); |
| 52 | #endif | 52 | #endif |
| 53 | #if defined(SN74X138_E2_PIN) | 53 | #if defined(SN74X138_E2_PIN) |
| 54 | writePin(SN74X138_E2_PIN, !enabled); | 54 | gpio_write_pin(SN74X138_E2_PIN, !enabled); |
| 55 | #endif | 55 | #endif |
| 56 | #if defined(SN74X138_E3_PIN) | 56 | #if defined(SN74X138_E3_PIN) |
| 57 | writePin(SN74X138_E3_PIN, enabled); | 57 | gpio_write_pin(SN74X138_E3_PIN, enabled); |
| 58 | #endif | 58 | #endif |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | void sn74x138_set_addr(uint8_t address) { | 61 | void sn74x138_set_addr(uint8_t address) { |
| 62 | for (int i = 0; i < ADDRESS_PIN_COUNT; i++) { | 62 | for (int i = 0; i < ADDRESS_PIN_COUNT; i++) { |
| 63 | writePin(address_pins[i], address & (1 << i)); | 63 | gpio_write_pin(address_pins[i], address & (1 << i)); |
| 64 | } | 64 | } |
| 65 | } | 65 | } |
diff --git a/drivers/gpio/sn74x154.c b/drivers/gpio/sn74x154.c index 5f21f12b55..6226adf27e 100644 --- a/drivers/gpio/sn74x154.c +++ b/drivers/gpio/sn74x154.c | |||
| @@ -27,32 +27,32 @@ static const pin_t address_pins[ADDRESS_PIN_COUNT] = SN74X154_ADDRESS_PINS; | |||
| 27 | 27 | ||
| 28 | void sn74x154_init(void) { | 28 | void sn74x154_init(void) { |
| 29 | for (int i = 0; i < ADDRESS_PIN_COUNT; i++) { | 29 | for (int i = 0; i < ADDRESS_PIN_COUNT; i++) { |
| 30 | setPinOutput(address_pins[i]); | 30 | gpio_set_pin_output(address_pins[i]); |
| 31 | writePinLow(address_pins[i]); | 31 | gpio_write_pin_low(address_pins[i]); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | #if defined(SN74X154_E0_PIN) | 34 | #if defined(SN74X154_E0_PIN) |
| 35 | setPinOutput(SN74X154_E0_PIN); | 35 | gpio_set_pin_output(SN74X154_E0_PIN); |
| 36 | writePinHigh(SN74X154_E0_PIN); | 36 | gpio_write_pin_high(SN74X154_E0_PIN); |
| 37 | #endif | 37 | #endif |
| 38 | 38 | ||
| 39 | #if defined(SN74X154_E1_PIN) | 39 | #if defined(SN74X154_E1_PIN) |
| 40 | setPinOutput(SN74X154_E1_PIN); | 40 | gpio_set_pin_output(SN74X154_E1_PIN); |
| 41 | writePinHigh(SN74X154_E1_PIN); | 41 | gpio_write_pin_high(SN74X154_E1_PIN); |
| 42 | #endif | 42 | #endif |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | void sn74x154_set_enabled(bool enabled) { | 45 | void sn74x154_set_enabled(bool enabled) { |
| 46 | #if defined(SN74X154_E0_PIN) | 46 | #if defined(SN74X154_E0_PIN) |
| 47 | writePin(SN74X154_E0_PIN, !enabled); | 47 | gpio_write_pin(SN74X154_E0_PIN, !enabled); |
| 48 | #endif | 48 | #endif |
| 49 | #if defined(SN74X154_E1_PIN) | 49 | #if defined(SN74X154_E1_PIN) |
| 50 | writePin(SN74X154_E1_PIN, !enabled); | 50 | gpio_write_pin(SN74X154_E1_PIN, !enabled); |
| 51 | #endif | 51 | #endif |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | void sn74x154_set_addr(uint8_t address) { | 54 | void sn74x154_set_addr(uint8_t address) { |
| 55 | for (int i = 0; i < ADDRESS_PIN_COUNT; i++) { | 55 | for (int i = 0; i < ADDRESS_PIN_COUNT; i++) { |
| 56 | writePin(address_pins[i], address & (1 << i)); | 56 | gpio_write_pin(address_pins[i], address & (1 << i)); |
| 57 | } | 57 | } |
| 58 | } | 58 | } |
diff --git a/drivers/haptic/solenoid.c b/drivers/haptic/solenoid.c index da4095cda4..346b88bbc4 100644 --- a/drivers/haptic/solenoid.c +++ b/drivers/haptic/solenoid.c | |||
| @@ -61,7 +61,7 @@ void solenoid_set_dwell(uint8_t dwell) { | |||
| 61 | * @param index select which solenoid to check/stop | 61 | * @param index select which solenoid to check/stop |
| 62 | */ | 62 | */ |
| 63 | void solenoid_stop(uint8_t index) { | 63 | void solenoid_stop(uint8_t index) { |
| 64 | writePin(solenoid_pads[index], !solenoid_active_state[index]); | 64 | gpio_write_pin(solenoid_pads[index], !solenoid_active_state[index]); |
| 65 | solenoid_on[index] = false; | 65 | solenoid_on[index] = false; |
| 66 | solenoid_buzzing[index] = false; | 66 | solenoid_buzzing[index] = false; |
| 67 | } | 67 | } |
| @@ -78,7 +78,7 @@ void solenoid_fire(uint8_t index) { | |||
| 78 | solenoid_on[index] = true; | 78 | solenoid_on[index] = true; |
| 79 | solenoid_buzzing[index] = true; | 79 | solenoid_buzzing[index] = true; |
| 80 | solenoid_start[index] = timer_read(); | 80 | solenoid_start[index] = timer_read(); |
| 81 | writePin(solenoid_pads[index], solenoid_active_state[index]); | 81 | gpio_write_pin(solenoid_pads[index], solenoid_active_state[index]); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | /** | 84 | /** |
| @@ -128,12 +128,12 @@ void solenoid_check(void) { | |||
| 128 | if ((elapsed[i] % (SOLENOID_BUZZ_ACTUATED + SOLENOID_BUZZ_NONACTUATED)) < SOLENOID_BUZZ_ACTUATED) { | 128 | if ((elapsed[i] % (SOLENOID_BUZZ_ACTUATED + SOLENOID_BUZZ_NONACTUATED)) < SOLENOID_BUZZ_ACTUATED) { |
| 129 | if (!solenoid_buzzing[i]) { | 129 | if (!solenoid_buzzing[i]) { |
| 130 | solenoid_buzzing[i] = true; | 130 | solenoid_buzzing[i] = true; |
| 131 | writePin(solenoid_pads[i], solenoid_active_state[i]); | 131 | gpio_write_pin(solenoid_pads[i], solenoid_active_state[i]); |
| 132 | } | 132 | } |
| 133 | } else { | 133 | } else { |
| 134 | if (solenoid_buzzing[i]) { | 134 | if (solenoid_buzzing[i]) { |
| 135 | solenoid_buzzing[i] = false; | 135 | solenoid_buzzing[i] = false; |
| 136 | writePin(solenoid_pads[i], !solenoid_active_state[i]); | 136 | gpio_write_pin(solenoid_pads[i], !solenoid_active_state[i]); |
| 137 | } | 137 | } |
| 138 | } | 138 | } |
| 139 | } | 139 | } |
| @@ -156,8 +156,8 @@ void solenoid_setup(void) { | |||
| 156 | #else | 156 | #else |
| 157 | solenoid_active_state[i] = high; | 157 | solenoid_active_state[i] = high; |
| 158 | #endif | 158 | #endif |
| 159 | writePin(solenoid_pads[i], !solenoid_active_state[i]); | 159 | gpio_write_pin(solenoid_pads[i], !solenoid_active_state[i]); |
| 160 | setPinOutput(solenoid_pads[i]); | 160 | gpio_set_pin_output(solenoid_pads[i]); |
| 161 | if ((!HAPTIC_OFF_IN_LOW_POWER) || (usb_device_state == USB_DEVICE_STATE_CONFIGURED)) { | 161 | if ((!HAPTIC_OFF_IN_LOW_POWER) || (usb_device_state == USB_DEVICE_STATE_CONFIGURED)) { |
| 162 | solenoid_fire(i); | 162 | solenoid_fire(i); |
| 163 | } | 163 | } |
| @@ -170,6 +170,6 @@ void solenoid_setup(void) { | |||
| 170 | */ | 170 | */ |
| 171 | void solenoid_shutdown(void) { | 171 | void solenoid_shutdown(void) { |
| 172 | for (uint8_t i = 0; i < NUMBER_OF_SOLENOIDS; i++) { | 172 | for (uint8_t i = 0; i < NUMBER_OF_SOLENOIDS; i++) { |
| 173 | writePin(solenoid_pads[i], !solenoid_active_state[i]); | 173 | gpio_write_pin(solenoid_pads[i], !solenoid_active_state[i]); |
| 174 | } | 174 | } |
| 175 | } | 175 | } |
diff --git a/drivers/lcd/hd44780.c b/drivers/lcd/hd44780.c index ccc50117ab..9b4e2f0226 100644 --- a/drivers/lcd/hd44780.c +++ b/drivers/lcd/hd44780.c | |||
| @@ -57,67 +57,67 @@ static const pin_t data_pins[4] = HD44780_DATA_PINS; | |||
| 57 | #define HD44780_ENABLE_DELAY_US 1 | 57 | #define HD44780_ENABLE_DELAY_US 1 |
| 58 | 58 | ||
| 59 | static void hd44780_latch(void) { | 59 | static void hd44780_latch(void) { |
| 60 | writePinHigh(HD44780_E_PIN); | 60 | gpio_write_pin_high(HD44780_E_PIN); |
| 61 | wait_us(HD44780_ENABLE_DELAY_US); | 61 | wait_us(HD44780_ENABLE_DELAY_US); |
| 62 | writePinLow(HD44780_E_PIN); | 62 | gpio_write_pin_low(HD44780_E_PIN); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | void hd44780_write(uint8_t data, bool isData) { | 65 | void hd44780_write(uint8_t data, bool isData) { |
| 66 | writePin(HD44780_RS_PIN, isData); | 66 | gpio_write_pin(HD44780_RS_PIN, isData); |
| 67 | writePinLow(HD44780_RW_PIN); | 67 | gpio_write_pin_low(HD44780_RW_PIN); |
| 68 | 68 | ||
| 69 | for (int i = 0; i < 4; i++) { | 69 | for (int i = 0; i < 4; i++) { |
| 70 | setPinOutput(data_pins[i]); | 70 | gpio_set_pin_output(data_pins[i]); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | // Write high nibble | 73 | // Write high nibble |
| 74 | for (int i = 0; i < 4; i++) { | 74 | for (int i = 0; i < 4; i++) { |
| 75 | writePin(data_pins[i], (data >> 4) & (1 << i)); | 75 | gpio_write_pin(data_pins[i], (data >> 4) & (1 << i)); |
| 76 | } | 76 | } |
| 77 | hd44780_latch(); | 77 | hd44780_latch(); |
| 78 | 78 | ||
| 79 | // Write low nibble | 79 | // Write low nibble |
| 80 | for (int i = 0; i < 4; i++) { | 80 | for (int i = 0; i < 4; i++) { |
| 81 | writePin(data_pins[i], data & (1 << i)); | 81 | gpio_write_pin(data_pins[i], data & (1 << i)); |
| 82 | } | 82 | } |
| 83 | hd44780_latch(); | 83 | hd44780_latch(); |
| 84 | 84 | ||
| 85 | for (int i = 0; i < 4; i++) { | 85 | for (int i = 0; i < 4; i++) { |
| 86 | writePinHigh(data_pins[i]); | 86 | gpio_write_pin_high(data_pins[i]); |
| 87 | } | 87 | } |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | uint8_t hd44780_read(bool isData) { | 90 | uint8_t hd44780_read(bool isData) { |
| 91 | uint8_t data = 0; | 91 | uint8_t data = 0; |
| 92 | 92 | ||
| 93 | writePin(HD44780_RS_PIN, isData); | 93 | gpio_write_pin(HD44780_RS_PIN, isData); |
| 94 | writePinHigh(HD44780_RW_PIN); | 94 | gpio_write_pin_high(HD44780_RW_PIN); |
| 95 | 95 | ||
| 96 | for (int i = 0; i < 4; i++) { | 96 | for (int i = 0; i < 4; i++) { |
| 97 | setPinInput(data_pins[i]); | 97 | gpio_set_pin_input(data_pins[i]); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | writePinHigh(HD44780_E_PIN); | 100 | gpio_write_pin_high(HD44780_E_PIN); |
| 101 | wait_us(HD44780_ENABLE_DELAY_US); | 101 | wait_us(HD44780_ENABLE_DELAY_US); |
| 102 | 102 | ||
| 103 | // Read high nibble | 103 | // Read high nibble |
| 104 | for (int i = 0; i < 4; i++) { | 104 | for (int i = 0; i < 4; i++) { |
| 105 | data |= (readPin(data_pins[i]) << i); | 105 | data |= (gpio_read_pin(data_pins[i]) << i); |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | data <<= 4; | 108 | data <<= 4; |
| 109 | 109 | ||
| 110 | writePinLow(HD44780_E_PIN); | 110 | gpio_write_pin_low(HD44780_E_PIN); |
| 111 | wait_us(HD44780_ENABLE_DELAY_US); | 111 | wait_us(HD44780_ENABLE_DELAY_US); |
| 112 | writePinHigh(HD44780_E_PIN); | 112 | gpio_write_pin_high(HD44780_E_PIN); |
| 113 | wait_us(HD44780_ENABLE_DELAY_US); | 113 | wait_us(HD44780_ENABLE_DELAY_US); |
| 114 | 114 | ||
| 115 | // Read low nibble | 115 | // Read low nibble |
| 116 | for (int i = 0; i < 4; i++) { | 116 | for (int i = 0; i < 4; i++) { |
| 117 | data |= (readPin(data_pins[i]) << i); | 117 | data |= (gpio_read_pin(data_pins[i]) << i); |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | writePinLow(HD44780_E_PIN); | 120 | gpio_write_pin_low(HD44780_E_PIN); |
| 121 | 121 | ||
| 122 | return data; | 122 | return data; |
| 123 | } | 123 | } |
| @@ -171,20 +171,20 @@ void hd44780_set_ddram_address(uint8_t address) { | |||
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | void hd44780_init(bool cursor, bool blink) { | 173 | void hd44780_init(bool cursor, bool blink) { |
| 174 | setPinOutput(HD44780_RS_PIN); | 174 | gpio_set_pin_output(HD44780_RS_PIN); |
| 175 | setPinOutput(HD44780_RW_PIN); | 175 | gpio_set_pin_output(HD44780_RW_PIN); |
| 176 | setPinOutput(HD44780_E_PIN); | 176 | gpio_set_pin_output(HD44780_E_PIN); |
| 177 | 177 | ||
| 178 | for (int i = 0; i < 4; i++) { | 178 | for (int i = 0; i < 4; i++) { |
| 179 | setPinOutput(data_pins[i]); | 179 | gpio_set_pin_output(data_pins[i]); |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | wait_ms(HD44780_INIT_DELAY_MS); | 182 | wait_ms(HD44780_INIT_DELAY_MS); |
| 183 | 183 | ||
| 184 | // Manually configure for 4-bit mode - can't use hd44780_command() yet | 184 | // Manually configure for 4-bit mode - can't use hd44780_command() yet |
| 185 | // HD44780U datasheet, Fig. 24 (p46) | 185 | // HD44780U datasheet, Fig. 24 (p46) |
| 186 | writePinHigh(data_pins[0]); // Function set | 186 | gpio_write_pin_high(data_pins[0]); // Function set |
| 187 | writePinHigh(data_pins[1]); // DL = 1 | 187 | gpio_write_pin_high(data_pins[1]); // DL = 1 |
| 188 | hd44780_latch(); | 188 | hd44780_latch(); |
| 189 | wait_ms(5); | 189 | wait_ms(5); |
| 190 | // Send again | 190 | // Send again |
| @@ -194,7 +194,7 @@ void hd44780_init(bool cursor, bool blink) { | |||
| 194 | hd44780_latch(); | 194 | hd44780_latch(); |
| 195 | wait_us(64); | 195 | wait_us(64); |
| 196 | 196 | ||
| 197 | writePinLow(data_pins[0]); // DL = 0 | 197 | gpio_write_pin_low(data_pins[0]); // DL = 0 |
| 198 | hd44780_latch(); | 198 | hd44780_latch(); |
| 199 | wait_us(64); | 199 | wait_us(64); |
| 200 | 200 | ||
diff --git a/drivers/lcd/st7565.c b/drivers/lcd/st7565.c index 47ee02804b..4fce40edbe 100644 --- a/drivers/lcd/st7565.c +++ b/drivers/lcd/st7565.c | |||
| @@ -92,10 +92,10 @@ static void InvertCharacter(uint8_t *cursor) { | |||
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | bool st7565_init(display_rotation_t rotation) { | 94 | bool st7565_init(display_rotation_t rotation) { |
| 95 | setPinOutput(ST7565_A0_PIN); | 95 | gpio_set_pin_output(ST7565_A0_PIN); |
| 96 | writePinHigh(ST7565_A0_PIN); | 96 | gpio_write_pin_high(ST7565_A0_PIN); |
| 97 | setPinOutput(ST7565_RST_PIN); | 97 | gpio_set_pin_output(ST7565_RST_PIN); |
| 98 | writePinHigh(ST7565_RST_PIN); | 98 | gpio_write_pin_high(ST7565_RST_PIN); |
| 99 | 99 | ||
| 100 | st7565_rotation = st7565_init_user(rotation); | 100 | st7565_rotation = st7565_init_user(rotation); |
| 101 | 101 | ||
| @@ -488,18 +488,18 @@ void st7565_task(void) { | |||
| 488 | __attribute__((weak)) void st7565_task_user(void) {} | 488 | __attribute__((weak)) void st7565_task_user(void) {} |
| 489 | 489 | ||
| 490 | void st7565_reset(void) { | 490 | void st7565_reset(void) { |
| 491 | writePinLow(ST7565_RST_PIN); | 491 | gpio_write_pin_low(ST7565_RST_PIN); |
| 492 | wait_ms(20); | 492 | wait_ms(20); |
| 493 | writePinHigh(ST7565_RST_PIN); | 493 | gpio_write_pin_high(ST7565_RST_PIN); |
| 494 | wait_ms(20); | 494 | wait_ms(20); |
| 495 | } | 495 | } |
| 496 | 496 | ||
| 497 | spi_status_t st7565_send_cmd(uint8_t cmd) { | 497 | spi_status_t st7565_send_cmd(uint8_t cmd) { |
| 498 | writePinLow(ST7565_A0_PIN); | 498 | gpio_write_pin_low(ST7565_A0_PIN); |
| 499 | return spi_write(cmd); | 499 | return spi_write(cmd); |
| 500 | } | 500 | } |
| 501 | 501 | ||
| 502 | spi_status_t st7565_send_data(uint8_t *data, uint16_t length) { | 502 | spi_status_t st7565_send_data(uint8_t *data, uint16_t length) { |
| 503 | writePinHigh(ST7565_A0_PIN); | 503 | gpio_write_pin_high(ST7565_A0_PIN); |
| 504 | return spi_transmit(data, length); | 504 | return spi_transmit(data, length); |
| 505 | } | 505 | } |
diff --git a/drivers/led/apa102.c b/drivers/led/apa102.c index 548b8f094e..d6d4327495 100644 --- a/drivers/led/apa102.c +++ b/drivers/led/apa102.c | |||
| @@ -43,14 +43,14 @@ | |||
| 43 | } \ | 43 | } \ |
| 44 | } while (0) | 44 | } while (0) |
| 45 | 45 | ||
| 46 | #define APA102_SEND_BIT(byte, bit) \ | 46 | #define APA102_SEND_BIT(byte, bit) \ |
| 47 | do { \ | 47 | do { \ |
| 48 | writePin(APA102_DI_PIN, (byte >> bit) & 1); \ | 48 | gpio_write_pin(APA102_DI_PIN, (byte >> bit) & 1); \ |
| 49 | io_wait; \ | 49 | io_wait; \ |
| 50 | writePinHigh(APA102_CI_PIN); \ | 50 | gpio_write_pin_high(APA102_CI_PIN); \ |
| 51 | io_wait; \ | 51 | io_wait; \ |
| 52 | writePinLow(APA102_CI_PIN); \ | 52 | gpio_write_pin_low(APA102_CI_PIN); \ |
| 53 | io_wait; \ | 53 | io_wait; \ |
| 54 | } while (0) | 54 | } while (0) |
| 55 | 55 | ||
| 56 | uint8_t apa102_led_brightness = APA102_DEFAULT_BRIGHTNESS; | 56 | uint8_t apa102_led_brightness = APA102_DEFAULT_BRIGHTNESS; |
| @@ -114,11 +114,11 @@ static void apa102_send_frame(uint8_t red, uint8_t green, uint8_t blue, uint8_t | |||
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | void apa102_init(void) { | 116 | void apa102_init(void) { |
| 117 | setPinOutput(APA102_DI_PIN); | 117 | gpio_set_pin_output(APA102_DI_PIN); |
| 118 | setPinOutput(APA102_CI_PIN); | 118 | gpio_set_pin_output(APA102_CI_PIN); |
| 119 | 119 | ||
| 120 | writePinLow(APA102_DI_PIN); | 120 | gpio_write_pin_low(APA102_DI_PIN); |
| 121 | writePinLow(APA102_CI_PIN); | 121 | gpio_write_pin_low(APA102_CI_PIN); |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | void apa102_setleds(rgb_led_t *start_led, uint16_t num_leds) { | 124 | void apa102_setleds(rgb_led_t *start_led, uint16_t num_leds) { |
diff --git a/drivers/led/aw20216s.c b/drivers/led/aw20216s.c index fa4454b6b1..704794f5b5 100644 --- a/drivers/led/aw20216s.c +++ b/drivers/led/aw20216s.c | |||
| @@ -114,8 +114,8 @@ void aw20216s_init_drivers(void) { | |||
| 114 | spi_init(); | 114 | spi_init(); |
| 115 | 115 | ||
| 116 | #if defined(AW20216S_EN_PIN) | 116 | #if defined(AW20216S_EN_PIN) |
| 117 | setPinOutput(AW20216S_EN_PIN); | 117 | gpio_set_pin_output(AW20216S_EN_PIN); |
| 118 | writePinHigh(AW20216S_EN_PIN); | 118 | gpio_write_pin_high(AW20216S_EN_PIN); |
| 119 | #endif | 119 | #endif |
| 120 | 120 | ||
| 121 | aw20216s_init(AW20216S_CS_PIN_1); | 121 | aw20216s_init(AW20216S_CS_PIN_1); |
diff --git a/drivers/led/issi/is31fl3218-mono.c b/drivers/led/issi/is31fl3218-mono.c index cb5a069160..0174da7ab3 100644 --- a/drivers/led/issi/is31fl3218-mono.c +++ b/drivers/led/issi/is31fl3218-mono.c | |||
| @@ -68,8 +68,8 @@ void is31fl3218_init(void) { | |||
| 68 | i2c_init(); | 68 | i2c_init(); |
| 69 | 69 | ||
| 70 | #if defined(IS31FL3218_SDB_PIN) | 70 | #if defined(IS31FL3218_SDB_PIN) |
| 71 | setPinOutput(IS31FL3218_SDB_PIN); | 71 | gpio_set_pin_output(IS31FL3218_SDB_PIN); |
| 72 | writePinHigh(IS31FL3218_SDB_PIN); | 72 | gpio_write_pin_high(IS31FL3218_SDB_PIN); |
| 73 | #endif | 73 | #endif |
| 74 | 74 | ||
| 75 | // In case we ever want to reinitialize (?) | 75 | // In case we ever want to reinitialize (?) |
diff --git a/drivers/led/issi/is31fl3218.c b/drivers/led/issi/is31fl3218.c index c3a0946e83..dd97d236f7 100644 --- a/drivers/led/issi/is31fl3218.c +++ b/drivers/led/issi/is31fl3218.c | |||
| @@ -68,8 +68,8 @@ void is31fl3218_init(void) { | |||
| 68 | i2c_init(); | 68 | i2c_init(); |
| 69 | 69 | ||
| 70 | #if defined(IS31FL3218_SDB_PIN) | 70 | #if defined(IS31FL3218_SDB_PIN) |
| 71 | setPinOutput(IS31FL3218_SDB_PIN); | 71 | gpio_set_pin_output(IS31FL3218_SDB_PIN); |
| 72 | writePinHigh(IS31FL3218_SDB_PIN); | 72 | gpio_write_pin_high(IS31FL3218_SDB_PIN); |
| 73 | #endif | 73 | #endif |
| 74 | 74 | ||
| 75 | // In case we ever want to reinitialize (?) | 75 | // In case we ever want to reinitialize (?) |
diff --git a/drivers/led/issi/is31fl3731-mono.c b/drivers/led/issi/is31fl3731-mono.c index 5ff8f8b7c5..33a863b982 100644 --- a/drivers/led/issi/is31fl3731-mono.c +++ b/drivers/led/issi/is31fl3731-mono.c | |||
| @@ -99,8 +99,8 @@ void is31fl3731_init_drivers(void) { | |||
| 99 | i2c_init(); | 99 | i2c_init(); |
| 100 | 100 | ||
| 101 | #if defined(IS31FL3731_SDB_PIN) | 101 | #if defined(IS31FL3731_SDB_PIN) |
| 102 | setPinOutput(IS31FL3731_SDB_PIN); | 102 | gpio_set_pin_output(IS31FL3731_SDB_PIN); |
| 103 | writePinHigh(IS31FL3731_SDB_PIN); | 103 | gpio_write_pin_high(IS31FL3731_SDB_PIN); |
| 104 | #endif | 104 | #endif |
| 105 | 105 | ||
| 106 | for (uint8_t i = 0; i < IS31FL3731_DRIVER_COUNT; i++) { | 106 | for (uint8_t i = 0; i < IS31FL3731_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/issi/is31fl3731.c b/drivers/led/issi/is31fl3731.c index 380861d5b8..86d953ef25 100644 --- a/drivers/led/issi/is31fl3731.c +++ b/drivers/led/issi/is31fl3731.c | |||
| @@ -98,8 +98,8 @@ void is31fl3731_init_drivers(void) { | |||
| 98 | i2c_init(); | 98 | i2c_init(); |
| 99 | 99 | ||
| 100 | #if defined(IS31FL3731_SDB_PIN) | 100 | #if defined(IS31FL3731_SDB_PIN) |
| 101 | setPinOutput(IS31FL3731_SDB_PIN); | 101 | gpio_set_pin_output(IS31FL3731_SDB_PIN); |
| 102 | writePinHigh(IS31FL3731_SDB_PIN); | 102 | gpio_write_pin_high(IS31FL3731_SDB_PIN); |
| 103 | #endif | 103 | #endif |
| 104 | 104 | ||
| 105 | for (uint8_t i = 0; i < IS31FL3731_DRIVER_COUNT; i++) { | 105 | for (uint8_t i = 0; i < IS31FL3731_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/issi/is31fl3733-mono.c b/drivers/led/issi/is31fl3733-mono.c index 13f2d9b983..740fe06097 100644 --- a/drivers/led/issi/is31fl3733-mono.c +++ b/drivers/led/issi/is31fl3733-mono.c | |||
| @@ -144,8 +144,8 @@ void is31fl3733_init_drivers(void) { | |||
| 144 | i2c_init(); | 144 | i2c_init(); |
| 145 | 145 | ||
| 146 | #if defined(IS31FL3733_SDB_PIN) | 146 | #if defined(IS31FL3733_SDB_PIN) |
| 147 | setPinOutput(IS31FL3733_SDB_PIN); | 147 | gpio_set_pin_output(IS31FL3733_SDB_PIN); |
| 148 | writePinHigh(IS31FL3733_SDB_PIN); | 148 | gpio_write_pin_high(IS31FL3733_SDB_PIN); |
| 149 | #endif | 149 | #endif |
| 150 | 150 | ||
| 151 | for (uint8_t i = 0; i < IS31FL3733_DRIVER_COUNT; i++) { | 151 | for (uint8_t i = 0; i < IS31FL3733_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/issi/is31fl3733.c b/drivers/led/issi/is31fl3733.c index ac6f4b4c89..a1d6899114 100644 --- a/drivers/led/issi/is31fl3733.c +++ b/drivers/led/issi/is31fl3733.c | |||
| @@ -143,8 +143,8 @@ void is31fl3733_init_drivers(void) { | |||
| 143 | i2c_init(); | 143 | i2c_init(); |
| 144 | 144 | ||
| 145 | #if defined(IS31FL3733_SDB_PIN) | 145 | #if defined(IS31FL3733_SDB_PIN) |
| 146 | setPinOutput(IS31FL3733_SDB_PIN); | 146 | gpio_set_pin_output(IS31FL3733_SDB_PIN); |
| 147 | writePinHigh(IS31FL3733_SDB_PIN); | 147 | gpio_write_pin_high(IS31FL3733_SDB_PIN); |
| 148 | #endif | 148 | #endif |
| 149 | 149 | ||
| 150 | for (uint8_t i = 0; i < IS31FL3733_DRIVER_COUNT; i++) { | 150 | for (uint8_t i = 0; i < IS31FL3733_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/issi/is31fl3736-mono.c b/drivers/led/issi/is31fl3736-mono.c index 0d3b5db4e4..7a5415c725 100644 --- a/drivers/led/issi/is31fl3736-mono.c +++ b/drivers/led/issi/is31fl3736-mono.c | |||
| @@ -115,8 +115,8 @@ void is31fl3736_init_drivers(void) { | |||
| 115 | i2c_init(); | 115 | i2c_init(); |
| 116 | 116 | ||
| 117 | #if defined(IS31FL3736_SDB_PIN) | 117 | #if defined(IS31FL3736_SDB_PIN) |
| 118 | setPinOutput(IS31FL3736_SDB_PIN); | 118 | gpio_set_pin_output(IS31FL3736_SDB_PIN); |
| 119 | writePinHigh(IS31FL3736_SDB_PIN); | 119 | gpio_write_pin_high(IS31FL3736_SDB_PIN); |
| 120 | #endif | 120 | #endif |
| 121 | 121 | ||
| 122 | for (uint8_t i = 0; i < IS31FL3736_DRIVER_COUNT; i++) { | 122 | for (uint8_t i = 0; i < IS31FL3736_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/issi/is31fl3736.c b/drivers/led/issi/is31fl3736.c index 990e6c8905..3ab42e2f7c 100644 --- a/drivers/led/issi/is31fl3736.c +++ b/drivers/led/issi/is31fl3736.c | |||
| @@ -115,8 +115,8 @@ void is31fl3736_init_drivers(void) { | |||
| 115 | i2c_init(); | 115 | i2c_init(); |
| 116 | 116 | ||
| 117 | #if defined(IS31FL3736_SDB_PIN) | 117 | #if defined(IS31FL3736_SDB_PIN) |
| 118 | setPinOutput(IS31FL3736_SDB_PIN); | 118 | gpio_set_pin_output(IS31FL3736_SDB_PIN); |
| 119 | writePinHigh(IS31FL3736_SDB_PIN); | 119 | gpio_write_pin_high(IS31FL3736_SDB_PIN); |
| 120 | #endif | 120 | #endif |
| 121 | 121 | ||
| 122 | for (uint8_t i = 0; i < IS31FL3736_DRIVER_COUNT; i++) { | 122 | for (uint8_t i = 0; i < IS31FL3736_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/issi/is31fl3737-mono.c b/drivers/led/issi/is31fl3737-mono.c index 37d684cff0..7b2e5a3576 100644 --- a/drivers/led/issi/is31fl3737-mono.c +++ b/drivers/led/issi/is31fl3737-mono.c | |||
| @@ -117,8 +117,8 @@ void is31fl3737_init_drivers(void) { | |||
| 117 | i2c_init(); | 117 | i2c_init(); |
| 118 | 118 | ||
| 119 | #if defined(IS31FL3737_SDB_PIN) | 119 | #if defined(IS31FL3737_SDB_PIN) |
| 120 | setPinOutput(IS31FL3737_SDB_PIN); | 120 | gpio_set_pin_output(IS31FL3737_SDB_PIN); |
| 121 | writePinHigh(IS31FL3737_SDB_PIN); | 121 | gpio_write_pin_high(IS31FL3737_SDB_PIN); |
| 122 | #endif | 122 | #endif |
| 123 | 123 | ||
| 124 | for (uint8_t i = 0; i < IS31FL3737_DRIVER_COUNT; i++) { | 124 | for (uint8_t i = 0; i < IS31FL3737_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/issi/is31fl3737.c b/drivers/led/issi/is31fl3737.c index fb760cda5e..b27a4cbb0f 100644 --- a/drivers/led/issi/is31fl3737.c +++ b/drivers/led/issi/is31fl3737.c | |||
| @@ -117,8 +117,8 @@ void is31fl3737_init_drivers(void) { | |||
| 117 | i2c_init(); | 117 | i2c_init(); |
| 118 | 118 | ||
| 119 | #if defined(IS31FL3737_SDB_PIN) | 119 | #if defined(IS31FL3737_SDB_PIN) |
| 120 | setPinOutput(IS31FL3737_SDB_PIN); | 120 | gpio_set_pin_output(IS31FL3737_SDB_PIN); |
| 121 | writePinHigh(IS31FL3737_SDB_PIN); | 121 | gpio_write_pin_high(IS31FL3737_SDB_PIN); |
| 122 | #endif | 122 | #endif |
| 123 | 123 | ||
| 124 | for (uint8_t i = 0; i < IS31FL3737_DRIVER_COUNT; i++) { | 124 | for (uint8_t i = 0; i < IS31FL3737_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/issi/is31fl3741-mono.c b/drivers/led/issi/is31fl3741-mono.c index e4857b72d4..dbccba0fc8 100644 --- a/drivers/led/issi/is31fl3741-mono.c +++ b/drivers/led/issi/is31fl3741-mono.c | |||
| @@ -143,8 +143,8 @@ void is31fl3741_init_drivers(void) { | |||
| 143 | i2c_init(); | 143 | i2c_init(); |
| 144 | 144 | ||
| 145 | #if defined(IS31FL3741_SDB_PIN) | 145 | #if defined(IS31FL3741_SDB_PIN) |
| 146 | setPinOutput(IS31FL3741_SDB_PIN); | 146 | gpio_set_pin_output(IS31FL3741_SDB_PIN); |
| 147 | writePinHigh(IS31FL3741_SDB_PIN); | 147 | gpio_write_pin_high(IS31FL3741_SDB_PIN); |
| 148 | #endif | 148 | #endif |
| 149 | 149 | ||
| 150 | for (uint8_t i = 0; i < IS31FL3741_DRIVER_COUNT; i++) { | 150 | for (uint8_t i = 0; i < IS31FL3741_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/issi/is31fl3741.c b/drivers/led/issi/is31fl3741.c index a6cb661d91..3614d1c104 100644 --- a/drivers/led/issi/is31fl3741.c +++ b/drivers/led/issi/is31fl3741.c | |||
| @@ -143,8 +143,8 @@ void is31fl3741_init_drivers(void) { | |||
| 143 | i2c_init(); | 143 | i2c_init(); |
| 144 | 144 | ||
| 145 | #if defined(IS31FL3741_SDB_PIN) | 145 | #if defined(IS31FL3741_SDB_PIN) |
| 146 | setPinOutput(IS31FL3741_SDB_PIN); | 146 | gpio_set_pin_output(IS31FL3741_SDB_PIN); |
| 147 | writePinHigh(IS31FL3741_SDB_PIN); | 147 | gpio_write_pin_high(IS31FL3741_SDB_PIN); |
| 148 | #endif | 148 | #endif |
| 149 | 149 | ||
| 150 | for (uint8_t i = 0; i < IS31FL3741_DRIVER_COUNT; i++) { | 150 | for (uint8_t i = 0; i < IS31FL3741_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/issi/is31fl3742a-mono.c b/drivers/led/issi/is31fl3742a-mono.c index a33865260c..c63db1a7fc 100644 --- a/drivers/led/issi/is31fl3742a-mono.c +++ b/drivers/led/issi/is31fl3742a-mono.c | |||
| @@ -116,8 +116,8 @@ void is31fl3742a_init_drivers(void) { | |||
| 116 | i2c_init(); | 116 | i2c_init(); |
| 117 | 117 | ||
| 118 | #if defined(IS31FL3742A_SDB_PIN) | 118 | #if defined(IS31FL3742A_SDB_PIN) |
| 119 | setPinOutput(IS31FL3742A_SDB_PIN); | 119 | gpio_set_pin_output(IS31FL3742A_SDB_PIN); |
| 120 | writePinHigh(IS31FL3742A_SDB_PIN); | 120 | gpio_write_pin_high(IS31FL3742A_SDB_PIN); |
| 121 | #endif | 121 | #endif |
| 122 | 122 | ||
| 123 | for (uint8_t i = 0; i < IS31FL3742A_DRIVER_COUNT; i++) { | 123 | for (uint8_t i = 0; i < IS31FL3742A_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/issi/is31fl3742a.c b/drivers/led/issi/is31fl3742a.c index 8900ae666f..b8e9a58759 100644 --- a/drivers/led/issi/is31fl3742a.c +++ b/drivers/led/issi/is31fl3742a.c | |||
| @@ -116,8 +116,8 @@ void is31fl3742a_init_drivers(void) { | |||
| 116 | i2c_init(); | 116 | i2c_init(); |
| 117 | 117 | ||
| 118 | #if defined(IS31FL3742A_SDB_PIN) | 118 | #if defined(IS31FL3742A_SDB_PIN) |
| 119 | setPinOutput(IS31FL3742A_SDB_PIN); | 119 | gpio_set_pin_output(IS31FL3742A_SDB_PIN); |
| 120 | writePinHigh(IS31FL3742A_SDB_PIN); | 120 | gpio_write_pin_high(IS31FL3742A_SDB_PIN); |
| 121 | #endif | 121 | #endif |
| 122 | 122 | ||
| 123 | for (uint8_t i = 0; i < IS31FL3742A_DRIVER_COUNT; i++) { | 123 | for (uint8_t i = 0; i < IS31FL3742A_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/issi/is31fl3743a-mono.c b/drivers/led/issi/is31fl3743a-mono.c index 99b1af160e..6413dbef04 100644 --- a/drivers/led/issi/is31fl3743a-mono.c +++ b/drivers/led/issi/is31fl3743a-mono.c | |||
| @@ -138,8 +138,8 @@ void is31fl3743a_init_drivers(void) { | |||
| 138 | i2c_init(); | 138 | i2c_init(); |
| 139 | 139 | ||
| 140 | #if defined(IS31FL3743A_SDB_PIN) | 140 | #if defined(IS31FL3743A_SDB_PIN) |
| 141 | setPinOutput(IS31FL3743A_SDB_PIN); | 141 | gpio_set_pin_output(IS31FL3743A_SDB_PIN); |
| 142 | writePinHigh(IS31FL3743A_SDB_PIN); | 142 | gpio_write_pin_high(IS31FL3743A_SDB_PIN); |
| 143 | #endif | 143 | #endif |
| 144 | 144 | ||
| 145 | for (uint8_t i = 0; i < IS31FL3743A_DRIVER_COUNT; i++) { | 145 | for (uint8_t i = 0; i < IS31FL3743A_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/issi/is31fl3743a.c b/drivers/led/issi/is31fl3743a.c index 135e20710d..6f13925f27 100644 --- a/drivers/led/issi/is31fl3743a.c +++ b/drivers/led/issi/is31fl3743a.c | |||
| @@ -138,8 +138,8 @@ void is31fl3743a_init_drivers(void) { | |||
| 138 | i2c_init(); | 138 | i2c_init(); |
| 139 | 139 | ||
| 140 | #if defined(IS31FL3743A_SDB_PIN) | 140 | #if defined(IS31FL3743A_SDB_PIN) |
| 141 | setPinOutput(IS31FL3743A_SDB_PIN); | 141 | gpio_set_pin_output(IS31FL3743A_SDB_PIN); |
| 142 | writePinHigh(IS31FL3743A_SDB_PIN); | 142 | gpio_write_pin_high(IS31FL3743A_SDB_PIN); |
| 143 | #endif | 143 | #endif |
| 144 | 144 | ||
| 145 | for (uint8_t i = 0; i < IS31FL3743A_DRIVER_COUNT; i++) { | 145 | for (uint8_t i = 0; i < IS31FL3743A_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/issi/is31fl3745-mono.c b/drivers/led/issi/is31fl3745-mono.c index c5d083b272..a6ab699245 100644 --- a/drivers/led/issi/is31fl3745-mono.c +++ b/drivers/led/issi/is31fl3745-mono.c | |||
| @@ -138,8 +138,8 @@ void is31fl3745_init_drivers(void) { | |||
| 138 | i2c_init(); | 138 | i2c_init(); |
| 139 | 139 | ||
| 140 | #if defined(IS31FL3745_SDB_PIN) | 140 | #if defined(IS31FL3745_SDB_PIN) |
| 141 | setPinOutput(IS31FL3745_SDB_PIN); | 141 | gpio_set_pin_output(IS31FL3745_SDB_PIN); |
| 142 | writePinHigh(IS31FL3745_SDB_PIN); | 142 | gpio_write_pin_high(IS31FL3745_SDB_PIN); |
| 143 | #endif | 143 | #endif |
| 144 | 144 | ||
| 145 | for (uint8_t i = 0; i < IS31FL3745_DRIVER_COUNT; i++) { | 145 | for (uint8_t i = 0; i < IS31FL3745_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/issi/is31fl3745.c b/drivers/led/issi/is31fl3745.c index 273fddf1d4..1e3b437e02 100644 --- a/drivers/led/issi/is31fl3745.c +++ b/drivers/led/issi/is31fl3745.c | |||
| @@ -138,8 +138,8 @@ void is31fl3745_init_drivers(void) { | |||
| 138 | i2c_init(); | 138 | i2c_init(); |
| 139 | 139 | ||
| 140 | #if defined(IS31FL3745_SDB_PIN) | 140 | #if defined(IS31FL3745_SDB_PIN) |
| 141 | setPinOutput(IS31FL3745_SDB_PIN); | 141 | gpio_set_pin_output(IS31FL3745_SDB_PIN); |
| 142 | writePinHigh(IS31FL3745_SDB_PIN); | 142 | gpio_write_pin_high(IS31FL3745_SDB_PIN); |
| 143 | #endif | 143 | #endif |
| 144 | 144 | ||
| 145 | for (uint8_t i = 0; i < IS31FL3745_DRIVER_COUNT; i++) { | 145 | for (uint8_t i = 0; i < IS31FL3745_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/issi/is31fl3746a-mono.c b/drivers/led/issi/is31fl3746a-mono.c index 69d5079929..6bff10723f 100644 --- a/drivers/led/issi/is31fl3746a-mono.c +++ b/drivers/led/issi/is31fl3746a-mono.c | |||
| @@ -116,8 +116,8 @@ void is31fl3746a_init_drivers(void) { | |||
| 116 | i2c_init(); | 116 | i2c_init(); |
| 117 | 117 | ||
| 118 | #if defined(IS31FL3746A_SDB_PIN) | 118 | #if defined(IS31FL3746A_SDB_PIN) |
| 119 | setPinOutput(IS31FL3746A_SDB_PIN); | 119 | gpio_set_pin_output(IS31FL3746A_SDB_PIN); |
| 120 | writePinHigh(IS31FL3746A_SDB_PIN); | 120 | gpio_write_pin_high(IS31FL3746A_SDB_PIN); |
| 121 | #endif | 121 | #endif |
| 122 | 122 | ||
| 123 | for (uint8_t i = 0; i < IS31FL3746A_DRIVER_COUNT; i++) { | 123 | for (uint8_t i = 0; i < IS31FL3746A_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/issi/is31fl3746a.c b/drivers/led/issi/is31fl3746a.c index c9dfbc5c40..1ef0b2d632 100644 --- a/drivers/led/issi/is31fl3746a.c +++ b/drivers/led/issi/is31fl3746a.c | |||
| @@ -116,8 +116,8 @@ void is31fl3746a_init_drivers(void) { | |||
| 116 | i2c_init(); | 116 | i2c_init(); |
| 117 | 117 | ||
| 118 | #if defined(IS31FL3746A_SDB_PIN) | 118 | #if defined(IS31FL3746A_SDB_PIN) |
| 119 | setPinOutput(IS31FL3746A_SDB_PIN); | 119 | gpio_set_pin_output(IS31FL3746A_SDB_PIN); |
| 120 | writePinHigh(IS31FL3746A_SDB_PIN); | 120 | gpio_write_pin_high(IS31FL3746A_SDB_PIN); |
| 121 | #endif | 121 | #endif |
| 122 | 122 | ||
| 123 | for (uint8_t i = 0; i < IS31FL3746A_DRIVER_COUNT; i++) { | 123 | for (uint8_t i = 0; i < IS31FL3746A_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/snled27351-mono.c b/drivers/led/snled27351-mono.c index e13fd8a343..d87b856db6 100644 --- a/drivers/led/snled27351-mono.c +++ b/drivers/led/snled27351-mono.c | |||
| @@ -105,8 +105,8 @@ void snled27351_init_drivers(void) { | |||
| 105 | i2c_init(); | 105 | i2c_init(); |
| 106 | 106 | ||
| 107 | #if defined(SNLED27351_SDB_PIN) | 107 | #if defined(SNLED27351_SDB_PIN) |
| 108 | setPinOutput(SNLED27351_SDB_PIN); | 108 | gpio_set_pin_output(SNLED27351_SDB_PIN); |
| 109 | writePinHigh(SNLED27351_SDB_PIN); | 109 | gpio_write_pin_high(SNLED27351_SDB_PIN); |
| 110 | #endif | 110 | #endif |
| 111 | 111 | ||
| 112 | for (uint8_t i = 0; i < SNLED27351_DRIVER_COUNT; i++) { | 112 | for (uint8_t i = 0; i < SNLED27351_DRIVER_COUNT; i++) { |
diff --git a/drivers/led/snled27351.c b/drivers/led/snled27351.c index 293685b01b..8ebf681bdb 100644 --- a/drivers/led/snled27351.c +++ b/drivers/led/snled27351.c | |||
| @@ -105,8 +105,8 @@ void snled27351_init_drivers(void) { | |||
| 105 | i2c_init(); | 105 | i2c_init(); |
| 106 | 106 | ||
| 107 | #if defined(SNLED27351_SDB_PIN) | 107 | #if defined(SNLED27351_SDB_PIN) |
| 108 | setPinOutput(SNLED27351_SDB_PIN); | 108 | gpio_set_pin_output(SNLED27351_SDB_PIN); |
| 109 | writePinHigh(SNLED27351_SDB_PIN); | 109 | gpio_write_pin_high(SNLED27351_SDB_PIN); |
| 110 | #endif | 110 | #endif |
| 111 | 111 | ||
| 112 | for (uint8_t i = 0; i < SNLED27351_DRIVER_COUNT; i++) { | 112 | for (uint8_t i = 0; i < SNLED27351_DRIVER_COUNT; i++) { |
diff --git a/drivers/oled/oled_driver.c b/drivers/oled/oled_driver.c index 8cca41394f..1d1c2a90c4 100644 --- a/drivers/oled/oled_driver.c +++ b/drivers/oled/oled_driver.c | |||
| @@ -192,7 +192,7 @@ __attribute__((weak)) bool oled_send_cmd(const uint8_t *data, uint16_t size) { | |||
| 192 | return false; | 192 | return false; |
| 193 | } | 193 | } |
| 194 | // Command Mode | 194 | // Command Mode |
| 195 | writePinLow(OLED_DC_PIN); | 195 | gpio_write_pin_low(OLED_DC_PIN); |
| 196 | // Send the commands | 196 | // Send the commands |
| 197 | if (spi_transmit(&data[1], size - 1) != SPI_STATUS_SUCCESS) { | 197 | if (spi_transmit(&data[1], size - 1) != SPI_STATUS_SUCCESS) { |
| 198 | spi_stop(); | 198 | spi_stop(); |
| @@ -215,7 +215,7 @@ __attribute__((weak)) bool oled_send_cmd_P(const uint8_t *data, uint16_t size) { | |||
| 215 | } | 215 | } |
| 216 | spi_status_t status = SPI_STATUS_SUCCESS; | 216 | spi_status_t status = SPI_STATUS_SUCCESS; |
| 217 | // Command Mode | 217 | // Command Mode |
| 218 | writePinLow(OLED_DC_PIN); | 218 | gpio_write_pin_low(OLED_DC_PIN); |
| 219 | // Send the commands | 219 | // Send the commands |
| 220 | for (uint16_t i = 1; i < size && status >= 0; i++) { | 220 | for (uint16_t i = 1; i < size && status >= 0; i++) { |
| 221 | status = spi_write(pgm_read_byte((const char *)&data[i])); | 221 | status = spi_write(pgm_read_byte((const char *)&data[i])); |
| @@ -239,7 +239,7 @@ __attribute__((weak)) bool oled_send_data(const uint8_t *data, uint16_t size) { | |||
| 239 | return false; | 239 | return false; |
| 240 | } | 240 | } |
| 241 | // Data Mode | 241 | // Data Mode |
| 242 | writePinHigh(OLED_DC_PIN); | 242 | gpio_write_pin_high(OLED_DC_PIN); |
| 243 | // Send the commands | 243 | // Send the commands |
| 244 | if (spi_transmit(data, size) != SPI_STATUS_SUCCESS) { | 244 | if (spi_transmit(data, size) != SPI_STATUS_SUCCESS) { |
| 245 | spi_stop(); | 245 | spi_stop(); |
| @@ -256,17 +256,17 @@ __attribute__((weak)) bool oled_send_data(const uint8_t *data, uint16_t size) { | |||
| 256 | __attribute__((weak)) void oled_driver_init(void) { | 256 | __attribute__((weak)) void oled_driver_init(void) { |
| 257 | #if defined(OLED_TRANSPORT_SPI) | 257 | #if defined(OLED_TRANSPORT_SPI) |
| 258 | spi_init(); | 258 | spi_init(); |
| 259 | setPinOutput(OLED_CS_PIN); | 259 | gpio_set_pin_output(OLED_CS_PIN); |
| 260 | writePinHigh(OLED_CS_PIN); | 260 | gpio_write_pin_high(OLED_CS_PIN); |
| 261 | 261 | ||
| 262 | setPinOutput(OLED_DC_PIN); | 262 | gpio_set_pin_output(OLED_DC_PIN); |
| 263 | writePinLow(OLED_DC_PIN); | 263 | gpio_write_pin_low(OLED_DC_PIN); |
| 264 | # ifdef OLED_RST_PIN | 264 | # ifdef OLED_RST_PIN |
| 265 | /* Reset device */ | 265 | /* Reset device */ |
| 266 | setPinOutput(OLED_RST_PIN); | 266 | gpio_set_pin_output(OLED_RST_PIN); |
| 267 | writePinLow(OLED_RST_PIN); | 267 | gpio_write_pin_low(OLED_RST_PIN); |
| 268 | wait_ms(20); | 268 | wait_ms(20); |
| 269 | writePinHigh(OLED_RST_PIN); | 269 | gpio_write_pin_high(OLED_RST_PIN); |
| 270 | wait_ms(20); | 270 | wait_ms(20); |
| 271 | # endif | 271 | # endif |
| 272 | #elif defined(OLED_TRANSPORT_I2C) | 272 | #elif defined(OLED_TRANSPORT_I2C) |
diff --git a/drivers/painter/comms/qp_comms_spi.c b/drivers/painter/comms/qp_comms_spi.c index 9f52bc7d1f..4e6067394b 100644 --- a/drivers/painter/comms/qp_comms_spi.c +++ b/drivers/painter/comms/qp_comms_spi.c | |||
| @@ -17,8 +17,8 @@ bool qp_comms_spi_init(painter_device_t device) { | |||
| 17 | spi_init(); | 17 | spi_init(); |
| 18 | 18 | ||
| 19 | // Set up CS as output high | 19 | // Set up CS as output high |
| 20 | setPinOutput(comms_config->chip_select_pin); | 20 | gpio_set_pin_output(comms_config->chip_select_pin); |
| 21 | writePinHigh(comms_config->chip_select_pin); | 21 | gpio_write_pin_high(comms_config->chip_select_pin); |
| 22 | 22 | ||
| 23 | return true; | 23 | return true; |
| 24 | } | 24 | } |
| @@ -49,7 +49,7 @@ void qp_comms_spi_stop(painter_device_t device) { | |||
| 49 | painter_driver_t * driver = (painter_driver_t *)device; | 49 | painter_driver_t * driver = (painter_driver_t *)device; |
| 50 | qp_comms_spi_config_t *comms_config = (qp_comms_spi_config_t *)driver->comms_config; | 50 | qp_comms_spi_config_t *comms_config = (qp_comms_spi_config_t *)driver->comms_config; |
| 51 | spi_stop(); | 51 | spi_stop(); |
| 52 | writePinHigh(comms_config->chip_select_pin); | 52 | gpio_write_pin_high(comms_config->chip_select_pin); |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | const painter_comms_vtable_t spi_comms_vtable = { | 55 | const painter_comms_vtable_t spi_comms_vtable = { |
| @@ -74,16 +74,16 @@ bool qp_comms_spi_dc_reset_init(painter_device_t device) { | |||
| 74 | 74 | ||
| 75 | // Set up D/C as output low, if specified | 75 | // Set up D/C as output low, if specified |
| 76 | if (comms_config->dc_pin != NO_PIN) { | 76 | if (comms_config->dc_pin != NO_PIN) { |
| 77 | setPinOutput(comms_config->dc_pin); | 77 | gpio_set_pin_output(comms_config->dc_pin); |
| 78 | writePinLow(comms_config->dc_pin); | 78 | gpio_write_pin_low(comms_config->dc_pin); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | // Set up RST as output, if specified, performing a reset in the process | 81 | // Set up RST as output, if specified, performing a reset in the process |
| 82 | if (comms_config->reset_pin != NO_PIN) { | 82 | if (comms_config->reset_pin != NO_PIN) { |
| 83 | setPinOutput(comms_config->reset_pin); | 83 | gpio_set_pin_output(comms_config->reset_pin); |
| 84 | writePinLow(comms_config->reset_pin); | 84 | gpio_write_pin_low(comms_config->reset_pin); |
| 85 | wait_ms(20); | 85 | wait_ms(20); |
| 86 | writePinHigh(comms_config->reset_pin); | 86 | gpio_write_pin_high(comms_config->reset_pin); |
| 87 | wait_ms(20); | 87 | wait_ms(20); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| @@ -93,14 +93,14 @@ bool qp_comms_spi_dc_reset_init(painter_device_t device) { | |||
| 93 | uint32_t qp_comms_spi_dc_reset_send_data(painter_device_t device, const void *data, uint32_t byte_count) { | 93 | uint32_t qp_comms_spi_dc_reset_send_data(painter_device_t device, const void *data, uint32_t byte_count) { |
| 94 | painter_driver_t * driver = (painter_driver_t *)device; | 94 | painter_driver_t * driver = (painter_driver_t *)device; |
| 95 | qp_comms_spi_dc_reset_config_t *comms_config = (qp_comms_spi_dc_reset_config_t *)driver->comms_config; | 95 | qp_comms_spi_dc_reset_config_t *comms_config = (qp_comms_spi_dc_reset_config_t *)driver->comms_config; |
| 96 | writePinHigh(comms_config->dc_pin); | 96 | gpio_write_pin_high(comms_config->dc_pin); |
| 97 | return qp_comms_spi_send_data(device, data, byte_count); | 97 | return qp_comms_spi_send_data(device, data, byte_count); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | void qp_comms_spi_dc_reset_send_command(painter_device_t device, uint8_t cmd) { | 100 | void qp_comms_spi_dc_reset_send_command(painter_device_t device, uint8_t cmd) { |
| 101 | painter_driver_t * driver = (painter_driver_t *)device; | 101 | painter_driver_t * driver = (painter_driver_t *)device; |
| 102 | qp_comms_spi_dc_reset_config_t *comms_config = (qp_comms_spi_dc_reset_config_t *)driver->comms_config; | 102 | qp_comms_spi_dc_reset_config_t *comms_config = (qp_comms_spi_dc_reset_config_t *)driver->comms_config; |
| 103 | writePinLow(comms_config->dc_pin); | 103 | gpio_write_pin_low(comms_config->dc_pin); |
| 104 | spi_write(cmd); | 104 | spi_write(cmd); |
| 105 | } | 105 | } |
| 106 | 106 | ||
diff --git a/drivers/sensors/adns5050.c b/drivers/sensors/adns5050.c index b76268fba2..97daa8db09 100644 --- a/drivers/sensors/adns5050.c +++ b/drivers/sensors/adns5050.c | |||
| @@ -47,9 +47,9 @@ | |||
| 47 | 47 | ||
| 48 | void adns5050_init(void) { | 48 | void adns5050_init(void) { |
| 49 | // Initialize the ADNS serial pins. | 49 | // Initialize the ADNS serial pins. |
| 50 | setPinOutput(ADNS5050_SCLK_PIN); | 50 | gpio_set_pin_output(ADNS5050_SCLK_PIN); |
| 51 | setPinOutput(ADNS5050_SDIO_PIN); | 51 | gpio_set_pin_output(ADNS5050_SDIO_PIN); |
| 52 | setPinOutput(ADNS5050_CS_PIN); | 52 | gpio_set_pin_output(ADNS5050_CS_PIN); |
| 53 | 53 | ||
| 54 | // reboot the adns. | 54 | // reboot the adns. |
| 55 | // if the adns hasn't initialized yet, this is harmless. | 55 | // if the adns hasn't initialized yet, this is harmless. |
| @@ -69,30 +69,30 @@ void adns5050_init(void) { | |||
| 69 | // Just as with the serial protocol, this is used by the slave to send a | 69 | // Just as with the serial protocol, this is used by the slave to send a |
| 70 | // synchronization signal to the master. | 70 | // synchronization signal to the master. |
| 71 | void adns5050_sync(void) { | 71 | void adns5050_sync(void) { |
| 72 | writePinLow(ADNS5050_CS_PIN); | 72 | gpio_write_pin_low(ADNS5050_CS_PIN); |
| 73 | wait_us(1); | 73 | wait_us(1); |
| 74 | writePinHigh(ADNS5050_CS_PIN); | 74 | gpio_write_pin_high(ADNS5050_CS_PIN); |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | void adns5050_cs_select(void) { | 77 | void adns5050_cs_select(void) { |
| 78 | writePinLow(ADNS5050_CS_PIN); | 78 | gpio_write_pin_low(ADNS5050_CS_PIN); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | void adns5050_cs_deselect(void) { | 81 | void adns5050_cs_deselect(void) { |
| 82 | writePinHigh(ADNS5050_CS_PIN); | 82 | gpio_write_pin_high(ADNS5050_CS_PIN); |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | uint8_t adns5050_serial_read(void) { | 85 | uint8_t adns5050_serial_read(void) { |
| 86 | setPinInput(ADNS5050_SDIO_PIN); | 86 | gpio_set_pin_input(ADNS5050_SDIO_PIN); |
| 87 | uint8_t byte = 0; | 87 | uint8_t byte = 0; |
| 88 | 88 | ||
| 89 | for (uint8_t i = 0; i < 8; ++i) { | 89 | for (uint8_t i = 0; i < 8; ++i) { |
| 90 | writePinLow(ADNS5050_SCLK_PIN); | 90 | gpio_write_pin_low(ADNS5050_SCLK_PIN); |
| 91 | wait_us(1); | 91 | wait_us(1); |
| 92 | 92 | ||
| 93 | byte = (byte << 1) | readPin(ADNS5050_SDIO_PIN); | 93 | byte = (byte << 1) | gpio_read_pin(ADNS5050_SDIO_PIN); |
| 94 | 94 | ||
| 95 | writePinHigh(ADNS5050_SCLK_PIN); | 95 | gpio_write_pin_high(ADNS5050_SCLK_PIN); |
| 96 | wait_us(1); | 96 | wait_us(1); |
| 97 | } | 97 | } |
| 98 | 98 | ||
| @@ -100,19 +100,19 @@ uint8_t adns5050_serial_read(void) { | |||
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | void adns5050_serial_write(uint8_t data) { | 102 | void adns5050_serial_write(uint8_t data) { |
| 103 | setPinOutput(ADNS5050_SDIO_PIN); | 103 | gpio_set_pin_output(ADNS5050_SDIO_PIN); |
| 104 | 104 | ||
| 105 | for (int8_t b = 7; b >= 0; b--) { | 105 | for (int8_t b = 7; b >= 0; b--) { |
| 106 | writePinLow(ADNS5050_SCLK_PIN); | 106 | gpio_write_pin_low(ADNS5050_SCLK_PIN); |
| 107 | 107 | ||
| 108 | if (data & (1 << b)) | 108 | if (data & (1 << b)) |
| 109 | writePinHigh(ADNS5050_SDIO_PIN); | 109 | gpio_write_pin_high(ADNS5050_SDIO_PIN); |
| 110 | else | 110 | else |
| 111 | writePinLow(ADNS5050_SDIO_PIN); | 111 | gpio_write_pin_low(ADNS5050_SDIO_PIN); |
| 112 | 112 | ||
| 113 | wait_us(2); | 113 | wait_us(2); |
| 114 | 114 | ||
| 115 | writePinHigh(ADNS5050_SCLK_PIN); | 115 | gpio_write_pin_high(ADNS5050_SCLK_PIN); |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | // tSWR. See page 15 of the ADNS spec sheet. | 118 | // tSWR. See page 15 of the ADNS spec sheet. |
diff --git a/drivers/sensors/adns9800.c b/drivers/sensors/adns9800.c index 083ab34d9f..f34529ee90 100644 --- a/drivers/sensors/adns9800.c +++ b/drivers/sensors/adns9800.c | |||
| @@ -100,7 +100,7 @@ uint8_t adns9800_read(uint8_t reg_addr) { | |||
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | void adns9800_init(void) { | 102 | void adns9800_init(void) { |
| 103 | setPinOutput(ADNS9800_CS_PIN); | 103 | gpio_set_pin_output(ADNS9800_CS_PIN); |
| 104 | 104 | ||
| 105 | spi_init(); | 105 | spi_init(); |
| 106 | 106 | ||
diff --git a/drivers/sensors/analog_joystick.c b/drivers/sensors/analog_joystick.c index 221625075c..15b35a45f2 100644 --- a/drivers/sensors/analog_joystick.c +++ b/drivers/sensors/analog_joystick.c | |||
| @@ -122,17 +122,17 @@ report_analog_joystick_t analog_joystick_read(void) { | |||
| 122 | report.y = axisToMouseComponent(ANALOG_JOYSTICK_Y_AXIS_PIN, yOrigin, maxCursorSpeed, 1); | 122 | report.y = axisToMouseComponent(ANALOG_JOYSTICK_Y_AXIS_PIN, yOrigin, maxCursorSpeed, 1); |
| 123 | } | 123 | } |
| 124 | #ifdef ANALOG_JOYSTICK_CLICK_PIN | 124 | #ifdef ANALOG_JOYSTICK_CLICK_PIN |
| 125 | report.button = !readPin(ANALOG_JOYSTICK_CLICK_PIN); | 125 | report.button = !gpio_read_pin(ANALOG_JOYSTICK_CLICK_PIN); |
| 126 | #endif | 126 | #endif |
| 127 | return report; | 127 | return report; |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | void analog_joystick_init(void) { | 130 | void analog_joystick_init(void) { |
| 131 | setPinInputHigh(ANALOG_JOYSTICK_X_AXIS_PIN); | 131 | gpio_set_pin_input_high(ANALOG_JOYSTICK_X_AXIS_PIN); |
| 132 | setPinInputHigh(ANALOG_JOYSTICK_Y_AXIS_PIN); | 132 | gpio_set_pin_input_high(ANALOG_JOYSTICK_Y_AXIS_PIN); |
| 133 | 133 | ||
| 134 | #ifdef ANALOG_JOYSTICK_CLICK_PIN | 134 | #ifdef ANALOG_JOYSTICK_CLICK_PIN |
| 135 | setPinInputHigh(ANALOG_JOYSTICK_CLICK_PIN); | 135 | gpio_set_pin_input_high(ANALOG_JOYSTICK_CLICK_PIN); |
| 136 | #endif | 136 | #endif |
| 137 | // Account for drift | 137 | // Account for drift |
| 138 | xOrigin = analogReadPin(ANALOG_JOYSTICK_X_AXIS_PIN); | 138 | xOrigin = analogReadPin(ANALOG_JOYSTICK_X_AXIS_PIN); |
diff --git a/drivers/sensors/paw3204.c b/drivers/sensors/paw3204.c index a13753dd6f..28c47522ed 100644 --- a/drivers/sensors/paw3204.c +++ b/drivers/sensors/paw3204.c | |||
| @@ -51,8 +51,8 @@ uint8_t paw3204_read_reg(uint8_t reg_addr); | |||
| 51 | void paw3204_write_reg(uint8_t reg_addr, uint8_t data); | 51 | void paw3204_write_reg(uint8_t reg_addr, uint8_t data); |
| 52 | 52 | ||
| 53 | void paw3204_init(void) { | 53 | void paw3204_init(void) { |
| 54 | setPinOutput(PAW3204_SCLK_PIN); // setclockpin to output | 54 | gpio_set_pin_output(PAW3204_SCLK_PIN); // setclockpin to output |
| 55 | setPinInputHigh(PAW3204_SDIO_PIN); // set datapin input high | 55 | gpio_set_pin_input_high(PAW3204_SDIO_PIN); // set datapin input high |
| 56 | 56 | ||
| 57 | paw3204_write_reg(REG_SETUP, 0x86); // reset sensor and set 1600cpi | 57 | paw3204_write_reg(REG_SETUP, 0x86); // reset sensor and set 1600cpi |
| 58 | wait_us(5); | 58 | wait_us(5); |
| @@ -64,16 +64,16 @@ void paw3204_init(void) { | |||
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | uint8_t paw3204_serial_read(void) { | 66 | uint8_t paw3204_serial_read(void) { |
| 67 | setPinInput(PAW3204_SDIO_PIN); | 67 | gpio_set_pin_input(PAW3204_SDIO_PIN); |
| 68 | uint8_t byte = 0; | 68 | uint8_t byte = 0; |
| 69 | 69 | ||
| 70 | for (uint8_t i = 0; i < 8; ++i) { | 70 | for (uint8_t i = 0; i < 8; ++i) { |
| 71 | writePinLow(PAW3204_SCLK_PIN); | 71 | gpio_write_pin_low(PAW3204_SCLK_PIN); |
| 72 | wait_us(1); | 72 | wait_us(1); |
| 73 | 73 | ||
| 74 | byte = (byte << 1) | readPin(PAW3204_SDIO_PIN); | 74 | byte = (byte << 1) | gpio_read_pin(PAW3204_SDIO_PIN); |
| 75 | 75 | ||
| 76 | writePinHigh(PAW3204_SCLK_PIN); | 76 | gpio_write_pin_high(PAW3204_SCLK_PIN); |
| 77 | wait_us(1); | 77 | wait_us(1); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| @@ -81,17 +81,17 @@ uint8_t paw3204_serial_read(void) { | |||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | void paw3204_serial_write(uint8_t data) { | 83 | void paw3204_serial_write(uint8_t data) { |
| 84 | writePinLow(PAW3204_SDIO_PIN); | 84 | gpio_write_pin_low(PAW3204_SDIO_PIN); |
| 85 | setPinOutput(PAW3204_SDIO_PIN); | 85 | gpio_set_pin_output(PAW3204_SDIO_PIN); |
| 86 | 86 | ||
| 87 | for (int8_t b = 7; b >= 0; b--) { | 87 | for (int8_t b = 7; b >= 0; b--) { |
| 88 | writePinLow(PAW3204_SCLK_PIN); | 88 | gpio_write_pin_low(PAW3204_SCLK_PIN); |
| 89 | if (data & (1 << b)) { | 89 | if (data & (1 << b)) { |
| 90 | writePinHigh(PAW3204_SDIO_PIN); | 90 | gpio_write_pin_high(PAW3204_SDIO_PIN); |
| 91 | } else { | 91 | } else { |
| 92 | writePinLow(PAW3204_SDIO_PIN); | 92 | gpio_write_pin_low(PAW3204_SDIO_PIN); |
| 93 | } | 93 | } |
| 94 | writePinHigh(PAW3204_SCLK_PIN); | 94 | gpio_write_pin_high(PAW3204_SCLK_PIN); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | wait_us(4); | 97 | wait_us(4); |
diff --git a/drivers/sensors/pmw3320.c b/drivers/sensors/pmw3320.c index 69a584f4e1..f19fbfd1ab 100644 --- a/drivers/sensors/pmw3320.c +++ b/drivers/sensors/pmw3320.c | |||
| @@ -24,9 +24,9 @@ | |||
| 24 | 24 | ||
| 25 | void pmw3320_init(void) { | 25 | void pmw3320_init(void) { |
| 26 | // Initialize sensor serial pins. | 26 | // Initialize sensor serial pins. |
| 27 | setPinOutput(PMW3320_SCLK_PIN); | 27 | gpio_set_pin_output(PMW3320_SCLK_PIN); |
| 28 | setPinOutput(PMW3320_SDIO_PIN); | 28 | gpio_set_pin_output(PMW3320_SDIO_PIN); |
| 29 | setPinOutput(PMW3320_CS_PIN); | 29 | gpio_set_pin_output(PMW3320_CS_PIN); |
| 30 | 30 | ||
| 31 | // reboot the sensor. | 31 | // reboot the sensor. |
| 32 | pmw3320_write_reg(REG_Power_Up_Reset, 0x5a); | 32 | pmw3320_write_reg(REG_Power_Up_Reset, 0x5a); |
| @@ -54,30 +54,30 @@ void pmw3320_init(void) { | |||
| 54 | // Just as with the serial protocol, this is used by the slave to send a | 54 | // Just as with the serial protocol, this is used by the slave to send a |
| 55 | // synchronization signal to the master. | 55 | // synchronization signal to the master. |
| 56 | void pmw3320_sync(void) { | 56 | void pmw3320_sync(void) { |
| 57 | writePinLow(PMW3320_CS_PIN); | 57 | gpio_write_pin_low(PMW3320_CS_PIN); |
| 58 | wait_us(1); | 58 | wait_us(1); |
| 59 | writePinHigh(PMW3320_CS_PIN); | 59 | gpio_write_pin_high(PMW3320_CS_PIN); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | void pmw3320_cs_select(void) { | 62 | void pmw3320_cs_select(void) { |
| 63 | writePinLow(PMW3320_CS_PIN); | 63 | gpio_write_pin_low(PMW3320_CS_PIN); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | void pmw3320_cs_deselect(void) { | 66 | void pmw3320_cs_deselect(void) { |
| 67 | writePinHigh(PMW3320_CS_PIN); | 67 | gpio_write_pin_high(PMW3320_CS_PIN); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | uint8_t pmw3320_serial_read(void) { | 70 | uint8_t pmw3320_serial_read(void) { |
| 71 | setPinInput(PMW3320_SDIO_PIN); | 71 | gpio_set_pin_input(PMW3320_SDIO_PIN); |
| 72 | uint8_t byte = 0; | 72 | uint8_t byte = 0; |
| 73 | 73 | ||
| 74 | for (uint8_t i = 0; i < 8; ++i) { | 74 | for (uint8_t i = 0; i < 8; ++i) { |
| 75 | writePinLow(PMW3320_SCLK_PIN); | 75 | gpio_write_pin_low(PMW3320_SCLK_PIN); |
| 76 | wait_us(1); | 76 | wait_us(1); |
| 77 | 77 | ||
| 78 | byte = (byte << 1) | readPin(PMW3320_SDIO_PIN); | 78 | byte = (byte << 1) | gpio_read_pin(PMW3320_SDIO_PIN); |
| 79 | 79 | ||
| 80 | writePinHigh(PMW3320_SCLK_PIN); | 80 | gpio_write_pin_high(PMW3320_SCLK_PIN); |
| 81 | wait_us(1); | 81 | wait_us(1); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| @@ -85,19 +85,19 @@ uint8_t pmw3320_serial_read(void) { | |||
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | void pmw3320_serial_write(uint8_t data) { | 87 | void pmw3320_serial_write(uint8_t data) { |
| 88 | setPinOutput(PMW3320_SDIO_PIN); | 88 | gpio_set_pin_output(PMW3320_SDIO_PIN); |
| 89 | 89 | ||
| 90 | for (int8_t b = 7; b >= 0; b--) { | 90 | for (int8_t b = 7; b >= 0; b--) { |
| 91 | writePinLow(PMW3320_SCLK_PIN); | 91 | gpio_write_pin_low(PMW3320_SCLK_PIN); |
| 92 | 92 | ||
| 93 | if (data & (1 << b)) | 93 | if (data & (1 << b)) |
| 94 | writePinHigh(PMW3320_SDIO_PIN); | 94 | gpio_write_pin_high(PMW3320_SDIO_PIN); |
| 95 | else | 95 | else |
| 96 | writePinLow(PMW3320_SDIO_PIN); | 96 | gpio_write_pin_low(PMW3320_SDIO_PIN); |
| 97 | 97 | ||
| 98 | wait_us(2); | 98 | wait_us(2); |
| 99 | 99 | ||
| 100 | writePinHigh(PMW3320_SCLK_PIN); | 100 | gpio_write_pin_high(PMW3320_SCLK_PIN); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | // This was taken from ADNS5050 driver. | 103 | // This was taken from ADNS5050 driver. |
diff --git a/drivers/usb2422.c b/drivers/usb2422.c index 1d33b5acf8..de0e399f87 100644 --- a/drivers/usb2422.c +++ b/drivers/usb2422.c | |||
| @@ -346,10 +346,10 @@ static void USB2422_write_block(void) { | |||
| 346 | 346 | ||
| 347 | void USB2422_init(void) { | 347 | void USB2422_init(void) { |
| 348 | #ifdef USB2422_RESET_PIN | 348 | #ifdef USB2422_RESET_PIN |
| 349 | setPinOutput(USB2422_RESET_PIN); | 349 | gpio_set_pin_output(USB2422_RESET_PIN); |
| 350 | #endif | 350 | #endif |
| 351 | #ifdef USB2422_ACTIVE_PIN | 351 | #ifdef USB2422_ACTIVE_PIN |
| 352 | setPinInput(USB2422_ACTIVE_PIN); | 352 | gpio_set_pin_input(USB2422_ACTIVE_PIN); |
| 353 | #endif | 353 | #endif |
| 354 | 354 | ||
| 355 | i2c_init(); // IC2 clk must be high at USB2422 reset release time to signal SMB configuration | 355 | i2c_init(); // IC2 clk must be high at USB2422 reset release time to signal SMB configuration |
| @@ -387,15 +387,15 @@ void USB2422_configure(void) { | |||
| 387 | 387 | ||
| 388 | void USB2422_reset(void) { | 388 | void USB2422_reset(void) { |
| 389 | #ifdef USB2422_RESET_PIN | 389 | #ifdef USB2422_RESET_PIN |
| 390 | writePinLow(USB2422_RESET_PIN); | 390 | gpio_write_pin_low(USB2422_RESET_PIN); |
| 391 | wait_us(2); | 391 | wait_us(2); |
| 392 | writePinHigh(USB2422_RESET_PIN); | 392 | gpio_write_pin_high(USB2422_RESET_PIN); |
| 393 | #endif | 393 | #endif |
| 394 | } | 394 | } |
| 395 | 395 | ||
| 396 | bool USB2422_active(void) { | 396 | bool USB2422_active(void) { |
| 397 | #ifdef USB2422_ACTIVE_PIN | 397 | #ifdef USB2422_ACTIVE_PIN |
| 398 | return readPin(USB2422_ACTIVE_PIN); | 398 | return gpio_read_pin(USB2422_ACTIVE_PIN); |
| 399 | #else | 399 | #else |
| 400 | return 1; | 400 | return 1; |
| 401 | #endif | 401 | #endif |
diff --git a/keyboards/handwired/onekey/keymaps/chibios_waiting_test/keymap.c b/keyboards/handwired/onekey/keymaps/chibios_waiting_test/keymap.c index 65983c8dd8..361a08a760 100644 --- a/keyboards/handwired/onekey/keymaps/chibios_waiting_test/keymap.c +++ b/keyboards/handwired/onekey/keymaps/chibios_waiting_test/keymap.c | |||
| @@ -13,20 +13,20 @@ static inline void chThdSleepMicroseconds(uint32_t us) { | |||
| 13 | #endif | 13 | #endif |
| 14 | 14 | ||
| 15 | void keyboard_post_init_user(void) { | 15 | void keyboard_post_init_user(void) { |
| 16 | setPinOutput(QMK_WAITING_TEST_BUSY_PIN); | 16 | gpio_set_pin_output(QMK_WAITING_TEST_BUSY_PIN); |
| 17 | setPinOutput(QMK_WAITING_TEST_YIELD_PIN); | 17 | gpio_set_pin_output(QMK_WAITING_TEST_YIELD_PIN); |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | static inline void wait_us_polling_with_strobe(uint32_t us) { | 20 | static inline void wait_us_polling_with_strobe(uint32_t us) { |
| 21 | writePinHigh(QMK_WAITING_TEST_BUSY_PIN); | 21 | gpio_write_pin_high(QMK_WAITING_TEST_BUSY_PIN); |
| 22 | wait_us(us); | 22 | wait_us(us); |
| 23 | writePinLow(QMK_WAITING_TEST_BUSY_PIN); | 23 | gpio_write_pin_low(QMK_WAITING_TEST_BUSY_PIN); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | static inline void wait_us_yield_with_strobe(uint32_t us) { | 26 | static inline void wait_us_yield_with_strobe(uint32_t us) { |
| 27 | writePinHigh(QMK_WAITING_TEST_YIELD_PIN); | 27 | gpio_write_pin_high(QMK_WAITING_TEST_YIELD_PIN); |
| 28 | chThdSleepMicroseconds(us); | 28 | chThdSleepMicroseconds(us); |
| 29 | writePinLow(QMK_WAITING_TEST_YIELD_PIN); | 29 | gpio_write_pin_low(QMK_WAITING_TEST_YIELD_PIN); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | static const uint32_t waiting_values[] = {0, 1, 5, 10, 25, 50, 100, 150, 200, 500, 1000}; | 32 | static const uint32_t waiting_values[] = {0, 1, 5, 10, 25, 50, 100, 150, 200, 500, 1000}; |
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 | } |
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; | |||
| 26 | 26 | ||
| 27 | static inline void backlight_on(pin_t backlight_pin) { | 27 | static inline void backlight_on(pin_t backlight_pin) { |
| 28 | #if BACKLIGHT_ON_STATE == 0 | 28 | #if BACKLIGHT_ON_STATE == 0 |
| 29 | writePinLow(backlight_pin); | 29 | gpio_write_pin_low(backlight_pin); |
| 30 | #else | 30 | #else |
| 31 | writePinHigh(backlight_pin); | 31 | gpio_write_pin_high(backlight_pin); |
| 32 | #endif | 32 | #endif |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | static inline void backlight_off(pin_t backlight_pin) { | 35 | static inline void backlight_off(pin_t backlight_pin) { |
| 36 | #if BACKLIGHT_ON_STATE == 0 | 36 | #if BACKLIGHT_ON_STATE == 0 |
| 37 | writePinHigh(backlight_pin); | 37 | gpio_write_pin_high(backlight_pin); |
| 38 | #else | 38 | #else |
| 39 | writePinLow(backlight_pin); | 39 | gpio_write_pin_low(backlight_pin); |
| 40 | #endif | 40 | #endif |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | void backlight_pins_init(void) { | 43 | void backlight_pins_init(void) { |
| 44 | // Setup backlight pin as output and output to off state. | 44 | // Setup backlight pin as output and output to off state. |
| 45 | FOR_EACH_LED(setPinOutput(backlight_pin); backlight_off(backlight_pin);) | 45 | FOR_EACH_LED(gpio_set_pin_output(backlight_pin); backlight_off(backlight_pin);) |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | void backlight_pins_on(void) { | 48 | 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) { | |||
| 94 | } | 94 | } |
| 95 | # endif | 95 | # endif |
| 96 | for (uint8_t i = 0; i < NUM_DIP_SWITCHES; i++) { | 96 | for (uint8_t i = 0; i < NUM_DIP_SWITCHES; i++) { |
| 97 | setPinInputHigh(dip_switch_pad[i]); | 97 | gpio_set_pin_input_high(dip_switch_pad[i]); |
| 98 | } | 98 | } |
| 99 | dip_switch_read(true); | 99 | dip_switch_read(true); |
| 100 | #endif | 100 | #endif |
| @@ -123,7 +123,7 @@ void dip_switch_read(bool forced) { | |||
| 123 | 123 | ||
| 124 | for (uint8_t i = 0; i < NUM_DIP_SWITCHES; i++) { | 124 | for (uint8_t i = 0; i < NUM_DIP_SWITCHES; i++) { |
| 125 | #ifdef DIP_SWITCH_PINS | 125 | #ifdef DIP_SWITCH_PINS |
| 126 | dip_switch_state[i] = !readPin(dip_switch_pad[i]); | 126 | dip_switch_state[i] = !gpio_read_pin(dip_switch_pad[i]); |
| 127 | #endif | 127 | #endif |
| 128 | #ifdef DIP_SWITCH_MATRIX_GRID | 128 | #ifdef DIP_SWITCH_MATRIX_GRID |
| 129 | dip_switch_state[i] = peek_matrix(dip_switch_pad[i].row, dip_switch_pad[i].col, read_raw); | 129 | 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) { | |||
| 162 | #endif // defined(SPLIT_KEYBOARD) && defined(ENCODER_RESOLUTIONS) | 162 | #endif // defined(SPLIT_KEYBOARD) && defined(ENCODER_RESOLUTIONS) |
| 163 | 163 | ||
| 164 | for (uint8_t i = 0; i < thisCount; i++) { | 164 | for (uint8_t i = 0; i < thisCount; i++) { |
| 165 | setPinInputHigh(encoders_pad_a[i]); | 165 | gpio_set_pin_input_high(encoders_pad_a[i]); |
| 166 | setPinInputHigh(encoders_pad_b[i]); | 166 | gpio_set_pin_input_high(encoders_pad_b[i]); |
| 167 | } | 167 | } |
| 168 | encoder_wait_pullup_charge(); | 168 | encoder_wait_pullup_charge(); |
| 169 | for (uint8_t i = 0; i < thisCount; i++) { | 169 | for (uint8_t i = 0; i < thisCount; i++) { |
| 170 | encoder_state[i] = (readPin(encoders_pad_a[i]) << 0) | (readPin(encoders_pad_b[i]) << 1); | 170 | encoder_state[i] = (gpio_read_pin(encoders_pad_a[i]) << 0) | (gpio_read_pin(encoders_pad_b[i]) << 1); |
| 171 | } | 171 | } |
| 172 | } | 172 | } |
| 173 | 173 | ||
| @@ -247,7 +247,7 @@ static bool encoder_update(uint8_t index, uint8_t state) { | |||
| 247 | bool encoder_read(void) { | 247 | bool encoder_read(void) { |
| 248 | bool changed = false; | 248 | bool changed = false; |
| 249 | for (uint8_t i = 0; i < thisCount; i++) { | 249 | for (uint8_t i = 0; i < thisCount; i++) { |
| 250 | uint8_t new_status = (readPin(encoders_pad_a[i]) << 0) | (readPin(encoders_pad_b[i]) << 1); | 250 | uint8_t new_status = (gpio_read_pin(encoders_pad_a[i]) << 0) | (gpio_read_pin(encoders_pad_b[i]) << 1); |
| 251 | if ((encoder_state[i] & 0x3) != new_status) { | 251 | if ((encoder_state[i] & 0x3) != new_status) { |
| 252 | encoder_state[i] <<= 2; | 252 | encoder_state[i] <<= 2; |
| 253 | encoder_state[i] |= new_status; | 253 | 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) { | |||
| 96 | #endif | 96 | #endif |
| 97 | eeconfig_debug_haptic(); | 97 | eeconfig_debug_haptic(); |
| 98 | #ifdef HAPTIC_ENABLE_PIN | 98 | #ifdef HAPTIC_ENABLE_PIN |
| 99 | setPinOutput(HAPTIC_ENABLE_PIN); | 99 | gpio_set_pin_output(HAPTIC_ENABLE_PIN); |
| 100 | #endif | 100 | #endif |
| 101 | #ifdef HAPTIC_ENABLE_STATUS_LED | 101 | #ifdef HAPTIC_ENABLE_STATUS_LED |
| 102 | setPinOutput(HAPTIC_ENABLE_STATUS_LED); | 102 | gpio_set_pin_output(HAPTIC_ENABLE_STATUS_LED); |
| 103 | #endif | 103 | #endif |
| 104 | } | 104 | } |
| 105 | 105 | ||
| @@ -356,9 +356,9 @@ void haptic_shutdown(void) { | |||
| 356 | void haptic_notify_usb_device_state_change(void) { | 356 | void haptic_notify_usb_device_state_change(void) { |
| 357 | update_haptic_enable_gpios(); | 357 | update_haptic_enable_gpios(); |
| 358 | #if defined(HAPTIC_ENABLE_PIN) | 358 | #if defined(HAPTIC_ENABLE_PIN) |
| 359 | setPinOutput(HAPTIC_ENABLE_PIN); | 359 | gpio_set_pin_output(HAPTIC_ENABLE_PIN); |
| 360 | #endif | 360 | #endif |
| 361 | #if defined(HAPTIC_ENABLE_STATUS_LED) | 361 | #if defined(HAPTIC_ENABLE_STATUS_LED) |
| 362 | setPinOutput(HAPTIC_ENABLE_STATUS_LED); | 362 | gpio_set_pin_output(HAPTIC_ENABLE_STATUS_LED); |
| 363 | #endif | 363 | #endif |
| 364 | } | 364 | } |
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); | |||
| 84 | # ifndef HAPTIC_ENABLE_PIN | 84 | # ifndef HAPTIC_ENABLE_PIN |
| 85 | # error HAPTIC_ENABLE_PIN not defined | 85 | # error HAPTIC_ENABLE_PIN not defined |
| 86 | # endif | 86 | # endif |
| 87 | # define HAPTIC_ENABLE_PIN_WRITE_ACTIVE() writePinLow(HAPTIC_ENABLE_PIN) | 87 | # define HAPTIC_ENABLE_PIN_WRITE_ACTIVE() gpio_write_pin_low(HAPTIC_ENABLE_PIN) |
| 88 | # define HAPTIC_ENABLE_PIN_WRITE_INACTIVE() writePinHigh(HAPTIC_ENABLE_PIN) | 88 | # define HAPTIC_ENABLE_PIN_WRITE_INACTIVE() gpio_write_pin_high(HAPTIC_ENABLE_PIN) |
| 89 | #else | 89 | #else |
| 90 | # define HAPTIC_ENABLE_PIN_WRITE_ACTIVE() writePinHigh(HAPTIC_ENABLE_PIN) | 90 | # define HAPTIC_ENABLE_PIN_WRITE_ACTIVE() gpio_write_pin_high(HAPTIC_ENABLE_PIN) |
| 91 | # define HAPTIC_ENABLE_PIN_WRITE_INACTIVE() writePinLow(HAPTIC_ENABLE_PIN) | 91 | # define HAPTIC_ENABLE_PIN_WRITE_INACTIVE() gpio_write_pin_low(HAPTIC_ENABLE_PIN) |
| 92 | #endif | 92 | #endif |
| 93 | 93 | ||
| 94 | #ifdef HAPTIC_ENABLE_STATUS_LED_ACTIVE_LOW | 94 | #ifdef HAPTIC_ENABLE_STATUS_LED_ACTIVE_LOW |
| 95 | # ifndef HAPTIC_ENABLE_STATUS_LED | 95 | # ifndef HAPTIC_ENABLE_STATUS_LED |
| 96 | # error HAPTIC_ENABLE_STATUS_LED not defined | 96 | # error HAPTIC_ENABLE_STATUS_LED not defined |
| 97 | # endif | 97 | # endif |
| 98 | # define HAPTIC_ENABLE_STATUS_LED_WRITE_ACTIVE() writePinLow(HAPTIC_ENABLE_STATUS_LED) | 98 | # define HAPTIC_ENABLE_STATUS_LED_WRITE_ACTIVE() gpio_write_pin_low(HAPTIC_ENABLE_STATUS_LED) |
| 99 | # define HAPTIC_ENABLE_STATUS_LED_WRITE_INACTIVE() writePinHigh(HAPTIC_ENABLE_STATUS_LED) | 99 | # define HAPTIC_ENABLE_STATUS_LED_WRITE_INACTIVE() gpio_write_pin_high(HAPTIC_ENABLE_STATUS_LED) |
| 100 | #else | 100 | #else |
| 101 | # define HAPTIC_ENABLE_STATUS_LED_WRITE_ACTIVE() writePinHigh(HAPTIC_ENABLE_STATUS_LED) | 101 | # define HAPTIC_ENABLE_STATUS_LED_WRITE_ACTIVE() gpio_write_pin_high(HAPTIC_ENABLE_STATUS_LED) |
| 102 | # define HAPTIC_ENABLE_STATUS_LED_WRITE_INACTIVE() writePinLow(HAPTIC_ENABLE_STATUS_LED) | 102 | # define HAPTIC_ENABLE_STATUS_LED_WRITE_INACTIVE() gpio_write_pin_low(HAPTIC_ENABLE_STATUS_LED) |
| 103 | #endif | 103 | #endif |
| 104 | 104 | ||
| 105 | #ifndef HAPTIC_OFF_IN_LOW_POWER | 105 | #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) { | |||
| 43 | if (axis >= JOYSTICK_AXIS_COUNT) return; | 43 | if (axis >= JOYSTICK_AXIS_COUNT) return; |
| 44 | 44 | ||
| 45 | #if defined(JOYSTICK_ANALOG) | 45 | #if defined(JOYSTICK_ANALOG) |
| 46 | setPinInput(joystick_axes[axis].input_pin); | 46 | gpio_set_pin_input(joystick_axes[axis].input_pin); |
| 47 | #endif | 47 | #endif |
| 48 | } | 48 | } |
| 49 | 49 | ||
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) { | |||
| 98 | #endif | 98 | #endif |
| 99 | 99 | ||
| 100 | #ifdef LED_NUM_LOCK_PIN | 100 | #ifdef LED_NUM_LOCK_PIN |
| 101 | writePin(LED_NUM_LOCK_PIN, led_state.num_lock); | 101 | gpio_write_pin(LED_NUM_LOCK_PIN, led_state.num_lock); |
| 102 | #endif | 102 | #endif |
| 103 | #ifdef LED_CAPS_LOCK_PIN | 103 | #ifdef LED_CAPS_LOCK_PIN |
| 104 | writePin(LED_CAPS_LOCK_PIN, led_state.caps_lock); | 104 | gpio_write_pin(LED_CAPS_LOCK_PIN, led_state.caps_lock); |
| 105 | #endif | 105 | #endif |
| 106 | #ifdef LED_SCROLL_LOCK_PIN | 106 | #ifdef LED_SCROLL_LOCK_PIN |
| 107 | writePin(LED_SCROLL_LOCK_PIN, led_state.scroll_lock); | 107 | gpio_write_pin(LED_SCROLL_LOCK_PIN, led_state.scroll_lock); |
| 108 | #endif | 108 | #endif |
| 109 | #ifdef LED_COMPOSE_PIN | 109 | #ifdef LED_COMPOSE_PIN |
| 110 | writePin(LED_COMPOSE_PIN, led_state.compose); | 110 | gpio_write_pin(LED_COMPOSE_PIN, led_state.compose); |
| 111 | #endif | 111 | #endif |
| 112 | #ifdef LED_KANA_PIN | 112 | #ifdef LED_KANA_PIN |
| 113 | writePin(LED_KANA_PIN, led_state.kana); | 113 | gpio_write_pin(LED_KANA_PIN, led_state.kana); |
| 114 | #endif | 114 | #endif |
| 115 | } | 115 | } |
| 116 | 116 | ||
| @@ -118,24 +118,24 @@ __attribute__((weak)) void led_update_ports(led_t led_state) { | |||
| 118 | */ | 118 | */ |
| 119 | __attribute__((weak)) void led_init_ports(void) { | 119 | __attribute__((weak)) void led_init_ports(void) { |
| 120 | #ifdef LED_NUM_LOCK_PIN | 120 | #ifdef LED_NUM_LOCK_PIN |
| 121 | setPinOutput(LED_NUM_LOCK_PIN); | 121 | gpio_set_pin_output(LED_NUM_LOCK_PIN); |
| 122 | writePin(LED_NUM_LOCK_PIN, !LED_PIN_ON_STATE); | 122 | gpio_write_pin(LED_NUM_LOCK_PIN, !LED_PIN_ON_STATE); |
| 123 | #endif | 123 | #endif |
| 124 | #ifdef LED_CAPS_LOCK_PIN | 124 | #ifdef LED_CAPS_LOCK_PIN |
| 125 | setPinOutput(LED_CAPS_LOCK_PIN); | 125 | gpio_set_pin_output(LED_CAPS_LOCK_PIN); |
| 126 | writePin(LED_CAPS_LOCK_PIN, !LED_PIN_ON_STATE); | 126 | gpio_write_pin(LED_CAPS_LOCK_PIN, !LED_PIN_ON_STATE); |
| 127 | #endif | 127 | #endif |
| 128 | #ifdef LED_SCROLL_LOCK_PIN | 128 | #ifdef LED_SCROLL_LOCK_PIN |
| 129 | setPinOutput(LED_SCROLL_LOCK_PIN); | 129 | gpio_set_pin_output(LED_SCROLL_LOCK_PIN); |
| 130 | writePin(LED_SCROLL_LOCK_PIN, !LED_PIN_ON_STATE); | 130 | gpio_write_pin(LED_SCROLL_LOCK_PIN, !LED_PIN_ON_STATE); |
| 131 | #endif | 131 | #endif |
| 132 | #ifdef LED_COMPOSE_PIN | 132 | #ifdef LED_COMPOSE_PIN |
| 133 | setPinOutput(LED_COMPOSE_PIN); | 133 | gpio_set_pin_output(LED_COMPOSE_PIN); |
| 134 | writePin(LED_COMPOSE_PIN, !LED_PIN_ON_STATE); | 134 | gpio_write_pin(LED_COMPOSE_PIN, !LED_PIN_ON_STATE); |
| 135 | #endif | 135 | #endif |
| 136 | #ifdef LED_KANA_PIN | 136 | #ifdef LED_KANA_PIN |
| 137 | setPinOutput(LED_KANA_PIN); | 137 | gpio_set_pin_output(LED_KANA_PIN); |
| 138 | writePin(LED_KANA_PIN, !LED_PIN_ON_STATE); | 138 | gpio_write_pin(LED_KANA_PIN, !LED_PIN_ON_STATE); |
| 139 | #endif | 139 | #endif |
| 140 | } | 140 | } |
| 141 | 141 | ||
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[] | |||
| 78 | 78 | ||
| 79 | static inline void setPinOutput_writeLow(pin_t pin) { | 79 | static inline void setPinOutput_writeLow(pin_t pin) { |
| 80 | ATOMIC_BLOCK_FORCEON { | 80 | ATOMIC_BLOCK_FORCEON { |
| 81 | setPinOutput(pin); | 81 | gpio_set_pin_output(pin); |
| 82 | writePinLow(pin); | 82 | gpio_write_pin_low(pin); |
| 83 | } | 83 | } |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | static inline void setPinOutput_writeHigh(pin_t pin) { | 86 | static inline void setPinOutput_writeHigh(pin_t pin) { |
| 87 | ATOMIC_BLOCK_FORCEON { | 87 | ATOMIC_BLOCK_FORCEON { |
| 88 | setPinOutput(pin); | 88 | gpio_set_pin_output(pin); |
| 89 | writePinHigh(pin); | 89 | gpio_write_pin_high(pin); |
| 90 | } | 90 | } |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | static inline void setPinInputHigh_atomic(pin_t pin) { | 93 | static inline void setPinInputHigh_atomic(pin_t pin) { |
| 94 | ATOMIC_BLOCK_FORCEON { | 94 | ATOMIC_BLOCK_FORCEON { |
| 95 | setPinInputHigh(pin); | 95 | gpio_set_pin_input_high(pin); |
| 96 | } | 96 | } |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | static inline uint8_t readMatrixPin(pin_t pin) { | 99 | static inline uint8_t readMatrixPin(pin_t pin) { |
| 100 | if (pin != NO_PIN) { | 100 | if (pin != NO_PIN) { |
| 101 | return (readPin(pin) == MATRIX_INPUT_PRESSED_STATE) ? 0 : 1; | 101 | return (gpio_read_pin(pin) == MATRIX_INPUT_PRESSED_STATE) ? 0 : 1; |
| 102 | } else { | 102 | } else { |
| 103 | return 1; | 103 | return 1; |
| 104 | } | 104 | } |
| @@ -113,7 +113,7 @@ __attribute__((weak)) void matrix_init_pins(void) { | |||
| 113 | for (int col = 0; col < MATRIX_COLS; col++) { | 113 | for (int col = 0; col < MATRIX_COLS; col++) { |
| 114 | pin_t pin = direct_pins[row][col]; | 114 | pin_t pin = direct_pins[row][col]; |
| 115 | if (pin != NO_PIN) { | 115 | if (pin != NO_PIN) { |
| 116 | setPinInputHigh(pin); | 116 | gpio_set_pin_input_high(pin); |
| 117 | } | 117 | } |
| 118 | } | 118 | } |
| 119 | } | 119 | } |
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) { | |||
| 149 | pointing_device_driver.init(); | 149 | pointing_device_driver.init(); |
| 150 | #ifdef POINTING_DEVICE_MOTION_PIN | 150 | #ifdef POINTING_DEVICE_MOTION_PIN |
| 151 | # ifdef POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW | 151 | # ifdef POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW |
| 152 | setPinInputHigh(POINTING_DEVICE_MOTION_PIN); | 152 | gpio_set_pin_input_high(POINTING_DEVICE_MOTION_PIN); |
| 153 | # else | 153 | # else |
| 154 | setPinInput(POINTING_DEVICE_MOTION_PIN); | 154 | gpio_set_pin_input(POINTING_DEVICE_MOTION_PIN); |
| 155 | # endif | 155 | # endif |
| 156 | #endif | 156 | #endif |
| 157 | } | 157 | } |
| @@ -247,9 +247,9 @@ __attribute__((weak)) bool pointing_device_task(void) { | |||
| 247 | # error POINTING_DEVICE_MOTION_PIN not supported when sharing the pointing device report between sides. | 247 | # error POINTING_DEVICE_MOTION_PIN not supported when sharing the pointing device report between sides. |
| 248 | # endif | 248 | # endif |
| 249 | # ifdef POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW | 249 | # ifdef POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW |
| 250 | if (!readPin(POINTING_DEVICE_MOTION_PIN)) | 250 | if (!gpio_read_pin(POINTING_DEVICE_MOTION_PIN)) |
| 251 | # else | 251 | # else |
| 252 | if (readPin(POINTING_DEVICE_MOTION_PIN)) | 252 | if (gpio_read_pin(POINTING_DEVICE_MOTION_PIN)) |
| 253 | # endif | 253 | # endif |
| 254 | { | 254 | { |
| 255 | #endif | 255 | #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) { | |||
| 123 | void matrix_io_delay(void); | 123 | void matrix_io_delay(void); |
| 124 | 124 | ||
| 125 | static uint8_t peek_matrix_intersection(pin_t out_pin, pin_t in_pin) { | 125 | static uint8_t peek_matrix_intersection(pin_t out_pin, pin_t in_pin) { |
| 126 | setPinInputHigh(in_pin); | 126 | gpio_set_pin_input_high(in_pin); |
| 127 | setPinOutput(out_pin); | 127 | gpio_set_pin_output(out_pin); |
| 128 | writePinLow(out_pin); | 128 | gpio_write_pin_low(out_pin); |
| 129 | // It's almost unnecessary, but wait until it's down to low, just in case. | 129 | // It's almost unnecessary, but wait until it's down to low, just in case. |
| 130 | wait_us(1); | 130 | wait_us(1); |
| 131 | uint8_t pin_state = readPin(in_pin); | 131 | uint8_t pin_state = gpio_read_pin(in_pin); |
| 132 | // Set out_pin to a setting that is less susceptible to noise. | 132 | // Set out_pin to a setting that is less susceptible to noise. |
| 133 | setPinInputHigh(out_pin); | 133 | gpio_set_pin_input_high(out_pin); |
| 134 | matrix_io_delay(); // Wait for the pull-up to go HIGH. | 134 | matrix_io_delay(); // Wait for the pull-up to go HIGH. |
| 135 | return pin_state; | 135 | return pin_state; |
| 136 | } | 136 | } |
| @@ -138,13 +138,13 @@ static uint8_t peek_matrix_intersection(pin_t out_pin, pin_t in_pin) { | |||
| 138 | 138 | ||
| 139 | __attribute__((weak)) bool is_keyboard_left_impl(void) { | 139 | __attribute__((weak)) bool is_keyboard_left_impl(void) { |
| 140 | #if defined(SPLIT_HAND_PIN) | 140 | #if defined(SPLIT_HAND_PIN) |
| 141 | setPinInput(SPLIT_HAND_PIN); | 141 | gpio_set_pin_input(SPLIT_HAND_PIN); |
| 142 | wait_us(100); | 142 | wait_us(100); |
| 143 | // Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand | 143 | // Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand |
| 144 | # ifdef SPLIT_HAND_PIN_LOW_IS_LEFT | 144 | # ifdef SPLIT_HAND_PIN_LOW_IS_LEFT |
| 145 | return !readPin(SPLIT_HAND_PIN); | 145 | return !gpio_read_pin(SPLIT_HAND_PIN); |
| 146 | # else | 146 | # else |
| 147 | return readPin(SPLIT_HAND_PIN); | 147 | return gpio_read_pin(SPLIT_HAND_PIN); |
| 148 | # endif | 148 | # endif |
| 149 | #elif defined(SPLIT_HAND_MATRIX_GRID) | 149 | #elif defined(SPLIT_HAND_MATRIX_GRID) |
| 150 | # ifdef SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT | 150 | # ifdef SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT |
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 |
