gbmanager/src/relais.cpp
Martin Brodbeck a81c7bac77 implement relais and lcd as modules
Does NOT compile!
Problem might be on the side of the ARM compiler.
2022-06-03 10:03:48 +02:00

24 lines
400 B
C++

module;
#include "hardware/gpio.h"
#include "pico/stdlib.h"
export module relais;
export class Relais {
public:
Relais(uint gpio) : gpio{gpio} {
gpio_init(gpio);
gpio_set_dir(gpio, GPIO_OUT);
off();
}
void activate(bool active) { gpio_put(gpio, !active); }
void on() { activate(true); }
void off() { activate(false); }
private:
uint gpio;
};