gbmanager/src/relais.cpp

13 lines
274 B
C++
Raw Normal View History

2022-05-31 13:53:19 +02:00
#include "relais.h"
Relais::Relais(uint gpio) : gpio{gpio} {
gpio_init(gpio);
2022-05-31 15:59:22 +02:00
gpio_set_dir(gpio, GPIO_OUT);
2022-05-31 13:53:19 +02:00
off();
}
2022-06-01 21:14:22 +02:00
void Relais::activate(bool active) { gpio_put(gpio, !active); }
2022-05-31 13:53:19 +02:00
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); }