tec: add pwm default setup
This commit is contained in:
parent
4ac0f7b171
commit
c8d31c7b0d
@ -127,8 +127,8 @@ fn main() -> ! {
|
|||||||
writeln!(stdout, "tecpak boot").unwrap();
|
writeln!(stdout, "tecpak boot").unwrap();
|
||||||
board::init();
|
board::init();
|
||||||
writeln!(stdout, "board initialized").unwrap();
|
writeln!(stdout, "board initialized").unwrap();
|
||||||
let mut tec0 = Tec::tec0();
|
let mut tec0 = Tec::tec0().setup(PWM_PID_WIDTH);
|
||||||
let mut tec1 = Tec::tec1();
|
let mut tec1 = Tec::tec1().setup(PWM_PID_WIDTH);
|
||||||
|
|
||||||
println!(r#"
|
println!(r#"
|
||||||
_ _
|
_ _
|
||||||
|
@ -60,6 +60,13 @@ impl Tec<pwm::T4CCP0, pwm::T4CCP1, pwm::T5CCP0, pwm::T5CCP1> {
|
|||||||
|
|
||||||
|
|
||||||
impl<MaxIPos: PwmChannel, MaxINeg: PwmChannel, ISet: PwmChannel, MaxV: PwmChannel> Tec<MaxIPos, MaxINeg, ISet, MaxV> {
|
impl<MaxIPos: PwmChannel, MaxINeg: PwmChannel, ISet: PwmChannel, MaxV: PwmChannel> Tec<MaxIPos, MaxINeg, ISet, MaxV> {
|
||||||
|
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) {
|
pub fn get(&mut self, pin: TecPin) -> (u16, u16) {
|
||||||
match pin {
|
match pin {
|
||||||
TecPin::MaxIPos =>
|
TecPin::MaxIPos =>
|
||||||
|
Loading…
Reference in New Issue
Block a user