summaryrefslogtreecommitdiff
path: root/include/arduino-nano/driver
diff options
context:
space:
mode:
Diffstat (limited to 'include/arduino-nano/driver')
-rw-r--r--include/arduino-nano/driver/gpio.h18
-rw-r--r--include/arduino-nano/driver/stdout.h19
-rw-r--r--include/arduino-nano/driver/uptime.h29
3 files changed, 66 insertions, 0 deletions
diff --git a/include/arduino-nano/driver/gpio.h b/include/arduino-nano/driver/gpio.h
new file mode 100644
index 0000000..177e7c5
--- /dev/null
+++ b/include/arduino-nano/driver/gpio.h
@@ -0,0 +1,18 @@
+#ifndef GPIO_H
+#define GPIO_H
+
+class GPIO {
+ private:
+ GPIO(const GPIO &copy);
+
+ public:
+ GPIO () {}
+ void setup();
+ void led_on(unsigned char id);
+ void led_off(unsigned char id);
+ void led_toggle(unsigned char id);
+};
+
+extern GPIO gpio;
+
+#endif
diff --git a/include/arduino-nano/driver/stdout.h b/include/arduino-nano/driver/stdout.h
new file mode 100644
index 0000000..d6cb2b0
--- /dev/null
+++ b/include/arduino-nano/driver/stdout.h
@@ -0,0 +1,19 @@
+#ifndef STANDARDOUTPUT_H
+#define STANDANDOUTPUT_H
+
+#include "object/outputstream.h"
+
+class StandardOutput : public OutputStream {
+ private:
+ StandardOutput(const StandardOutput &copy);
+
+ public:
+ StandardOutput () {}
+ void setup();
+
+ virtual void put(char c) override;
+};
+
+extern StandardOutput kout;
+
+#endif
diff --git a/include/arduino-nano/driver/uptime.h b/include/arduino-nano/driver/uptime.h
new file mode 100644
index 0000000..86a8bb5
--- /dev/null
+++ b/include/arduino-nano/driver/uptime.h
@@ -0,0 +1,29 @@
+#ifndef UPTIME_H
+#define UPTIME_H
+
+#include <avr/io.h>
+
+class Uptime {
+ private:
+ Uptime(const Uptime &copy);
+#ifdef TIMER_S
+ uint8_t seconds;
+#endif
+
+ public:
+#ifdef TIMER_S
+ Uptime () : seconds(0) {}
+#else
+ Uptime () {}
+#endif
+ inline uint8_t get_cycles() { return TCNT0; }
+ inline uint8_t get_us() { return TCNT2/2; }
+#ifdef TIMER_S
+ inline uint8_t get_s() { return seconds; }
+ inline void tick_s() { seconds++; }
+#endif
+};
+
+extern Uptime uptime;
+
+#endif