dshot debugging
This commit is contained in:
parent
3e5a905544
commit
9948a76602
3 changed files with 26 additions and 16 deletions
|
|
@ -57,6 +57,9 @@ const DEFAULT_SPIN_TIME: u32 = 10;
|
|||
// For more information see: <https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/app_image_format.html#application-description>
|
||||
esp_bootloader_esp_idf::esp_app_desc!();
|
||||
use crate::peripherals::Command;
|
||||
use esp_hal::gpio::Output;
|
||||
use esp_hal::gpio::Level;
|
||||
use esp_hal::gpio::OutputConfig;
|
||||
|
||||
#[main]
|
||||
fn main() -> ! {
|
||||
|
|
@ -88,14 +91,19 @@ fn main() -> ! {
|
|||
let rmt = Rmt::new(peripherals.RMT, freq).expect("CAN NOT SET FREQUENCY");
|
||||
let rx_config = RxChannelConfig::default().with_clk_divider(1);
|
||||
let tx_config = TxChannelConfig::default().with_clk_divider(1);
|
||||
|
||||
let mut tx_channel = unsafe{rmt.channel0.configure_tx(peripherals.GPIO11,tx_config ).unwrap()};
|
||||
let mut rx_channel = rmt.channel3.configure_rx(peripherals.GPIO12,rx_config).unwrap();
|
||||
let mut toggle_pin = Output::new(peripherals.GPIO2, Level::Low, OutputConfig::default());
|
||||
let mut tx_channel = rmt.channel0.configure_tx(peripherals.GPIO23,tx_config ).expect("creation of TX_CHANNEL FAILED!");
|
||||
let mut rx_channel = rmt.channel3.configure_rx(peripherals.GPIO14,rx_config).unwrap();
|
||||
let mut dshot_esc = dshot::DShot::new(&mut rx_channel, &mut tx_channel, DShotSpeed::DShot600, Some(80_000_000), Some(1));
|
||||
rprintln!("SENDING RMT");
|
||||
dshot_esc.arm(&mut delay);
|
||||
dshot_esc.write_throttle(20, false);
|
||||
rprintln!("RMT SENT!");
|
||||
loop{
|
||||
delay.delay_millis(1000);
|
||||
toggle_pin.set_high();
|
||||
dshot_esc.write_throttle(2047,true);
|
||||
toggle_pin.set_low();
|
||||
|
||||
}
|
||||
// rprintln!("RMT SENT!");
|
||||
// let mut esc = AfroEsc::new(&mut pwm_pin);;
|
||||
// esc.set_timestamp(1000);
|
||||
// delay.delay_millis(3000);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue