Initial rough-in of motor controller
This commit is contained in:
29
gem-remotes-esp32/src/motor_driver.rs
Normal file
29
gem-remotes-esp32/src/motor_driver.rs
Normal file
@ -0,0 +1,29 @@
|
||||
/// Handles the actual hardware interface with motor or its controller.
|
||||
|
||||
use log::*; //{trace, debug, info, warn, error}
|
||||
use anyhow::Result;
|
||||
|
||||
pub trait MotorDriver: Send + Sync {
|
||||
fn start_up(&mut self) -> Result<()>;
|
||||
fn start_down(&mut self) -> Result<()>;
|
||||
fn stop(&mut self) -> Result<()>;
|
||||
}
|
||||
|
||||
pub struct MotorDriverDebug {}
|
||||
|
||||
impl MotorDriver for MotorDriverDebug {
|
||||
fn start_up(&mut self) -> Result<()> {
|
||||
warn!("Starting motor, direction: Up");
|
||||
Ok(())
|
||||
}
|
||||
fn start_down(&mut self) -> Result<()> {
|
||||
warn!("Starting motor, direction: Down");
|
||||
Ok(())
|
||||
}
|
||||
fn stop(&mut self) ->Result<()> {
|
||||
warn!("Stopping motor");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
//unsafe impl Send for MotorDriverDebug {}
|
||||
Reference in New Issue
Block a user