Skip to content

Commit cb84623

Browse files
committed
feat: check pin G13 for host boot complete
1 parent 99b074e commit cb84623

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/bridge.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#ifndef ROUTER_BRIDGE_H
1515
#define ROUTER_BRIDGE_H
1616

17+
#define CTRL_GPIOG_13_ID 0
18+
1719
#define RESET_METHOD "$/reset"
1820
#define BIND_METHOD "$/register"
1921
//#define BRIDGE_ERROR "$/bridgeLog"
@@ -24,6 +26,8 @@
2426
#define DEFAULT_SERIAL_BAUD 115200
2527

2628
#include <zephyr/kernel.h>
29+
#include <zephyr/devicetree.h>
30+
#include <zephyr/drivers/gpio.h>
2731
#include <Arduino_RPClite.h>
2832

2933

@@ -139,6 +143,14 @@ class BridgeClass {
139143

140144
if (is_started()) return true;
141145

146+
const struct gpio_dt_spec mpu_boot_pin = GPIO_DT_SPEC_GET_BY_IDX(DT_PATH(zephyr_user), control_gpios, CTRL_GPIOG_13_ID);
147+
148+
gpio_pin_configure_dt(&mpu_boot_pin, GPIO_INPUT | GPIO_PULL_DOWN);
149+
k_sleep(K_MSEC(200));
150+
while (gpio_pin_get_dt(&mpu_boot_pin) == 0) {
151+
k_sleep(K_MSEC(10));
152+
}
153+
142154
serial_ptr->begin(baud);
143155
transport = new SerialTransport(*serial_ptr);
144156

0 commit comments

Comments
 (0)