//! Blinks an LED
//!
//! This assumes that a LED is connected to the pin assigned to `led`. (GPIO4)
#![no_std]
#![no_main]
use esp_backtrace as _;
use esp_hal::{
rmt::{PulseCode, Rmt, TxChannelConfig, TxChannel, TxChannelCreator}
delay::Delay,
gpio::{Level, Output, OutputConfig},
main,
};
// This creates a default app-descriptor required by the esp-idf bootloader.
// 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!();
#[main]
fn main() -> ! {
let peripherals = esp_hal::init(esp_hal::Config::default());
let rmt_driver = Rmt::new(peripherals.RMT, Rate::from_hz(80)).unwrap();
let tx_config = TxChannelConfig::default();
let delay = Delay::new();
let mut count = 0;
let mut channel = rmt_driver
.channel0
.configure(peripherals.GPIO12, tx_config)
.unwrap();
let mut white = [PulseCode::new(Level::High, 700, Level::Low, 600); 24];
loop {
while count < 4 {
let transaction = channel.transmit(&white).unwrap();
channel = transaction.wait().unwrap();
count += 1;
}
delay.delay_millis(500);
}
}