forking out the whole dc motor logic to a seperate module
This commit is contained in:
parent
6f2ab7cb95
commit
7a8ecc5277
2 changed files with 10 additions and 9 deletions
|
|
@ -15,6 +15,8 @@ use esp_hal::main;
|
||||||
use esp_hal::time::{Duration, Instant};
|
use esp_hal::time::{Duration, Instant};
|
||||||
use esp_hal::delay::Delay;
|
use esp_hal::delay::Delay;
|
||||||
use rtt_target::rprintln;
|
use rtt_target::rprintln;
|
||||||
|
mod dc_driver;
|
||||||
|
use dc_driver::afroesc::AfroEsc;
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
fn panic(_: &core::panic::PanicInfo) -> ! {
|
fn panic(_: &core::panic::PanicInfo) -> ! {
|
||||||
loop {}
|
loop {}
|
||||||
|
|
@ -48,14 +50,13 @@ fn main() -> ! {
|
||||||
.timer_clock_with_frequency(19_999, PwmWorkingMode::Increase, Rate::from_hz(50))
|
.timer_clock_with_frequency(19_999, PwmWorkingMode::Increase, Rate::from_hz(50))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
mcpwm.timer0.start(timer_clock_cfg);
|
mcpwm.timer0.start(timer_clock_cfg);
|
||||||
|
let mut esc = AfroEsc::new(&mut pwm_pin);
|
||||||
pwm_pin.set_timestamp(1000);
|
esc.set_timestamp(1000);
|
||||||
delay.delay_millis(3000);
|
delay.delay_millis(3000);
|
||||||
rprintln!("WUT?");
|
esc.set_timestamp(1121);
|
||||||
pwm_pin.set_timestamp(1121);
|
delay.delay_millis(3000);
|
||||||
delay.delay_millis(1000);
|
//1421 is I think the best, makes calculating the throttle easier
|
||||||
|
esc.set_timestamp(1055);
|
||||||
pwm_pin.set_timestamp(1055);
|
|
||||||
delay.delay_millis(3000);
|
delay.delay_millis(3000);
|
||||||
|
|
||||||
// Example: Ramp from 0% to 50% throttle
|
// Example: Ramp from 0% to 50% throttle
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue