summaryrefslogtreecommitdiff
path: root/drivers/bluetooth
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/bluetooth
parent6810aaf0130113e267e20fb506d874cc858f5f67 (diff)
Update GPIO macro usages in core (#23093)
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/bluefruit_le.cpp18
1 files changed, 9 insertions, 9 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);