summaryrefslogtreecommitdiffstats
path: root/led.hpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--led.hpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/led.hpp b/led.hpp
new file mode 100644
index 0000000..30b7a7a
--- /dev/null
+++ b/led.hpp
@@ -0,0 +1,44 @@
+/*
+ * File: led.hpp
+ * Author: naopross
+ *
+ * Created on May 5, 2018, 2:33 PM
+ */
+
+#ifndef LED_HPP
+#define LED_HPP
+
+#include "hal/pin.hpp"
+
+#include <string>
+
+class led {
+public:
+ enum class color
+ {
+ RED, GREEN, YELLOW,
+ };
+
+ led(gpio *pin, color color);
+ virtual ~led();
+
+ void pin(gpio *pin);
+ gpio * pin() const ;
+
+ void get_color(color color);
+ color set_color() const;
+
+ void set(unsigned s);
+ unsigned read() const;
+ void toggle();
+
+ std::string to_string();
+
+private:
+ led() {}
+
+ gpio *_pin = nullptr;
+ color _color;
+};
+
+#endif /* LED_HPP */