Add drivers for gpio and piface

This commit is contained in:
Tobias Reisinger 2024-04-28 01:13:22 +02:00
parent 61a3c6093b
commit 4ed1cd3182
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
14 changed files with 259 additions and 17 deletions
emgauwa-lib/src/drivers

View file

@ -0,0 +1,17 @@
mod gpio;
mod piface;
pub use gpio::GpioDriver;
pub use piface::PifaceDriver;
use crate::errors::EmgauwaError;
pub trait RelayDriver {
fn get_high(&self, value: bool) -> bool {
value ^ self.get_inverted()
}
fn set(&mut self, value: bool) -> Result<(), EmgauwaError>;
fn get_pin(&self) -> u8;
fn get_inverted(&self) -> bool;
}