#![no_std]
#![no_main]
use esp_backtrace as _;
use esp_println::println;
use hal::{
clock::ClockControl,
peripherals::Peripherals,
prelude::*,
timer::TimerGroup,
Rtc, IO,
rmt::*,
};
#[entry]
fn main() -> ! {
let peripherals = Peripherals::take();
let mut system = peripherals.SYSTEM.split();
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
// Disable the RTC and TIMG watchdog timers
let mut rtc = Rtc::new(peripherals.RTC_CNTL);
let timer_group0 = TimerGroup::new(
peripherals.TIMG0,
&clocks,
);
let mut wdt0 = timer_group0.wdt;
let timer_group1 = TimerGroup::new(
peripherals.TIMG1,
&clocks,
);
let mut wdt1 = timer_group1.wdt;
rtc.swd.disable();
rtc.rwdt.disable();
wdt0.disable();
wdt1.disable();
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
println!("Hello world!");
let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &clocks).unwrap();
let mut channel = rmt
.channel0
.configure(
io.pins.gpio0.into_push_pull_output(),
TxChannelConfig {
clk_divider: 1,
idle_output_level: false,
idle_output: false,
carrier_modulation: false,
carrier_high: 1,
carrier_low: 1,
carrier_level: false,
},
)
.unwrap();
let data_H = [
PulseCode {
level1: true,
length1: 64,
level2: false,
length2: 32,
},
];
loop {
let transaction = channel.transmit(&data);
channel = transaction.wait().unwrap();
}
}
Loading
esp32-c3-devkitm-1
esp32-c3-devkitm-1