Skip to content

Commit 797f39c

Browse files
committed
feat: begin waits for MPU until timeout
1 parent 84410c0 commit 797f39c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/bridge.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,16 @@ class BridgeClass {
142142
}
143143

144144
// Initialize the bridge
145-
bool begin(unsigned long baud=DEFAULT_SERIAL_BAUD) {
145+
bool begin(unsigned long baud=DEFAULT_SERIAL_BAUD, const uint32_t timeout=0) {
146146

147147
init();
148148

149149
if (is_started()) return true;
150150

151+
uint8_t start = k_uptime_get_32();
152+
151153
while (!ready()) {
154+
if (timeout>0 && (k_uptime_get_32()-start)>timeout) break;
152155
k_sleep(K_MSEC(10));
153156
}
154157

0 commit comments

Comments
 (0)