-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelay.cpp
More file actions
34 lines (26 loc) · 1.12 KB
/
relay.cpp
File metadata and controls
34 lines (26 loc) · 1.12 KB
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
27
28
29
30
31
32
33
34
/*******************************************************************************************************
File: relay.cpp
Author: Aiko Pras
History: 2022/06/14 AP Version 1.0
Purpose: Implements the safety decoder specific relay
******************************************************************************************************/
// There is one relay that controls the signal between the LZV 100 and boosters.
// The relay gets activated at startup. As a result, the signal between LZV 100 and boosters can flow
// as if there was no safety decoder. In case of a watchdog time-out or emergency button push
// (in the local state) the relay will be switched off and the signal between LZV 100 and Boosters
// will be interrupted. As a result, power on the tracks will be removed.
#include <Arduino.h>
#include "relay.h"
#include "hardware.h"
// The relay object is instantiated here
Relay relay;
void Relay::init() {
pinMode(WATCHDOG_RELAY, OUTPUT);
digitalWrite(WATCHDOG_RELAY, LOW);
}
void Relay::turn_on() {
digitalWrite(WATCHDOG_RELAY, HIGH);
}
void Relay::turn_off() {
digitalWrite(WATCHDOG_RELAY, LOW);
}