summaryrefslogtreecommitdiff
path: root/platformio/relayctl/src/relay.h
blob: a3519ac891ea65e2b60dc898a1810f1559c2a484 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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);
}

}