summaryrefslogtreecommitdiff
path: root/platformio/relayctl/src/relay.h
diff options
context:
space:
mode:
Diffstat (limited to 'platformio/relayctl/src/relay.h')
-rw-r--r--platformio/relayctl/src/relay.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/platformio/relayctl/src/relay.h b/platformio/relayctl/src/relay.h
new file mode 100644
index 0000000..a3519ac
--- /dev/null
+++ b/platformio/relayctl/src/relay.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#include <Arduino.h>
+#include "config.def.h"
+
+namespace homekit::relay {
+
+inline void init() {
+ pinMode(RELAY_PIN, OUTPUT);
+}
+
+inline bool getState() {
+ return digitalRead(RELAY_PIN) == 1;
+}
+
+inline void setOn() {
+ digitalWrite(RELAY_PIN, HIGH);
+}
+
+inline void setOff() {
+ digitalWrite(RELAY_PIN, LOW);
+}
+
+} \ No newline at end of file