summaryrefslogtreecommitdiff
path: root/platformio/relayctl/src/relay.h
blob: ba7f5a64e008258de48191eec25f93320c762784 (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 { namespace relay {

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

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

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

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

} }