summaryrefslogtreecommitdiff
path: root/platformio/relayctl/src/relay.h
blob: 5287f0979f8ab2bd581c3d1c93311d4bf3cc431d (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
25
26
#ifndef HOMEKIT_RELAYCTL_RELAY_H
#define HOMEKIT_RELAYCTL_RELAY_H

#include <Arduino.h>

namespace homekit::relay {

inline void init() {
    pinMode(CONFIG_RELAY_GPIO, OUTPUT);
}

inline bool getState() {
    return digitalRead(CONFIG_RELAY_GPIO) == HIGH;
}

inline void setOn() {
    digitalWrite(CONFIG_RELAY_GPIO, HIGH);
}

inline void setOff() {
    digitalWrite(CONFIG_RELAY_GPIO, LOW);
}

}

#endif //HOMEKIT_RELAYCTL_RELAY_H