aboutsummaryrefslogtreecommitdiff
path: root/include/btsel.h
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-12-07 13:58:46 -0700
committerJosh Rahm <joshuarahm@gmail.com>2024-12-07 13:58:46 -0700
commit546a5ccdba66dd8d8c19ce6d8486f46c84637cf2 (patch)
tree95b52da91414c1bfbad745c6b55617011012813e /include/btsel.h
parent9182b65ae2045c5087257751d30409deecf9520a (diff)
downloadch573-546a5ccdba66dd8d8c19ce6d8486f46c84637cf2.tar.gz
ch573-546a5ccdba66dd8d8c19ce6d8486f46c84637cf2.tar.bz2
ch573-546a5ccdba66dd8d8c19ce6d8486f46c84637cf2.zip
Add way to toggle the default pattern and a way to switch the pattern.
Diffstat (limited to 'include/btsel.h')
-rw-r--r--include/btsel.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/btsel.h b/include/btsel.h
new file mode 100644
index 0000000..9d2c676
--- /dev/null
+++ b/include/btsel.h
@@ -0,0 +1,19 @@
+#pragma once
+
+// Header file for detecting bootsel button presses.
+
+#define PASTER(x, y) x##y
+#define CONCAT(x, y) PASTER(x, y)
+
+typedef void (*bootsel_cb_t)(void);
+#define On_BootSelPress() \
+ static void __local_on_bootsel__(void); \
+ __attribute__(( \
+ __section__(".bootsel_callbacks"))) static volatile bootsel_cb_t \
+ __bootsel__position = __local_on_bootsel__; \
+ static void __local_on_bootsel__()
+
+#undef PASTER
+#undef CONCAT
+
+void enable_bootsel_button(void);