gbmanager/src/relais.cpp

19 lines
340 B
C++
Raw Normal View History

2022-05-31 13:53:19 +02:00
#include "relais.h"
Relais::Relais(uint gpio) : gpio{gpio} {
gpio_set_dir(gpio, true);
gpio_init(gpio);
off();
}
void Relais::activate(bool active) {
if (active) {
gpio_pull_down(gpio);
} else {
gpio_pull_up(gpio);
}
}
2022-05-31 14:28:15 +02:00
void Relais::on() { activate(true); }
2022-05-31 13:53:19 +02:00
2022-05-31 14:28:15 +02:00
void Relais::off() { activate(false); }