diff --git a/firmware/src/main.rs b/firmware/src/main.rs index ae3d171..beebf85 100644 --- a/firmware/src/main.rs +++ b/firmware/src/main.rs @@ -127,8 +127,8 @@ fn main() -> ! { writeln!(stdout, "tecpak boot").unwrap(); board::init(); writeln!(stdout, "board initialized").unwrap(); - let mut tec0 = Tec::tec0(); - let mut tec1 = Tec::tec1(); + let mut tec0 = Tec::tec0().setup(PWM_PID_WIDTH); + let mut tec1 = Tec::tec1().setup(PWM_PID_WIDTH); println!(r#" _ _ diff --git a/firmware/src/tec.rs b/firmware/src/tec.rs index 95219e7..85813c7 100644 --- a/firmware/src/tec.rs +++ b/firmware/src/tec.rs @@ -60,6 +60,13 @@ impl Tec { impl Tec { + pub fn setup(mut self, max: u16) -> Self { + self.max_i_pos.set(max, max); + self.max_i_neg.set(max, max); + self.max_v.set(max, max); + self + } + pub fn get(&mut self, pin: TecPin) -> (u16, u16) { match pin { TecPin::MaxIPos =>