summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2024-02-18 17:08:27 +1100
committerGitHub <noreply@github.com>2024-02-18 17:08:27 +1100
commit2d1aed78a67b3d2b002cc739ef087963b05b76b8 (patch)
treeea681d02e547332cffa6b7aec6c16ef37ad70ee3 /drivers
parent6810aaf0130113e267e20fb506d874cc858f5f67 (diff)
Update GPIO macro usages in core (#23093)
Diffstat (limited to 'drivers')
-rw-r--r--drivers/bluetooth/bluefruit_le.cpp18
-rw-r--r--drivers/eeprom/eeprom_i2c.c12
-rw-r--r--drivers/gpio/sn74x138.c24
-rw-r--r--drivers/gpio/sn74x154.c18
-rw-r--r--drivers/haptic/solenoid.c14
-rw-r--r--drivers/lcd/hd44780.c48
-rw-r--r--drivers/lcd/st7565.c16
-rw-r--r--drivers/led/apa102.c24
-rw-r--r--drivers/led/aw20216s.c4
-rw-r--r--drivers/led/issi/is31fl3218-mono.c4
-rw-r--r--drivers/led/issi/is31fl3218.c4
-rw-r--r--drivers/led/issi/is31fl3731-mono.c4
-rw-r--r--drivers/led/issi/is31fl3731.c4
-rw-r--r--drivers/led/issi/is31fl3733-mono.c4
-rw-r--r--drivers/led/issi/is31fl3733.c4
-rw-r--r--drivers/led/issi/is31fl3736-mono.c4
-rw-r--r--drivers/led/issi/is31fl3736.c4
-rw-r--r--drivers/led/issi/is31fl3737-mono.c4
-rw-r--r--drivers/led/issi/is31fl3737.c4
-rw-r--r--drivers/led/issi/is31fl3741-mono.c4
-rw-r--r--drivers/led/issi/is31fl3741.c4
-rw-r--r--drivers/led/issi/is31fl3742a-mono.c4
-rw-r--r--drivers/led/issi/is31fl3742a.c4
-rw-r--r--drivers/led/issi/is31fl3743a-mono.c4
-rw-r--r--drivers/led/issi/is31fl3743a.c4
-rw-r--r--drivers/led/issi/is31fl3745-mono.c4
-rw-r--r--drivers/led/issi/is31fl3745.c4
-rw-r--r--drivers/led/issi/is31fl3746a-mono.c4
-rw-r--r--drivers/led/issi/is31fl3746a.c4
-rw-r--r--drivers/led/snled27351-mono.c4
-rw-r--r--drivers/led/snled27351.c4
-rw-r--r--drivers/oled/oled_driver.c20
-rw-r--r--drivers/painter/comms/qp_comms_spi.c20
-rw-r--r--drivers/sensors/adns5050.c32
-rw-r--r--drivers/sensors/adns9800.c2
-rw-r--r--drivers/sensors/analog_joystick.c8
-rw-r--r--drivers/sensors/paw3204.c24
-rw-r--r--drivers/sensors/pmw3320.c32
-rw-r--r--drivers/usb2422.c10
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) {
bool ready = false;
do {
- ready = readPin(BLUEFRUIT_LE_IRQ_PIN);
+ ready = gpio_read_pin(BLUEFRUIT_LE_IRQ_PIN);
if (ready) {
break;
}
@@ -231,7 +231,7 @@ static void resp_buf_read_one(bool greedy) {
return;
}
- if (readPin(BLUEFRUIT_LE_IRQ_PIN)) {
+ if (gpio_read_pin(BLUEFRUIT_LE_IRQ_PIN)) {
struct sdep_msg msg;
again:
@@ -242,7 +242,7 @@ static void resp_buf_read_one(bool greedy) {
dprintf("recv latency %dms\n", TIMER_DIFF_16(timer_read(), last_send));
}
- if (greedy && resp_buf.peek(last_send) && readPin(BLUEFRUIT_LE_IRQ_PIN)) {
+ if (greedy && resp_buf.peek(last_send) && gpio_read_pin(BLUEFRUIT_LE_IRQ_PIN)) {
goto again;
}
}
@@ -293,16 +293,16 @@ void bluefruit_le_init(void) {
state.configured = false;
state.is_connected = false;
- setPinInput(BLUEFRUIT_LE_IRQ_PIN);
+ gpio_set_pin_input(BLUEFRUIT_LE_IRQ_PIN);
spi_init();
// Perform a hardware reset
- setPinOutput(BLUEFRUIT_LE_RST_PIN);
- writePinHigh(BLUEFRUIT_LE_RST_PIN);
- writePinLow(BLUEFRUIT_LE_RST_PIN);
+ gpio_set_pin_output(BLUEFRUIT_LE_RST_PIN);
+ gpio_write_pin_high(BLUEFRUIT_LE_RST_PIN);
+ gpio_write_pin_low(BLUEFRUIT_LE_RST_PIN);
wait_ms(10);
- writePinHigh(BLUEFRUIT_LE_RST_PIN);
+ gpio_write_pin_high(BLUEFRUIT_LE_RST_PIN);
wait_ms(1000); // Give it a second to initialize
@@ -508,7 +508,7 @@ void bluefruit_le_task(void) {
resp_buf_read_one(true);
send_buf_send_one(SdepShortTimeout);
- if (resp_buf.empty() && (state.event_flags & UsingEvents) && readPin(BLUEFRUIT_LE_IRQ_PIN)) {
+ if (resp_buf.empty() && (state.event_flags & UsingEvents) && gpio_read_pin(BLUEFRUIT_LE_IRQ_PIN)) {
// Must be an event update
if (at_command_P(PSTR("AT+EVENTSTATUS"), resbuf, sizeof(resbuf))) {
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) {
i2c_init();
#if defined(EXTERNAL_EEPROM_WP_PIN)
/* We are setting the WP pin to high in a way that requires at least two bit-flips to change back to 0 */
- writePin(EXTERNAL_EEPROM_WP_PIN, 1);
- setPinInputHigh(EXTERNAL_EEPROM_WP_PIN);
+ gpio_write_pin(EXTERNAL_EEPROM_WP_PIN, 1);
+ gpio_set_pin_input_high(EXTERNAL_EEPROM_WP_PIN);
#endif
}
@@ -100,8 +100,8 @@ void eeprom_write_block(const void *buf, void *addr, size_t len) {
uintptr_t target_addr = (uintptr_t)addr;
#if defined(EXTERNAL_EEPROM_WP_PIN)
- setPinOutput(EXTERNAL_EEPROM_WP_PIN);
- writePin(EXTERNAL_EEPROM_WP_PIN, 0);
+ gpio_set_pin_output(EXTERNAL_EEPROM_WP_PIN);
+ gpio_write_pin(EXTERNAL_EEPROM_WP_PIN, 0);
#endif
while (len > 0) {
@@ -134,7 +134,7 @@ void eeprom_write_block(const void *buf, void *addr, size_t len) {
#if defined(EXTERNAL_EEPROM_WP_PIN)
/* We are setting the WP pin to high in a way that requires at least two bit-flips to change back to 0 */
- writePin(EXTERNAL_EEPROM_WP_PIN, 1);
- setPinInputHigh(EXTERNAL_EEPROM_WP_PIN);
+ gpio_write_pin(EXTERNAL_EEPROM_WP_PIN, 1);
+ gpio_set_pin_input_high(EXTERNAL_EEPROM_WP_PIN);
#endif
}
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;
void sn74x138_init(void) {
for (int i = 0; i < ADDRESS_PIN_COUNT; i++) {
- setPinOutput(address_pins[i]);
- writePinLow(address_pins[i]);
+ gpio_set_pin_output(address_pins[i]);
+ gpio_write_pin_low(address_pins[i]);
}
#if defined(SN74X138_E1_PIN)
- setPinOutput(SN74X138_E1_PIN);
- writePinHigh(SN74X138_E1_PIN);
+ gpio_set_pin_output(SN74X138_E1_PIN);
+ gpio_write_pin_high(SN74X138_E1_PIN);
#endif
#if defined(SN74X138_E2_PIN)
- setPinOutput(SN74X138_E2_PIN);
- writePinHigh(SN74X138_E2_PIN);
+ gpio_set_pin_output(SN74X138_E2_PIN);
+ gpio_write_pin_high(SN74X138_E2_PIN);
#endif
#if defined(SN74X138_E3_PIN)
- setPinOutput(SN74X138_E3_PIN);
- writePinLow(SN74X138_E3_PIN);
+ gpio_set_pin_output(SN74X138_E3_PIN);
+ gpio_write_pin_low(SN74X138_E3_PIN);
#endif
}
void sn74x138_set_enabled(bool enabled) {
#if defined(SN74X138_E1_PIN)
- writePin(SN74X138_E1_PIN, !enabled);
+ gpio_write_pin(SN74X138_E1_PIN, !enabled);
#endif
#if defined(SN74X138_E2_PIN)
- writePin(SN74X138_E2_PIN, !enabled);
+ gpio_write_pin(SN74X138_E2_PIN, !enabled);
#endif
#if defined(SN74X138_E3_PIN)
- writePin(SN74X138_E3_PIN, enabled);
+ gpio_write_pin(SN74X138_E3_PIN, enabled);
#endif
}
void sn74x138_set_addr(uint8_t address) {
for (int i = 0; i < ADDRESS_PIN_COUNT; i++) {
- writePin(address_pins[i], address & (1 << i));
+ gpio_write_pin(address_pins[i], address & (1 << i));
}
}
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;
void sn74x154_init(void) {
for (int i = 0; i < ADDRESS_PIN_COUNT; i++) {
- setPinOutput(address_pins[i]);
- writePinLow(address_pins[i]);
+ gpio_set_pin_output(address_pins[i]);
+ gpio_write_pin_low(address_pins[i]);
}
#if defined(SN74X154_E0_PIN)
- setPinOutput(SN74X154_E0_PIN);
- writePinHigh(SN74X154_E0_PIN);
+ gpio_set_pin_output(SN74X154_E0_PIN);
+ gpio_write_pin_high(SN74X154_E0_PIN);
#endif
#if defined(SN74X154_E1_PIN)
- setPinOutput(SN74X154_E1_PIN);
- writePinHigh(SN74X154_E1_PIN);
+ gpio_set_pin_output(SN74X154_E1_PIN);
+ gpio_write_pin_high(SN74X154_E1_PIN);
#endif
}
void sn74x154_set_enabled(bool enabled) {
#if defined(SN74X154_E0_PIN)
- writePin(SN74X154_E0_PIN, !enabled);
+ gpio_write_pin(SN74X154_E0_PIN, !enabled);
#endif
#if defined(SN74X154_E1_PIN)
- writePin(SN74X154_E1_PIN, !enabled);
+ gpio_write_pin(SN74X154_E1_PIN, !enabled);
#endif
}
void sn74x154_set_addr(uint8_t address) {
for (int i = 0; i < ADDRESS_PIN_COUNT; i++) {
- writePin(address_pins[i], address & (1 << i));
+ gpio_write_pin(address_pins[i], address & (1 << i));
}
}
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) {
* @param index select which solenoid to check/stop
*/
void solenoid_stop(uint8_t index) {
- writePin(solenoid_pads[index], !solenoid_active_state[index]);
+ gpio_write_pin(solenoid_pads[index], !solenoid_active_state[index]);
solenoid_on[index] = false;
solenoid_buzzing[index] = false;
}
@@ -78,7 +78,7 @@ void solenoid_fire(uint8_t index) {
solenoid_on[index] = true;
solenoid_buzzing[index] = true;
solenoid_start[index] = timer_read();
- writePin(solenoid_pads[index], solenoid_active_state[index]);
+ gpio_write_pin(solenoid_pads[index], solenoid_active_state[index]);
}
/**
@@ -128,12 +128,12 @@ void solenoid_check(void) {
if ((elapsed[i] % (SOLENOID_BUZZ_ACTUATED + SOLENOID_BUZZ_NONACTUATED)) < SOLENOID_BUZZ_ACTUATED) {
if (!solenoid_buzzing[i]) {
solenoid_buzzing[i] = true;
- writePin(solenoid_pads[i], solenoid_active_state[i]);
+ gpio_write_pin(solenoid_pads[i], solenoid_active_state[i]);
}
} else {
if (solenoid_buzzing[i]) {
solenoid_buzzing[i] = false;
- writePin(solenoid_pads[i], !solenoid_active_state[i]);
+ gpio_write_pin(solenoid_pads[i], !solenoid_active_state[i]);
}
}
}
@@ -156,8 +156,8 @@ void solenoid_setup(void) {
#else
solenoid_active_state[i] = high;
#endif
- writePin(solenoid_pads[i], !solenoid_active_state[i]);
- setPinOutput(solenoid_pads[i]);
+ gpio_write_pin(solenoid_pads[i], !solenoid_active_state[i]);
+ gpio_set_pin_output(solenoid_pads[i]);
if ((!HAPTIC_OFF_IN_LOW_POWER) || (usb_device_state == USB_DEVICE_STATE_CONFIGURED)) {
solenoid_fire(i);
}
@@ -170,6 +170,6 @@ void solenoid_setup(void) {
*/
void solenoid_shutdown(void) {
for (uint8_t i = 0; i < NUMBER_OF_SOLENOIDS; i++) {
- writePin(solenoid_pads[i], !solenoid_active_state[i]);
+ gpio_write_pin(solenoid_pads[i], !solenoid_active_state[i]);
}
}
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;
#define HD44780_ENABLE_DELAY_US 1
static void hd44780_latch(void) {
- writePinHigh(HD44780_E_PIN);
+ gpio_write_pin_high(HD44780_E_PIN);
wait_us(HD44780_ENABLE_DELAY_US);
- writePinLow(HD44780_E_PIN);
+ gpio_write_pin_low(HD44780_E_PIN);
}
void hd44780_write(uint8_t data, bool isData) {
- writePin(HD44780_RS_PIN, isData);
- writePinLow(HD44780_RW_PIN);
+ gpio_write_pin(HD44780_RS_PIN, isData);
+ gpio_write_pin_low(HD44780_RW_PIN);
for (int i = 0; i < 4; i++) {
- setPinOutput(data_pins[i]);
+ gpio_set_pin_output(data_pins[i]);
}
// Write high nibble
for (int i = 0; i < 4; i++) {
- writePin(data_pins[i], (data >> 4) & (1 << i));
+ gpio_write_pin(data_pins[i], (data >> 4) & (1 << i));
}
hd44780_latch();
// Write low nibble
for (int i = 0; i < 4; i++) {
- writePin(data_pins[i], data & (1 << i));
+ gpio_write_pin(data_pins[i], data & (1 << i));
}
hd44780_latch();
for (int i = 0; i < 4; i++) {
- writePinHigh(data_pins[i]);
+ gpio_write_pin_high(data_pins[i]);
}
}
uint8_t hd44780_read(bool isData) {
uint8_t data = 0;
- writePin(HD44780_RS_PIN, isData);
- writePinHigh(HD44780_RW_PIN);
+ gpio_write_pin(HD44780_RS_PIN, isData);
+ gpio_write_pin_high(HD44780_RW_PIN);
for (int i = 0; i < 4; i++) {
- setPinInput(data_pins[i]);
+ gpio_set_pin_input(data_pins[i]);
}
- writePinHigh(HD44780_E_PIN);
+ gpio_write_pin_high(HD44780_E_PIN);
wait_us(HD44780_ENABLE_DELAY_US);
// Read high nibble
for (int i = 0; i < 4; i++) {
- data |= (readPin(data_pins[i]) << i);
+ data |= (gpio_read_pin(data_pins[i]) << i);
}
data <<= 4;
- writePinLow(HD44780_E_PIN);
+ gpio_write_pin_low(HD44780_E_PIN);
wait_us(HD44780_ENABLE_DELAY_US);
- writePinHigh(HD44780_E_PIN);
+ gpio_write_pin_high(HD44780_E_PIN);
wait_us(HD44780_ENABLE_DELAY_US);
// Read low nibble
for (int i = 0; i < 4; i++) {
- data |= (readPin(data_pins[i]) << i);
+ data |= (gpio_read_pin(data_pins[i]) << i);
}
- writePinLow(HD44780_E_PIN);
+ gpio_write_pin_low(HD44780_E_PIN);
return data;
}
@@ -171,20 +171,20 @@ void hd44780_set_ddram_address(uint8_t address) {
}
void hd44780_init(bool cursor, bool blink) {
- setPinOutput(HD44780_RS_PIN);
- setPinOutput(HD44780_RW_PIN);
- setPinOutput(HD44780_E_PIN);
+ gpio_set_pin_output(HD44780_RS_PIN);
+ gpio_set_pin_output(HD44780_RW_PIN);
+ gpio_set_pin_output(HD44780_E_PIN);
for (int i = 0; i < 4; i++) {
- setPinOutput(data_pins[i]);
+ gpio_set_pin_output(data_pins[i]);
}
wait_ms(HD44780_INIT_DELAY_MS);
// Manually configure for 4-bit mode - can't use hd44780_command() yet
// HD44780U datasheet, Fig. 24 (p46)
- writePinHigh(data_pins[0]); // Function set
- writePinHigh(data_pins[1]); // DL = 1
+ gpio_write_pin_high(data_pins[0]); // Function set
+ gpio_write_pin_high(data_pins[1]); // DL = 1
hd44780_latch();
wait_ms(5);
// Send again
@@ -194,7 +194,7 @@ void hd44780_init(bool cursor, bool blink) {
hd44780_latch();
wait_us(64);
- writePinLow(data_pins[0]); // DL = 0
+ gpio_write_pin_low(data_pins[0]); // DL = 0
hd44780_latch();
wait_us(64);
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) {
}
bool st7565_init(display_rotation_t rotation) {
- setPinOutput(ST7565_A0_PIN);
- writePinHigh(ST7565_A0_PIN);
- setPinOutput(ST7565_RST_PIN);
- writePinHigh(ST7565_RST_PIN);
+ gpio_set_pin_output(ST7565_A0_PIN);
+ gpio_write_pin_high(ST7565_A0_PIN);
+ gpio_set_pin_output(ST7565_RST_PIN);
+ gpio_write_pin_high(ST7565_RST_PIN);
st7565_rotation = st7565_init_user(rotation);
@@ -488,18 +488,18 @@ void st7565_task(void) {
__attribute__((weak)) void st7565_task_user(void) {}
void st7565_reset(void) {
- writePinLow(ST7565_RST_PIN);
+ gpio_write_pin_low(ST7565_RST_PIN);
wait_ms(20);
- writePinHigh(ST7565_RST_PIN);
+ gpio_write_pin_high(ST7565_RST_PIN);
wait_ms(20);
}
spi_status_t st7565_send_cmd(uint8_t cmd) {
- writePinLow(ST7565_A0_PIN);
+ gpio_write_pin_low(ST7565_A0_PIN);
return spi_write(cmd);
}
spi_status_t st7565_send_data(uint8_t *data, uint16_t length) {
- writePinHigh(ST7565_A0_PIN);
+ gpio_write_pin_high(ST7565_A0_PIN);
return spi_transmit(data, length);
}
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 @@
} \
} while (0)
-#define APA102_SEND_BIT(byte, bit) \
- do { \
- writePin(APA102_DI_PIN, (byte >> bit) & 1); \
- io_wait; \
- writePinHigh(APA102_CI_PIN); \
- io_wait; \
- writePinLow(APA102_CI_PIN); \
- io_wait; \
+#define APA102_SEND_BIT(byte, bit) \
+ do { \
+ gpio_write_pin(APA102_DI_PIN, (byte >> bit) & 1); \
+ io_wait; \
+ gpio_write_pin_high(APA102_CI_PIN); \
+ io_wait; \
+ gpio_write_pin_low(APA102_CI_PIN); \
+ io_wait; \
} while (0)
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
}
void apa102_init(void) {
- setPinOutput(APA102_DI_PIN);
- setPinOutput(APA102_CI_PIN);
+ gpio_set_pin_output(APA102_DI_PIN);
+ gpio_set_pin_output(APA102_CI_PIN);
- writePinLow(APA102_DI_PIN);
- writePinLow(APA102_CI_PIN);
+ gpio_write_pin_low(APA102_DI_PIN);
+ gpio_write_pin_low(APA102_CI_PIN);
}
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) {
spi_init();
#if defined(AW20216S_EN_PIN)
- setPinOutput(AW20216S_EN_PIN);
- writePinHigh(AW20216S_EN_PIN);
+ gpio_set_pin_output(AW20216S_EN_PIN);
+ gpio_write_pin_high(AW20216S_EN_PIN);
#endif
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) {
i2c_init();
#if defined(IS31FL3218_SDB_PIN)
- setPinOutput(IS31FL3218_SDB_PIN);
- writePinHigh(IS31FL3218_SDB_PIN);
+ gpio_set_pin_output(IS31FL3218_SDB_PIN);
+ gpio_write_pin_high(IS31FL3218_SDB_PIN);
#endif
// 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) {
i2c_init();
#if defined(IS31FL3218_SDB_PIN)
- setPinOutput(IS31FL3218_SDB_PIN);
- writePinHigh(IS31FL3218_SDB_PIN);
+ gpio_set_pin_output(IS31FL3218_SDB_PIN);
+ gpio_write_pin_high(IS31FL3218_SDB_PIN);
#endif
// 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) {
i2c_init();
#if defined(IS31FL3731_SDB_PIN)
- setPinOutput(IS31FL3731_SDB_PIN);
- writePinHigh(IS31FL3731_SDB_PIN);
+ gpio_set_pin_output(IS31FL3731_SDB_PIN);
+ gpio_write_pin_high(IS31FL3731_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(IS31FL3731_SDB_PIN)
- setPinOutput(IS31FL3731_SDB_PIN);
- writePinHigh(IS31FL3731_SDB_PIN);
+ gpio_set_pin_output(IS31FL3731_SDB_PIN);
+ gpio_write_pin_high(IS31FL3731_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(IS31FL3733_SDB_PIN)
- setPinOutput(IS31FL3733_SDB_PIN);
- writePinHigh(IS31FL3733_SDB_PIN);
+ gpio_set_pin_output(IS31FL3733_SDB_PIN);
+ gpio_write_pin_high(IS31FL3733_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(IS31FL3733_SDB_PIN)
- setPinOutput(IS31FL3733_SDB_PIN);
- writePinHigh(IS31FL3733_SDB_PIN);
+ gpio_set_pin_output(IS31FL3733_SDB_PIN);
+ gpio_write_pin_high(IS31FL3733_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(IS31FL3736_SDB_PIN)
- setPinOutput(IS31FL3736_SDB_PIN);
- writePinHigh(IS31FL3736_SDB_PIN);
+ gpio_set_pin_output(IS31FL3736_SDB_PIN);
+ gpio_write_pin_high(IS31FL3736_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(IS31FL3736_SDB_PIN)
- setPinOutput(IS31FL3736_SDB_PIN);
- writePinHigh(IS31FL3736_SDB_PIN);
+ gpio_set_pin_output(IS31FL3736_SDB_PIN);
+ gpio_write_pin_high(IS31FL3736_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(IS31FL3737_SDB_PIN)
- setPinOutput(IS31FL3737_SDB_PIN);
- writePinHigh(IS31FL3737_SDB_PIN);
+ gpio_set_pin_output(IS31FL3737_SDB_PIN);
+ gpio_write_pin_high(IS31FL3737_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(IS31FL3737_SDB_PIN)
- setPinOutput(IS31FL3737_SDB_PIN);
- writePinHigh(IS31FL3737_SDB_PIN);
+ gpio_set_pin_output(IS31FL3737_SDB_PIN);
+ gpio_write_pin_high(IS31FL3737_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(IS31FL3741_SDB_PIN)
- setPinOutput(IS31FL3741_SDB_PIN);
- writePinHigh(IS31FL3741_SDB_PIN);
+ gpio_set_pin_output(IS31FL3741_SDB_PIN);
+ gpio_write_pin_high(IS31FL3741_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(IS31FL3741_SDB_PIN)
- setPinOutput(IS31FL3741_SDB_PIN);
- writePinHigh(IS31FL3741_SDB_PIN);
+ gpio_set_pin_output(IS31FL3741_SDB_PIN);
+ gpio_write_pin_high(IS31FL3741_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(IS31FL3742A_SDB_PIN)
- setPinOutput(IS31FL3742A_SDB_PIN);
- writePinHigh(IS31FL3742A_SDB_PIN);
+ gpio_set_pin_output(IS31FL3742A_SDB_PIN);
+ gpio_write_pin_high(IS31FL3742A_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(IS31FL3742A_SDB_PIN)
- setPinOutput(IS31FL3742A_SDB_PIN);
- writePinHigh(IS31FL3742A_SDB_PIN);
+ gpio_set_pin_output(IS31FL3742A_SDB_PIN);
+ gpio_write_pin_high(IS31FL3742A_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(IS31FL3743A_SDB_PIN)
- setPinOutput(IS31FL3743A_SDB_PIN);
- writePinHigh(IS31FL3743A_SDB_PIN);
+ gpio_set_pin_output(IS31FL3743A_SDB_PIN);
+ gpio_write_pin_high(IS31FL3743A_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(IS31FL3743A_SDB_PIN)
- setPinOutput(IS31FL3743A_SDB_PIN);
- writePinHigh(IS31FL3743A_SDB_PIN);
+ gpio_set_pin_output(IS31FL3743A_SDB_PIN);
+ gpio_write_pin_high(IS31FL3743A_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(IS31FL3745_SDB_PIN)
- setPinOutput(IS31FL3745_SDB_PIN);
- writePinHigh(IS31FL3745_SDB_PIN);
+ gpio_set_pin_output(IS31FL3745_SDB_PIN);
+ gpio_write_pin_high(IS31FL3745_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(IS31FL3745_SDB_PIN)
- setPinOutput(IS31FL3745_SDB_PIN);
- writePinHigh(IS31FL3745_SDB_PIN);
+ gpio_set_pin_output(IS31FL3745_SDB_PIN);
+ gpio_write_pin_high(IS31FL3745_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(IS31FL3746A_SDB_PIN)
- setPinOutput(IS31FL3746A_SDB_PIN);
- writePinHigh(IS31FL3746A_SDB_PIN);
+ gpio_set_pin_output(IS31FL3746A_SDB_PIN);
+ gpio_write_pin_high(IS31FL3746A_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(IS31FL3746A_SDB_PIN)
- setPinOutput(IS31FL3746A_SDB_PIN);
- writePinHigh(IS31FL3746A_SDB_PIN);
+ gpio_set_pin_output(IS31FL3746A_SDB_PIN);
+ gpio_write_pin_high(IS31FL3746A_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(SNLED27351_SDB_PIN)
- setPinOutput(SNLED27351_SDB_PIN);
- writePinHigh(SNLED27351_SDB_PIN);
+ gpio_set_pin_output(SNLED27351_SDB_PIN);
+ gpio_write_pin_high(SNLED27351_SDB_PIN);
#endif
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) {
i2c_init();
#if defined(SNLED27351_SDB_PIN)
- setPinOutput(SNLED27351_SDB_PIN);
- writePinHigh(SNLED27351_SDB_PIN);
+ gpio_set_pin_output(SNLED27351_SDB_PIN);
+ gpio_write_pin_high(SNLED27351_SDB_PIN);
#endif
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) {
return false;
}
// Command Mode
- writePinLow(OLED_DC_PIN);
+ gpio_write_pin_low(OLED_DC_PIN);
// Send the commands
if (spi_transmit(&data[1], size - 1) != SPI_STATUS_SUCCESS) {
spi_stop();
@@ -215,7 +215,7 @@ __attribute__((weak)) bool oled_send_cmd_P(const uint8_t *data, uint16_t size) {
}
spi_status_t status = SPI_STATUS_SUCCESS;
// Command Mode
- writePinLow(OLED_DC_PIN);
+ gpio_write_pin_low(OLED_DC_PIN);
// Send the commands
for (uint16_t i = 1; i < size && status >= 0; i++) {
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) {
return false;
}
// Data Mode
- writePinHigh(OLED_DC_PIN);
+ gpio_write_pin_high(OLED_DC_PIN);
// Send the commands
if (spi_transmit(data, size) != SPI_STATUS_SUCCESS) {
spi_stop();
@@ -256,17 +256,17 @@ __attribute__((weak)) bool oled_send_data(const uint8_t *data, uint16_t size) {
__attribute__((weak)) void oled_driver_init(void) {
#if defined(OLED_TRANSPORT_SPI)
spi_init();
- setPinOutput(OLED_CS_PIN);
- writePinHigh(OLED_CS_PIN);
+ gpio_set_pin_output(OLED_CS_PIN);
+ gpio_write_pin_high(OLED_CS_PIN);
- setPinOutput(OLED_DC_PIN);
- writePinLow(OLED_DC_PIN);
+ gpio_set_pin_output(OLED_DC_PIN);
+ gpio_write_pin_low(OLED_DC_PIN);
# ifdef OLED_RST_PIN
/* Reset device */
- setPinOutput(OLED_RST_PIN);
- writePinLow(OLED_RST_PIN);
+ gpio_set_pin_output(OLED_RST_PIN);
+ gpio_write_pin_low(OLED_RST_PIN);
wait_ms(20);
- writePinHigh(OLED_RST_PIN);
+ gpio_write_pin_high(OLED_RST_PIN);
wait_ms(20);
# endif
#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) {
spi_init();
// Set up CS as output high
- setPinOutput(comms_config->chip_select_pin);
- writePinHigh(comms_config->chip_select_pin);
+ gpio_set_pin_output(comms_config->chip_select_pin);
+ gpio_write_pin_high(comms_config->chip_select_pin);
return true;
}
@@ -49,7 +49,7 @@ void qp_comms_spi_stop(painter_device_t device) {
painter_driver_t * driver = (painter_driver_t *)device;
qp_comms_spi_config_t *comms_config = (qp_comms_spi_config_t *)driver->comms_config;
spi_stop();
- writePinHigh(comms_config->chip_select_pin);
+ gpio_write_pin_high(comms_config->chip_select_pin);
}
const painter_comms_vtable_t spi_comms_vtable = {
@@ -74,16 +74,16 @@ bool qp_comms_spi_dc_reset_init(painter_device_t device) {
// Set up D/C as output low, if specified
if (comms_config->dc_pin != NO_PIN) {
- setPinOutput(comms_config->dc_pin);
- writePinLow(comms_config->dc_pin);
+ gpio_set_pin_output(comms_config->dc_pin);
+ gpio_write_pin_low(comms_config->dc_pin);
}
// Set up RST as output, if specified, performing a reset in the process
if (comms_config->reset_pin != NO_PIN) {
- setPinOutput(comms_config->reset_pin);
- writePinLow(comms_config->reset_pin);
+ gpio_set_pin_output(comms_config->reset_pin);
+ gpio_write_pin_low(comms_config->reset_pin);
wait_ms(20);
- writePinHigh(comms_config->reset_pin);
+ gpio_write_pin_high(comms_config->reset_pin);
wait_ms(20);
}
@@ -93,14 +93,14 @@ bool qp_comms_spi_dc_reset_init(painter_device_t device) {
uint32_t qp_comms_spi_dc_reset_send_data(painter_device_t device, const void *data, uint32_t byte_count) {
painter_driver_t * driver = (painter_driver_t *)device;
qp_comms_spi_dc_reset_config_t *comms_config = (qp_comms_spi_dc_reset_config_t *)driver->comms_config;
- writePinHigh(comms_config->dc_pin);
+ gpio_write_pin_high(comms_config->dc_pin);
return qp_comms_spi_send_data(device, data, byte_count);
}
void qp_comms_spi_dc_reset_send_command(painter_device_t device, uint8_t cmd) {
painter_driver_t * driver = (painter_driver_t *)device;
qp_comms_spi_dc_reset_config_t *comms_config = (qp_comms_spi_dc_reset_config_t *)driver->comms_config;
- writePinLow(comms_config->dc_pin);
+ gpio_write_pin_low(comms_config->dc_pin);
spi_write(cmd);
}
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 @@
void adns5050_init(void) {
// Initialize the ADNS serial pins.
- setPinOutput(ADNS5050_SCLK_PIN);
- setPinOutput(ADNS5050_SDIO_PIN);
- setPinOutput(ADNS5050_CS_PIN);
+ gpio_set_pin_output(ADNS5050_SCLK_PIN);
+ gpio_set_pin_output(ADNS5050_SDIO_PIN);
+ gpio_set_pin_output(ADNS5050_CS_PIN);
// reboot the adns.
// if the adns hasn't initialized yet, this is harmless.
@@ -69,30 +69,30 @@ void adns5050_init(void) {
// Just as with the serial protocol, this is used by the slave to send a
// synchronization signal to the master.
void adns5050_sync(void) {
- writePinLow(ADNS5050_CS_PIN);
+ gpio_write_pin_low(ADNS5050_CS_PIN);
wait_us(1);
- writePinHigh(ADNS5050_CS_PIN);
+ gpio_write_pin_high(ADNS5050_CS_PIN);
}
void adns5050_cs_select(void) {
- writePinLow(ADNS5050_CS_PIN);
+ gpio_write_pin_low(ADNS5050_CS_PIN);
}
void adns5050_cs_deselect(void) {
- writePinHigh(ADNS5050_CS_PIN);
+ gpio_write_pin_high(ADNS5050_CS_PIN);
}
uint8_t adns5050_serial_read(void) {
- setPinInput(ADNS5050_SDIO_PIN);
+ gpio_set_pin_input(ADNS5050_SDIO_PIN);
uint8_t byte = 0;
for (uint8_t i = 0; i < 8; ++i) {
- writePinLow(ADNS5050_SCLK_PIN);
+ gpio_write_pin_low(ADNS5050_SCLK_PIN);
wait_us(1);
- byte = (byte << 1) | readPin(ADNS5050_SDIO_PIN);
+ byte = (byte << 1) | gpio_read_pin(ADNS5050_SDIO_PIN);
- writePinHigh(ADNS5050_SCLK_PIN);
+ gpio_write_pin_high(ADNS5050_SCLK_PIN);
wait_us(1);
}
@@ -100,19 +100,19 @@ uint8_t adns5050_serial_read(void) {
}
void adns5050_serial_write(uint8_t data) {
- setPinOutput(ADNS5050_SDIO_PIN);
+ gpio_set_pin_output(ADNS5050_SDIO_PIN);
for (int8_t b = 7; b >= 0; b--) {
- writePinLow(ADNS5050_SCLK_PIN);
+ gpio_write_pin_low(ADNS5050_SCLK_PIN);
if (data & (1 << b))
- writePinHigh(ADNS5050_SDIO_PIN);
+ gpio_write_pin_high(ADNS5050_SDIO_PIN);
else
- writePinLow(ADNS5050_SDIO_PIN);
+ gpio_write_pin_low(ADNS5050_SDIO_PIN);
wait_us(2);
- writePinHigh(ADNS5050_SCLK_PIN);
+ gpio_write_pin_high(ADNS5050_SCLK_PIN);
}
// 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) {
}
void adns9800_init(void) {
- setPinOutput(ADNS9800_CS_PIN);
+ gpio_set_pin_output(ADNS9800_CS_PIN);
spi_init();
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) {
report.y = axisToMouseComponent(ANALOG_JOYSTICK_Y_AXIS_PIN, yOrigin, maxCursorSpeed, 1);
}
#ifdef ANALOG_JOYSTICK_CLICK_PIN
- report.button = !readPin(ANALOG_JOYSTICK_CLICK_PIN);
+ report.button = !gpio_read_pin(ANALOG_JOYSTICK_CLICK_PIN);
#endif
return report;
}
void analog_joystick_init(void) {
- setPinInputHigh(ANALOG_JOYSTICK_X_AXIS_PIN);
- setPinInputHigh(ANALOG_JOYSTICK_Y_AXIS_PIN);
+ gpio_set_pin_input_high(ANALOG_JOYSTICK_X_AXIS_PIN);
+ gpio_set_pin_input_high(ANALOG_JOYSTICK_Y_AXIS_PIN);
#ifdef ANALOG_JOYSTICK_CLICK_PIN
- setPinInputHigh(ANALOG_JOYSTICK_CLICK_PIN);
+ gpio_set_pin_input_high(ANALOG_JOYSTICK_CLICK_PIN);
#endif
// Account for drift
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);
void paw3204_write_reg(uint8_t reg_addr, uint8_t data);
void paw3204_init(void) {
- setPinOutput(PAW3204_SCLK_PIN); // setclockpin to output
- setPinInputHigh(PAW3204_SDIO_PIN); // set datapin input high
+ gpio_set_pin_output(PAW3204_SCLK_PIN); // setclockpin to output
+ gpio_set_pin_input_high(PAW3204_SDIO_PIN); // set datapin input high
paw3204_write_reg(REG_SETUP, 0x86); // reset sensor and set 1600cpi
wait_us(5);
@@ -64,16 +64,16 @@ void paw3204_init(void) {
}
uint8_t paw3204_serial_read(void) {
- setPinInput(PAW3204_SDIO_PIN);
+ gpio_set_pin_input(PAW3204_SDIO_PIN);
uint8_t byte = 0;
for (uint8_t i = 0; i < 8; ++i) {
- writePinLow(PAW3204_SCLK_PIN);
+ gpio_write_pin_low(PAW3204_SCLK_PIN);
wait_us(1);
- byte = (byte << 1) | readPin(PAW3204_SDIO_PIN);
+ byte = (byte << 1) | gpio_read_pin(PAW3204_SDIO_PIN);
- writePinHigh(PAW3204_SCLK_PIN);
+ gpio_write_pin_high(PAW3204_SCLK_PIN);
wait_us(1);
}
@@ -81,17 +81,17 @@ uint8_t paw3204_serial_read(void) {
}
void paw3204_serial_write(uint8_t data) {
- writePinLow(PAW3204_SDIO_PIN);
- setPinOutput(PAW3204_SDIO_PIN);
+ gpio_write_pin_low(PAW3204_SDIO_PIN);
+ gpio_set_pin_output(PAW3204_SDIO_PIN);
for (int8_t b = 7; b >= 0; b--) {
- writePinLow(PAW3204_SCLK_PIN);
+ gpio_write_pin_low(PAW3204_SCLK_PIN);
if (data & (1 << b)) {
- writePinHigh(PAW3204_SDIO_PIN);
+ gpio_write_pin_high(PAW3204_SDIO_PIN);
} else {
- writePinLow(PAW3204_SDIO_PIN);
+ gpio_write_pin_low(PAW3204_SDIO_PIN);
}
- writePinHigh(PAW3204_SCLK_PIN);
+ gpio_write_pin_high(PAW3204_SCLK_PIN);
}
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 @@
void pmw3320_init(void) {
// Initialize sensor serial pins.
- setPinOutput(PMW3320_SCLK_PIN);
- setPinOutput(PMW3320_SDIO_PIN);
- setPinOutput(PMW3320_CS_PIN);
+ gpio_set_pin_output(PMW3320_SCLK_PIN);
+ gpio_set_pin_output(PMW3320_SDIO_PIN);
+ gpio_set_pin_output(PMW3320_CS_PIN);
// reboot the sensor.
pmw3320_write_reg(REG_Power_Up_Reset, 0x5a);
@@ -54,30 +54,30 @@ void pmw3320_init(void) {
// Just as with the serial protocol, this is used by the slave to send a
// synchronization signal to the master.
void pmw3320_sync(void) {
- writePinLow(PMW3320_CS_PIN);
+ gpio_write_pin_low(PMW3320_CS_PIN);
wait_us(1);
- writePinHigh(PMW3320_CS_PIN);
+ gpio_write_pin_high(PMW3320_CS_PIN);
}
void pmw3320_cs_select(void) {
- writePinLow(PMW3320_CS_PIN);
+ gpio_write_pin_low(PMW3320_CS_PIN);
}
void pmw3320_cs_deselect(void) {
- writePinHigh(PMW3320_CS_PIN);
+ gpio_write_pin_high(PMW3320_CS_PIN);
}
uint8_t pmw3320_serial_read(void) {
- setPinInput(PMW3320_SDIO_PIN);
+ gpio_set_pin_input(PMW3320_SDIO_PIN);
uint8_t byte = 0;
for (uint8_t i = 0; i < 8; ++i) {
- writePinLow(PMW3320_SCLK_PIN);
+ gpio_write_pin_low(PMW3320_SCLK_PIN);
wait_us(1);
- byte = (byte << 1) | readPin(PMW3320_SDIO_PIN);
+ byte = (byte << 1) | gpio_read_pin(PMW3320_SDIO_PIN);
- writePinHigh(PMW3320_SCLK_PIN);
+ gpio_write_pin_high(PMW3320_SCLK_PIN);
wait_us(1);
}
@@ -85,19 +85,19 @@ uint8_t pmw3320_serial_read(void) {
}
void pmw3320_serial_write(uint8_t data) {
- setPinOutput(PMW3320_SDIO_PIN);
+ gpio_set_pin_output(PMW3320_SDIO_PIN);
for (int8_t b = 7; b >= 0; b--) {
- writePinLow(PMW3320_SCLK_PIN);
+ gpio_write_pin_low(PMW3320_SCLK_PIN);
if (data & (1 << b))
- writePinHigh(PMW3320_SDIO_PIN);
+ gpio_write_pin_high(PMW3320_SDIO_PIN);
else
- writePinLow(PMW3320_SDIO_PIN);
+ gpio_write_pin_low(PMW3320_SDIO_PIN);
wait_us(2);
- writePinHigh(PMW3320_SCLK_PIN);
+ gpio_write_pin_high(PMW3320_SCLK_PIN);
}
// 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) {
void USB2422_init(void) {
#ifdef USB2422_RESET_PIN
- setPinOutput(USB2422_RESET_PIN);
+ gpio_set_pin_output(USB2422_RESET_PIN);
#endif
#ifdef USB2422_ACTIVE_PIN
- setPinInput(USB2422_ACTIVE_PIN);
+ gpio_set_pin_input(USB2422_ACTIVE_PIN);
#endif
i2c_init(); // IC2 clk must be high at USB2422 reset release time to signal SMB configuration
@@ -387,15 +387,15 @@ void USB2422_configure(void) {
void USB2422_reset(void) {
#ifdef USB2422_RESET_PIN
- writePinLow(USB2422_RESET_PIN);
+ gpio_write_pin_low(USB2422_RESET_PIN);
wait_us(2);
- writePinHigh(USB2422_RESET_PIN);
+ gpio_write_pin_high(USB2422_RESET_PIN);
#endif
}
bool USB2422_active(void) {
#ifdef USB2422_ACTIVE_PIN
- return readPin(USB2422_ACTIVE_PIN);
+ return gpio_read_pin(USB2422_ACTIVE_PIN);
#else
return 1;
#endif