19 lines
344 B
C++
19 lines
344 B
C++
#include "relais.h"
|
|
|
|
Relais::Relais(uint gpio) : gpio{gpio} {
|
|
gpio_init(gpio);
|
|
gpio_set_dir(gpio, GPIO_OUT);
|
|
off();
|
|
}
|
|
|
|
void Relais::activate(bool active) {
|
|
if (active) {
|
|
gpio_pull_down(gpio);
|
|
} else {
|
|
gpio_pull_up(gpio);
|
|
}
|
|
}
|
|
|
|
void Relais::on() { activate(true); }
|
|
|
|
void Relais::off() { activate(false); } |