diff options
Diffstat (limited to 'drivers')
39 files changed, 207 insertions, 207 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 |
