23 lines
348 B
C++
23 lines
348 B
C++
#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);
|
|
}
|
|
}
|
|
|
|
void Relais::on() {
|
|
activate(true);
|
|
}
|
|
|
|
void Relais::off() {
|
|
activate(false);
|
|
} |