Squashed 'third_party/pico-sdk/' content from commit 2062372d2

Change-Id: Ic20f199d3ed0ea8d3a6a1bbf513f875ec7500cc6
git-subtree-dir: third_party/pico-sdk
git-subtree-split: 2062372d203b372849d573f252cf7c6dc2800c0a
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/src/common/pico_time/timeout_helper.c b/src/common/pico_time/timeout_helper.c
new file mode 100644
index 0000000..d9abe5a
--- /dev/null
+++ b/src/common/pico_time/timeout_helper.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include "pico/timeout_helper.h"
+
+static bool check_single_timeout_us(timeout_state_t *ts) {
+    return time_reached(ts->next_timeout);
+}
+
+check_timeout_fn init_single_timeout_until(timeout_state_t *ts, absolute_time_t target) {
+    ts->next_timeout = target;
+    return check_single_timeout_us;
+}
+
+static bool check_per_iteration_timeout_us(timeout_state_t *ts) {
+    if (time_reached(ts->next_timeout)) {
+        return true;
+    }
+    ts->next_timeout = make_timeout_time_us(ts->param);
+    return false;
+}
+
+check_timeout_fn init_per_iteration_timeout_us(timeout_state_t *ts, uint64_t per_iteration_timeout_us) {
+    ts->next_timeout = make_timeout_time_us(per_iteration_timeout_us);
+    ts->param = per_iteration_timeout_us;
+    return check_per_iteration_timeout_us;
+}