24 lines
400 B
C++
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;
|
|
}; |