aboutsummaryrefslogtreecommitdiff
path: root/sys/gpio.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/gpio.h')
-rw-r--r--sys/gpio.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/sys/gpio.h b/sys/gpio.h
new file mode 100644
index 0000000..dd9ee3c
--- /dev/null
+++ b/sys/gpio.h
@@ -0,0 +1,21 @@
+#ifndef GPIO_H
+#define GPIO_H
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#define INPUT 0
+#define OUTPUT 1
+
+typedef struct {
+ volatile uint8_t * const ddr;
+ volatile uint8_t * const port;
+ volatile uint8_t * const pin;
+ uint8_t num;
+} pinspec;
+
+void pin_mode(pinspec spec, bool out);
+void pin_write(pinspec spec, bool value);
+bool pin_read(pinspec spec);
+
+#endif