tec: setup iset_width

This commit is contained in:
Astro 2019-11-13 20:12:25 +01:00
parent ecdebe76bc
commit 02d2403547
2 changed files with 4 additions and 3 deletions

View File

@ -128,8 +128,8 @@ fn main() -> ! {
writeln!(stdout, "tecpak boot").unwrap();
board::init();
writeln!(stdout, "board initialized").unwrap();
let mut tec0 = Tec::tec0().setup(PWM_PID_WIDTH);
let mut tec1 = Tec::tec1().setup(PWM_PID_WIDTH);
let mut tec0 = Tec::tec0().setup(PWM_PID_WIDTH / 2, PWM_PID_WIDTH);
let mut tec1 = Tec::tec1().setup(PWM_PID_WIDTH / 2, PWM_PID_WIDTH);
println!(r#"
_ _

View File

@ -76,10 +76,11 @@ impl Tec<pwm::T4CCP0, pwm::T4CCP1, pwm::T5CCP0, pwm::T5CCP1, GpioOutput<PP5>> {
impl<MaxIPos: PwmChannel, MaxINeg: PwmChannel, ISet: PwmChannel, MaxV: PwmChannel, SHDN: OutputPin> Tec<MaxIPos, MaxINeg, ISet, MaxV, SHDN> {
pub fn setup(mut self, max: u16) -> Self {
pub fn setup(mut self, iset_width: u16, max: u16) -> Self {
self.max_i_pos.set(max, max);
self.max_i_neg.set(max, max);
self.max_v.set(max, max);
self.i_set.set(iset_width, max);
self
}