Skip to content

Commit 84410c0

Browse files
committed
fix: ready checks non-initialized pin
1 parent 1ccd336 commit 84410c0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/bridge.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ class BridgeClass {
137137
}
138138

139139
bool ready() {
140+
init();
140141
return gpio_pin_get_dt(&mpu_boot_pin) == 1;
141142
}
142143

@@ -242,6 +243,11 @@ class BridgeClass {
242243

243244
void init() {
244245

246+
static bool initialized = false;
247+
248+
if (initialized) return;
249+
initialized = true;
250+
245251
k_mutex_init(&read_mutex);
246252
k_mutex_init(&write_mutex);
247253
k_mutex_init(&bridge_mutex);

0 commit comments

Comments
 (0)