summaryrefslogtreecommitdiff
path: root/include/arch/esp8266/driver/gpio.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/arch/esp8266/driver/gpio.h')
-rw-r--r--include/arch/esp8266/driver/gpio.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/arch/esp8266/driver/gpio.h b/include/arch/esp8266/driver/gpio.h
new file mode 100644
index 0000000..3db5d9d
--- /dev/null
+++ b/include/arch/esp8266/driver/gpio.h
@@ -0,0 +1,30 @@
+#ifndef GPIO_H
+#define GPIO_H
+
+class GPIO {
+ private:
+ GPIO(const GPIO &copy);
+
+ public:
+ GPIO () {}
+
+ enum Pin : unsigned char {
+ d3 = 0, tx, d4, rx, d2, d1,
+ d6 = 12, d7, d5, d8,
+ d0 = 16
+ };
+
+ void setup();
+ void led_on(unsigned char id);
+ void led_off(unsigned char id);
+ void led_toggle(unsigned char id);
+ void input(unsigned char const pin);
+ void input(unsigned char const pin, bool pullup);
+ void output(unsigned char const pin);
+ unsigned char read(unsigned char const pin);
+ void write(unsigned char const pin, unsigned char value);
+};
+
+extern GPIO gpio;
+
+#endif