aboutsummaryrefslogtreecommitdiff
path: root/include/sysled.h
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-12-03 10:35:55 -0700
committerJosh Rahm <joshuarahm@gmail.com>2024-12-03 10:35:55 -0700
commitf5e15a5a2d55cf0a6fbdbe04e5c49499a6eac642 (patch)
treed9f570c228268dfa0ecc31ad15579d412b953a6f /include/sysled.h
parenta15656b399689d0c7b12963a718729bea9b6dfcc (diff)
downloadch573-f5e15a5a2d55cf0a6fbdbe04e5c49499a6eac642.tar.gz
ch573-f5e15a5a2d55cf0a6fbdbe04e5c49499a6eac642.tar.bz2
ch573-f5e15a5a2d55cf0a6fbdbe04e5c49499a6eac642.zip
Basic Christmas light implementation!
Diffstat (limited to 'include/sysled.h')
-rw-r--r--include/sysled.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/sysled.h b/include/sysled.h
new file mode 100644
index 0000000..b9556f1
--- /dev/null
+++ b/include/sysled.h
@@ -0,0 +1,19 @@
+#pragma once
+
+/* Easily turn on and off the system-led. */
+
+#include "ch573/gpio.h"
+
+static inline void enable_sysled()
+{
+ CH573_GPIO__GPIO_PORT_T_INTF.dir.set(ch573_gpio__gpio_port_a, DIR_OUT, 8);
+ CH573_GPIO__GPIO_PORT_T_INTF.pd_drv.set(ch573_gpio__gpio_port_a, 0, 8);
+}
+
+// If "on" then turn on the sysled (which counter-intuitively means turning off
+// the GPIO).
+static inline void set_sysled(int on)
+{
+// CH573_GPIO__GPIO_PORT_T_INTF.out.set(
+// ch573_gpio__gpio_port_a, on ? OFF : ON, 8);
+}