### Usage Example Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/macro.dma_circular_buffers_chunk_size.html Example showing how to initialize RX and TX buffers with a specific chunk size. ```rust use esp_hal::dma_circular_buffers_chunk_size; // RX and TX buffers are 32000 bytes - passing only one parameter makes RX // and TX the same size. let (rx_buffer, rx_descriptors, tx_buffer, tx_descriptors) = dma_circular_buffers_chunk_size!(32000, 32000, 4032); ``` -------------------------------- ### start Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/twai/struct.TwaiConfiguration.html?search= Transitions the peripheral into Operation Mode. ```APIDOC ## pub fn start(self) -> Twai<'d, Dm> ### Description Put the peripheral into Operation Mode, allowing the transmission and reception of packets using the new object. ``` -------------------------------- ### Starting the APP core with CpuControl Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/system/struct.CpuControl.html Demonstrates initializing CpuControl and starting a task on the secondary core using a stack and a closure. ```rust static mut APP_CORE_STACK: Stack<8192> = Stack::new(); let counter = Mutex::new(RefCell::new(0)); let mut cpu_control = CpuControl::new(peripherals.CPU_CTRL); let cpu1_fnctn = || { cpu1_task(&delay, &counter); }; let _guard = cpu_control.start_app_core(unsafe { &mut *addr_of_mut!(APP_CORE_STACK) }, cpu1_fnctn)?; loop { delay.delay(Duration::from_secs(1)); let count = critical_section::with(|cs| *counter.borrow_ref(cs)); } // Where `cpu1_task()` may be defined as: fn cpu1_task(delay: &Delay, counter: &critical_section::Mutex>) -> ! { loop { delay.delay(Duration::from_millis(500)); critical_section::with(|cs| { let mut val = counter.borrow_ref_mut(cs); *val = val.wrapping_add(1); }); } } ``` -------------------------------- ### Start Core 1 Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/soc/esp32/cpu_control.rs.html Configures and starts the secondary core (AppCpu) by setting the boot address and clearing reset bits. ```rust pub(crate) fn start_core1(entry_point: *const u32) { let dport_control = DPORT::regs(); flush_cache(Cpu::AppCpu); enable_cache(Cpu::AppCpu); dport_control .appcpu_ctrl_d() .write(|w| unsafe { w.appcpu_boot_addr().bits(entry_point as u32) }); dport_control .appcpu_ctrl_b() .modify(|_, w| w.appcpu_clkgate_en().set_bit()); dport_control .appcpu_ctrl_c() .modify(|_, w| w.appcpu_runstall().clear_bit()); dport_control .appcpu_ctrl_a() .modify(|_, w| w.appcpu_resetting().set_bit()); dport_control .appcpu_ctrl_a() .modify(|_, w| w.appcpu_resetting().clear_bit()); } ``` -------------------------------- ### Starting the Application Core Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/system/multi_core.rs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Methods to initialize and start the second core with a provided stack and closure. Dropping the returned AppCoreGuard will park the core. ```rust /// Start the APP (second) core. /// /// The second core will start running the closure `entry`. Note that if the /// closure exits, the core will be parked. /// /// Dropping the returned guard will park the core. #[instability::unstable] pub fn start_app_core<'a, const SIZE: usize, F>( &mut self, stack: &'static mut Stack, entry: F, ) -> Result, Error> where F: FnOnce(), F: Send + 'a, { cfg_if::cfg_if! { if #[cfg(all(stack_guard_monitoring))] { let stack_guard_offset = Some(esp_config::esp_config_int!( usize, "ESP_HAL_CONFIG_STACK_GUARD_OFFSET" )); } else { let stack_guard_offset = None; } }; self.start_app_core_with_stack_guard_offset(stack, stack_guard_offset, entry) } /// Start the APP (second) core. /// /// The second core will start running the closure `entry`. Note that if the /// closure exits, the core will be parked. /// /// Dropping the returned guard will park the core. #[instability::unstable] pub fn start_app_core_with_stack_guard_offset<'a, const SIZE: usize, F>( &mut self, stack: &'static mut Stack, stack_guard_offset: Option, entry: F, ) -> Result, Error> where F: FnOnce(), F: Send + 'a, { if !crate::debugger::debugger_connected() && is_running(Cpu::AppCpu) { return Err(Error::CoreAlreadyRunning); } setup_second_core_stack(stack, stack_guard_offset, entry); crate::soc::cpu_control::start_core1(start_core1_init:: as *const u32); self.unpark_core(Cpu::AppCpu); Ok(AppCoreGuard { phantom: PhantomData, }) } ``` -------------------------------- ### Modular Multiplication Example Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/rsa/mod.rs.html?search= Demonstrates the setup and execution of a modular multiplication operation using the RSA peripheral. ```rust /// let mut handle = rsa.modular_multiply::( /// X.as_words(), /// Y.as_words(), /// M.as_words(), /// r.as_words(), /// mprime, /// &mut outbuf, /// ); /// handle.wait_blocking(); ``` -------------------------------- ### Start RSA Backend Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/rsa/mod.rs.html Starts the RSA backend to begin processing operations. ```rust use esp_hal::rsa::RsaBackend; # let mut rsa = RsaBackend::new(peripherals.RSA); // Start the backend, which allows processing RSA operations. let _backend = rsa.start(); ``` -------------------------------- ### SPI Master Driver Example Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/spi/master/mod.rs.html Basic usage example for the SPI master driver. ```rust /// SPI peripheral driver /// /// ## Example /// /// ```rust, no_run /// # {before_snippet} /// use esp_hal::spi::{ /// Mode, /// master::{Config, Spi}, /// }; ``` -------------------------------- ### Start RsaBackend driver Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/rsa/struct.RsaBackend.html?search= Demonstrates starting the backend to enable RSA operation processing. The driver remains active as long as the returned object is in scope. ```rust use esp_hal::rsa::RsaBackend; let mut rsa = RsaBackend::new(peripherals.RSA); // Start the backend, which allows processing RSA operations. let _backend = rsa.start(); ``` -------------------------------- ### Using assign_resources Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/macro.assign_resources.html Example demonstrating how to define resource groups and initialize them from peripherals. ```rust use esp_hal::assign_resources; assign_resources! { Resources<'d> { display: DisplayResources<'d> { spi: SPI2, sda: GPIO5, sclk: GPIO4, cs: GPIO3, dc: GPIO2, }, axl: AccelerometerResources<'d> { i2c: I2C0, sda: GPIO0, scl: GPIO1, }, } } fn init_display<'d>(r: DisplayResources<'d>) -> Display<'d> { // use `r.spi`, `r.sda`, `r.sclk`, `r.cs`, `r.dc` todo!() } fn init_accelerometer<'d>(r: AccelerometerResources<'d>) -> Accelerometer<'d> { // use `r.i2c`, `r.sda`, `r.scl` todo!() } // let peripherals = esp_hal::init(...); let resources = split_resources!(peripherals); let display = init_display(resources.display); let axl = init_accelerometer(resources.axl); // Other fields (`peripherals.UART0`, ...) of the `peripherals` struct can still be accessed. ``` -------------------------------- ### start Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/mcpwm/timer/struct.Timer.html Applies the provided timer configuration to the MCPWM timer. ```APIDOC ## pub fn start(&mut self, timer_config: TimerClockConfig) ### Description Applies the given timer configuration. The prescaler and period configuration are applied immediately by default. ### Parameters - **timer_config** (TimerClockConfig) - The configuration settings to apply to the timer. ``` -------------------------------- ### start_exponentiation Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/rsa/struct.RsaModularExponentiation.html?search=u32+-%3E+bool Starts the modular exponentiation operation. ```APIDOC ### pub fn start_exponentiation(&mut self, base: &T::InputType, r: &T::InputType) Starts the modular exponentiation operation. `r` can be calculated using `2 ^ (bitlength * 2) mod modulus`. ``` -------------------------------- ### start_exponentiation Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/rsa/struct.RsaModularExponentiation.html Starts the modular exponentiation operation. ```APIDOC ## pub fn start_exponentiation(&mut self, base: &T::InputType, r: &T::InputType) ### Description Starts the modular exponentiation operation. The `r` parameter can be calculated using `2 ^ (bitlength * 2) mod modulus`. ### Parameters - **base** (&T::InputType) - The base value. - **r** (&T::InputType) - The precomputed r value. ``` -------------------------------- ### H-Bridge Configuration Example Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/mcpwm/operator/struct.LinkedPins.html?search= Demonstrates configuring an H-bridge using LinkedPins with deadtime settings. ```rust // active high complementary using PWMA input let bridge_active = DeadTimeCfg::new_ahc(); // use PWMB as input for both outputs let bridge_off = DeadTimeCfg::new_bypass().set_output_swap(PWMStream::PWMA, true); let mut mcpwm = McPwm::new( peripherals.MCPWM0, PeripheralClockConfig::with_frequency(Rate::from_mhz(40))?, ); let mut pins = mcpwm.operator0.with_linked_pins( peripherals.GPIO0, PwmPinConfig::UP_DOWN_ACTIVE_HIGH, // use PWMA as our main input peripherals.GPIO1, PwmPinConfig::EMPTY, // keep PWMB "low" bridge_off, ); pins.set_falling_edge_deadtime(5); pins.set_rising_edge_deadtime(5); // pin_a: ________________________________________ // pin_b: ________________________________________ pins.set_timestamp_a(40); // 40% duty cycle if period configured to 100 pins.set_deadtime_cfg(bridge_active); // pin_a: _______-------_____________-------______ // pin_b: ------_________-----------_________----- ``` -------------------------------- ### TouchPad::start_measurement Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/touch/struct.TouchPad.html?search= Starts a touch measurement on the pin. ```APIDOC ### pub fn start_measurement(&mut self) (Re-)Start a touch measurement on the pin. The result can be retrieved by calling `read` once finished. ``` -------------------------------- ### TouchPad::start_measurement Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/touch/struct.TouchPad.html Starts a touch measurement on the pin. ```APIDOC ### pub fn start_measurement(&mut self) (Re-)Start a touch measurement on the pin. You can get the result by calling `read` once it is finished. ``` -------------------------------- ### CpuControl::start_app_core Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/system/struct.CpuControl.html?search=u32+-%3E+bool Starts the application core with a provided stack and entry closure. ```APIDOC ## pub fn start_app_core<'a, const SIZE: usize, F>( &mut self, stack: &'static mut Stack, entry: F, ) -> Result, Error> ### Description Start the APP (second) core. The second core will start running the closure `entry`. Note that if the closure exits, the core will be parked. Dropping the returned guard will park the core. ### Stability This API is marked as unstable and is only available when the `unstable` crate feature is enabled. ``` -------------------------------- ### Initialize system configuration Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/struct.Config.html?search= Examples showing how to initialize the system using default or custom configurations. ```rust let peripherals = esp_hal::init(esp_hal::Config::default()); ``` ```rust use esp_hal::{clock::CpuClock, time::Duration}; let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max()); let peripherals = esp_hal::init(config); ``` -------------------------------- ### Get Current Time Example Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/rtc_cntl/struct.Rtc.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates retrieving the current time and converting it to a specific timezone using the jiff crate. ```rust use jiff::{ Timestamp, tz::{self, TimeZone}, }; static TZ: TimeZone = tz::get!("America/New_York"); let rtc = Rtc::new(peripherals.LPWR); let now = Timestamp::from_microsecond(rtc.current_time_us() as i64)?; let weekday_in_new_york = now.to_zoned(TZ.clone()).weekday(); ``` -------------------------------- ### init Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/lib.rs.html Initializes the system, including CPU clock and watchdog timers, and returns the peripherals and clocks. ```APIDOC ## fn init(config: Config) -> Peripherals ### Description Initializes the system by setting up the CPU clock and watchdog timers. It returns the available peripherals for the application to use. ### Parameters - **config** (Config) - Required - The configuration object used to initialize the system, including clock settings. ### Returns - **Peripherals** - The system peripherals instance. ``` -------------------------------- ### init() Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/index.html?search= Initializes the system hardware and runtime environment. ```APIDOC ## init() ### Description Initializes the system. This function should be called at the start of the program to prepare the hardware environment. ### Signature `fn init() -> Peripherals` ``` -------------------------------- ### esp_hal::init Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/lib.rs.html Initializes the system using the provided configuration. ```APIDOC ## esp_hal::init(config: Config) ### Description Initializes the ESP32 peripherals using the specified configuration. ### Parameters - **config** (Config) - Required - The configuration object to apply during initialization. ### Example ```rust let peripherals = esp_hal::init(esp_hal::Config::default()); ``` ``` -------------------------------- ### LEDC Start Duty Fade Inner Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/ledc/channel.rs.html?search= Internal helper for starting duty cycle fading on ESP32 devices. ```rust #[cfg(esp32)] fn start_duty_fade_inner( &self, duty_inc: bool, duty_steps: u16, cycles_per_step: u16, duty_per_cycle: u16, ) { if S::IS_HS { self.ledc .hsch(self.number as usize) .conf1() .write(|w| unsafe { w.duty_start() .set_bit() .duty_inc() .variant(duty_inc) .duty_num() // count of incs before stopping .bits(duty_steps) ``` -------------------------------- ### Initialize the system Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/lib.rs.html Use the init function to set up the CPU clock and watchdog, returning the peripherals and clocks for use. ```rust use esp_hal::{Config, init}; let peripherals = init(Config::default()); ``` -------------------------------- ### TouchPad::start_measurement Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/touch/struct.TouchPad.html?search=u32+-%3E+bool Starts a touch measurement on the pin in OneShot mode. ```APIDOC pub fn start_measurement(&mut self) ``` -------------------------------- ### TwaiConfiguration::start Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/twai/struct.TwaiConfiguration.html?search=std%3A%3Avec Transitions the peripheral into Operation Mode. ```APIDOC ### Method `pub fn start(self) -> Twai<'d, Dm>` ### Description Put the peripheral into Operation Mode, allowing the transmission and reception of packets using the new object. ``` -------------------------------- ### LEDC Configuration and Usage Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/ledc/index.html Example demonstrating how to initialize the LEDC peripheral, configure a Low Speed timer, set up a channel, and perform a duty cycle fade. ```APIDOC ## LEDC Configuration Example ### Description This example shows how to initialize the LEDC peripheral, configure a timer for 24kHz output, and set up a channel to perform a breathing LED effect using duty cycle fading. ### Usage ```rust let mut ledc = Ledc::new(peripherals.LEDC); ledc.set_global_slow_clock(LSGlobalClkSource::APBClk); let mut lstimer0 = ledc.timer::(timer::Number::Timer0); lstimer0.configure(timer::config::Config { duty: timer::config::Duty::Duty5Bit, clock_source: timer::LSClockSource::APBClk, frequency: Rate::from_khz(24), })?; let mut channel0 = ledc.channel(channel::Number::Channel0, led); channel0.configure(channel::config::Config { timer: &lstimer0, duty_pct: 10, drive_mode: DriveMode::PushPull, })?; // Fade duty cycle channel0.start_duty_fade(0, 100, 1000)?; while channel0.is_duty_fade_running() {} ``` ``` -------------------------------- ### CpuControl::start_app_core Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/system/struct.CpuControl.html Starts the application (second) core with a provided stack and entry closure. ```APIDOC ## pub fn start_app_core<'a, const SIZE: usize, F>(&mut self, stack: &'static mut Stack, entry: F) -> Result, Error> ### Description Start the APP (second) core. The second core will start running the closure `entry`. If the closure exits, the core will be parked. Dropping the returned guard will park the core. ### Parameters - **stack** (&'static mut Stack) - The stack memory for the core. - **entry** (F) - The closure to execute on the second core. ``` -------------------------------- ### pub fn init(config: Config) -> Peripherals Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/fn.init.html?search= Initializes the system, setting up the CPU clock and watchdog, and returns the peripherals. This function is available only when the 'rt' crate feature is enabled. ```APIDOC ## Function: init ### Description Initializes the system by setting up the CPU clock and watchdog. Returns the peripherals and clocks for the application. ### Signature `pub fn init(config: Config) -> Peripherals` ### Requirements - **Crate Feature**: `rt` ### Example ```rust use esp_hal::{Config, init}; let peripherals = init(Config::default()); ``` ``` -------------------------------- ### Start RSA Backend Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/rsa/mod.rs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Registers the RSA driver to begin processing operations. ```rust use esp_hal::rsa::RsaBackend; let mut rsa = RsaBackend::new(peripherals.RSA); // Start the backend, which allows processing RSA operations. let _backend = rsa.start(); ``` -------------------------------- ### SPI Master Driver Initialization Example Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/spi/master/mod.rs.html?search= Demonstrates how to initialize the SPI master peripheral using the provided configuration. ```rust use esp_hal::spi::{ Mode, master::{Config, Spi}, }; let mut spi = Spi::new( peripherals.SPI2, ``` -------------------------------- ### Start Duty Cycle Fade Hardware Implementation Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/ledc/channel.rs.html Initializes a duty cycle fade operation by writing the starting duty and clearing interrupt flags. The implementation varies based on the target architecture. ```rust #[cfg(esp32)] fn start_duty_fade_hw( &self, start_duty: u32, duty_inc: bool, duty_steps: u16, cycles_per_step: u16, duty_per_cycle: u16, ) { if S::IS_HS { self.ledc .hsch(self.number as usize) .duty() .write(|w| unsafe { w.duty().bits(start_duty << 4) }); self.ledc .int_clr() .write(|w| w.duty_chng_end_hsch(self.number as u8).clear_bit_by_one()); } else { self.ledc .lsch(self.number as usize) .duty() .write(|w| unsafe { w.duty().bits(start_duty << 4) }); self.ledc .int_clr() .write(|w| w.duty_chng_end_lsch(self.number as u8).clear_bit_by_one()); } self.start_duty_fade_inner(duty_inc, duty_steps, cycles_per_step, duty_per_cycle); self.update_channel(); } ``` ```rust #[cfg(not(esp32))] fn start_duty_fade_hw( &self, start_duty: u32, duty_inc: bool, duty_steps: u16, cycles_per_step: u16, duty_per_cycle: u16, ) { self.ledc .ch(self.number as usize) .duty() .write(|w| unsafe { w.duty().bits(start_duty << 4) }); self.ledc .int_clr() .write(|w| w.duty_chng_end_ch(self.number as u8).clear_bit_by_one()); self.start_duty_fade_inner(duty_inc, duty_steps, cycles_per_step, duty_per_cycle); self.update_channel(); } ``` -------------------------------- ### Configure and use Ext1WakeupSource Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/rtc_cntl/sleep/struct.Ext1WakeupSource.html?search= Example demonstrating how to initialize pins and use Ext1WakeupSource to wake the device from deep sleep. ```rust let delay = Delay::new(); let mut rtc = Rtc::new(peripherals.LPWR); let config = InputConfig::default().with_pull(Pull::None); let mut pin_2 = peripherals.GPIO2; let mut pin_4 = peripherals.GPIO4; let pin_4_driver = Input::new(pin_4.reborrow(), config); let reason = reset_reason(Cpu::ProCpu); let wake_reason = wakeup_cause(); println!("{:?} {:?}", reason, wake_reason); let timer = TimerWakeupSource::new(Duration::from_secs(30)); // Drop the driver to access `pin_4` core::mem::drop(pin_4_driver); let mut wakeup_pins: [&mut dyn RtcPin; 2] = [&mut pin_4, &mut pin_2]; let ext1 = Ext1WakeupSource::new(&mut wakeup_pins, WakeupLevel::High); delay.delay_millis(100); rtc.sleep_deep(&[&timer, &ext1]); ``` -------------------------------- ### start_multiplication Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/rsa/struct.RsaMultiplication.html?search=u32+-%3E+bool Starts the multiplication operation. ```APIDOC ## pub fn start_multiplication(&mut self, operand_b: &T::InputType) ### Description Initiates the multiplication operation with the second operand. ``` -------------------------------- ### interrupts Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/spi/master/struct.SpiDmaBus.html Gets asserted interrupts. ```APIDOC ### pub fn interrupts(&mut self) -> EnumSet Gets asserted interrupts. This API is marked as unstable. ``` -------------------------------- ### CpuControl::start_app_core Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/system/struct.CpuControl.html?search=std%3A%3Avec Starts the application (second) core with a provided stack and entry function. ```APIDOC ### pub fn start_app_core<'a, const SIZE: usize, F>(&mut self, stack: &'static mut Stack, entry: F) -> Result, Error> Start the APP (second) core. The second core will start running the closure `entry`. If the closure exits, the core will be parked. Dropping the returned guard will park the core. ``` -------------------------------- ### CpuControl::start_app_core Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/system/struct.CpuControl.html?search= Starts the application (second) core with a provided stack and entry function. ```APIDOC ## pub fn start_app_core<'a, const SIZE: usize, F>(&mut self, stack: &'static mut Stack, entry: F) -> Result, Error> ### Description Start the APP (second) core. The second core will start running the closure `entry`. Note that if the closure exits, the core will be parked. Dropping the returned guard will park the core. ### Stability This API is marked as unstable and is only available when the `unstable` crate feature is enabled. ``` -------------------------------- ### interrupts Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/spi/master/struct.SpiDma.html Gets asserted interrupts. ```APIDOC ### pub fn interrupts(&mut self) -> EnumSet Gets asserted interrupts. This API is unstable. ``` -------------------------------- ### pub fn init(config: Config) -> Peripherals Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/fn.init.html Initializes the system, setting up the CPU clock and watchdog. This function is available only when the 'rt' crate feature is enabled. ```APIDOC ## pub fn init(config: Config) -> Peripherals ### Description Initializes the system by setting up the CPU clock and watchdog. Returns the peripherals and clocks for the application to use. ### Signature `pub fn init(config: Config) -> Peripherals` ### Requirements - **Crate Feature**: `rt` ### Parameters - **config** (Config) - Required - The configuration object used to initialize the system. ### Returns - **Peripherals** - The initialized peripherals and clocks for the system. ### Example ```rust use esp_hal::{Config, init}; let peripherals = init(Config::default()); ``` ``` -------------------------------- ### TwaiConfiguration::start Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/twai/struct.TwaiConfiguration.html Transitions the peripheral from configuration mode to operational mode. ```APIDOC ### pub fn start(self) -> Twai<'d, Dm> Put the peripheral into Operation Mode, allowing the transmission and reception of packets. ``` -------------------------------- ### Initialize and use I2C Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/i2c/master/struct.I2c.html Demonstrates creating an I2C instance with custom SDA/SCL pins and performing a write-read operation. ```rust use esp_hal::i2c::master::{Config, I2c}; let mut i2c = I2c::new(peripherals.I2C0, Config::default())? .with_sda(peripherals.GPIO1) .with_scl(peripherals.GPIO2); let mut data = [0u8; 22]; i2c.write_read(DEVICE_ADDR, &[0xaa], &mut data)?; ``` -------------------------------- ### receive Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/rmt/struct.Channel.html?search=std%3A%3Avec Starts receiving pulse codes. ```APIDOC ## pub fn receive<'data>(self, data: &'data mut [PulseCode]) -> Result, (Error, Self)> ## pub fn receive(&mut self, data: &mut [PulseCode]) -> impl Future> ### Description Starts receiving pulse codes into the provided buffer. In blocking mode, returns an RxTransaction; in async mode, returns a Future. ``` -------------------------------- ### transmit Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/rmt/struct.Channel.html?search=std%3A%3Avec Starts transmitting pulse codes. ```APIDOC ## pub fn transmit<'data>(self, data: &'data [PulseCode]) -> Result, (Error, Self)> ## pub fn transmit(&mut self, data: &[PulseCode]) -> impl Future> ### Description Starts transmitting the given pulse code sequence. In blocking mode, returns a TxTransaction; in async mode, returns a Future. ``` -------------------------------- ### Initialize with default configuration Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/struct.Config.html Use the default configuration to initialize peripherals. ```rust let peripherals = esp_hal::init(esp_hal::Config::default()); ``` -------------------------------- ### RSA Backend Usage Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/rsa/mod.rs.html?search= Examples for initializing the RSA backend and performing operations using the RsaContext. ```rust use esp_hal::rsa::{RsaBackend, RsaContext, operand_sizes::Op512}; # let mut rsa_backend = RsaBackend::new(peripherals.RSA); let _driver = rsa_backend.start(); async fn perform_512bit_big_number_multiplication( operand_a: &[u32; 16], operand_b: &[u32; 16], result: &mut [u32; 32], ) { let mut rsa = RsaContext::new(); let mut handle = rsa.multiply::(operand_a, operand_b, result); handle.wait().await; } ``` ```rust use esp_hal::rsa::RsaBackend; # let mut rsa = RsaBackend::new(peripherals.RSA); ``` ```rust use esp_hal::rsa::RsaBackend; # let mut rsa = RsaBackend::new(peripherals.RSA); // Start the backend, which allows processing RSA operations. let _backend = rsa.start(); ``` -------------------------------- ### RsaMultiplication::start_multiplication Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/rsa/struct.RsaMultiplication.html Starts the multiplication operation. ```APIDOC ## pub fn start_multiplication(&mut self, operand_b: &T::InputType) ### Description Starts the RSA multiplication operation with the provided second operand. ``` -------------------------------- ### RsaMultiplication::start_multiplication Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/rsa/struct.RsaMultiplication.html?search= Starts the multiplication operation. ```APIDOC ## pub fn start_multiplication(&mut self, operand_b: &T::InputType) ### Description Starts the multiplication operation with the provided second operand. ``` -------------------------------- ### start_modular_multiplication Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/rsa/struct.RsaModularMultiplication.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Starts the modular multiplication operation. ```APIDOC ### pub fn start_modular_multiplication(&mut self, operand_b: &T::InputType) Starts the modular multiplication operation using the provided operand_b. ``` -------------------------------- ### Initialize System Peripherals Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/fn.init.html?search= Initializes the system using default configuration. Requires the 'rt' crate feature. ```rust use esp_hal::{Config, init}; let peripherals = init(Config::default()); ``` -------------------------------- ### Initialize Peripheral Singletons Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal Demonstrates how to initialize peripherals and pass them to a driver by value. ```rust // Peripheral singletons are returned from the `init` function. let peripherals = esp_hal::init(esp_hal::Config::default()); let mut i2c = I2c::new(peripherals.I2C0, /* ... */); ``` -------------------------------- ### Usage Example Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/macro.dma_circular_descriptors_chunk_size.html Initialize RX and TX descriptors by specifying the buffer sizes and the chunk size. ```rust use esp_hal::dma_circular_descriptors_chunk_size; // Create RX and TX descriptors for transactions up to 32000 bytes - passing // only one parameter assumes RX and TX are the same size. let (rx_descriptors, tx_descriptors) = dma_circular_descriptors_chunk_size!(32000, 32000, 4032); ``` -------------------------------- ### value Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/pcnt/unit/struct.Unit.html?search= Get the current counter value. ```APIDOC ## pub fn value(&self) -> i16 ### Description Returns the current counter value. ``` -------------------------------- ### Enable RWBLE Interrupt Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/peripherals/struct.BT.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Example of setting up and enabling the RWBLE peripheral interrupt. ```rust use esp_hal::interrupt::Priority; #[unsafe(no_mangle)] unsafe extern "C" fn RWBLE() { // do something } peripherals.BT.enable_rwble_interrupt(Priority::Priority1); peripherals.BT.disable_rwble_interrupt_on_all_cores(); ``` -------------------------------- ### Configure RTC Sleep Wakeup Sources Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/rtc_cntl/sleep/mod.rs.html Example demonstrating how to initialize RTC, set up timer and GPIO wakeup sources, and enter deep sleep. ```rust # {before_snippet} # use core::time::Duration; # use esp_hal::delay::Delay; # use esp_hal::gpio::{self, Input, InputConfig, Pull}; # use esp_hal::rtc_cntl::{reset_reason, # sleep::{RtcioWakeupSource, TimerWakeupSource, WakeupLevel}, # wakeup_cause, Rtc, SocResetReason # }; # use esp_hal::system::Cpu; let mut rtc = Rtc::new(peripherals.LPWR); let reason = reset_reason(Cpu::ProCpu); let wake_reason = wakeup_cause(); println!("{:?} {:?}", reason, wake_reason); let delay = Delay::new(); let timer = TimerWakeupSource::new(Duration::from_secs(10)); let wakeup_pins: &mut [(&mut dyn __rtc_pin_trait__, WakeupLevel)] = &mut [ (&mut peripherals.__pin0__, WakeupLevel::Low), (&mut peripherals.__pin1__, WakeupLevel::High), ]; let rtcio = RtcioWakeupSource::new(wakeup_pins); delay.delay_millis(100); rtc.sleep_deep(&[&timer, &rtcio]); # {after_snippet} ``` -------------------------------- ### Initialize SPI Master Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/spi/master/mod.rs.html Demonstrates how to create a new SPI instance with custom frequency and mode, and assign pins. ```rust let mut spi = Spi::new( peripherals.SPI2, Config::default() .with_frequency(Rate::from_khz(100)) .with_mode(Mode::_0), )? .with_sck(peripherals.GPIO0) .with_mosi(peripherals.GPIO1) .with_miso(peripherals.GPIO2); ``` ```rust use esp_hal::spi::{ Mode, master::{Config, Spi}, }; let mut spi = Spi::new(peripherals.SPI2, Config::default())? .with_sck(peripherals.GPIO0) .with_mosi(peripherals.GPIO1) .with_miso(peripherals.GPIO2); ``` -------------------------------- ### PeriodicTimer::start Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/timer/struct.PeriodicTimer.html?search=u32+-%3E+bool Starts a new count down for the timer. ```APIDOC ### pub fn start(&mut self, period: Duration) -> Result<(), Error> Starts a new count down. ``` -------------------------------- ### Psram::new Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/psram/struct.Psram.html?search=u32+-%3E+bool Initializes the PSRAM peripheral with the provided configuration. ```APIDOC ### pub fn new(peri: PSRAM<'static>, config: PsramConfig) -> Self Initializes the PSRAM peripheral. This method consumes the PSRAM peripheral instance and a configuration object to return a new Psram instance. ``` -------------------------------- ### PeriodicTimer::start Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/timer/struct.PeriodicTimer.html?search= Starts a new count down for the timer. ```APIDOC ### pub fn start(&mut self, period: Duration) -> Result<(), Error> Starts a new count down with the specified duration. ``` -------------------------------- ### Partitioning a slice Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/dma/struct.DmaLoopBuf.html Examples demonstrating the use of partition_point to find the split index in a slice. ```rust let a = [2, 4, 8]; assert_eq!(a.partition_point(|x| x < &100), a.len()); let a: [i32; 0] = []; assert_eq!(a.partition_point(|x| x < &100), 0); ``` ```rust let mut s = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; let num = 42; let idx = s.partition_point(|&x| x <= num); s.insert(idx, num); assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]); ``` -------------------------------- ### Psram::new Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/psram/struct.Psram.html?search=std%3A%3Avec Initializes the PSRAM peripheral with the provided configuration. ```APIDOC ## pub fn new(peri: PSRAM<'static>, config: PsramConfig) -> Self ### Description Initializes the PSRAM peripheral using the specified hardware peripheral instance and configuration settings. ### Parameters - **peri** (PSRAM<'static>) - The PSRAM peripheral instance. - **config** (PsramConfig) - The configuration settings for the PSRAM. ``` -------------------------------- ### PeriodicTimer::start Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/timer/struct.PeriodicTimer.html Starts a new count down for the timer. ```APIDOC ## pub fn start(&mut self, period: Duration) -> Result<(), Error> ### Description Starts a new count down with the specified duration. ``` -------------------------------- ### Psram::new Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/psram/struct.Psram.html Initializes the PSRAM peripheral with the provided configuration. ```APIDOC ## pub fn new(peri: PSRAM<'static>, config: PsramConfig) -> Self ### Description Initializes the PSRAM peripheral. This method consumes the PSRAM peripheral instance and a configuration object to prepare the external memory for use. ### Parameters - **peri** (PSRAM<'static>) - The PSRAM peripheral instance. - **config** (PsramConfig) - The configuration settings for the PSRAM. ``` -------------------------------- ### Sha::start Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/sha/struct.Sha.html?search=std%3A%3Avec Starts a new digest operation. ```APIDOC ## pub fn start<'a, A: ShaAlgorithm>(&'a mut self) -> ShaDigest<'d, A, &'a mut Self> ### Description Starts a new digest operation using the specified algorithm. This method borrows the driver instance. ### Parameters - **A** (ShaAlgorithm) - The cryptographic algorithm to use for the digest. ``` -------------------------------- ### Sha::start Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/sha/struct.Sha.html Starts a new digest operation. ```APIDOC ## pub fn start<'a, A: ShaAlgorithm>(&'a mut self) -> ShaDigest<'d, A, &'a mut Self> ### Description Starts a new digest operation using the specified algorithm. This method borrows the driver instance. ### Parameters - **A** (ShaAlgorithm) - The hashing algorithm to use. ``` -------------------------------- ### Psram::new Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/psram/struct.Psram.html?search= Initializes the PSRAM peripheral with the provided configuration. ```APIDOC ## pub fn new(peri: PSRAM<'static>, config: PsramConfig) -> Self ### Description Initializes the PSRAM peripheral using the provided PSRAM instance and configuration settings. ### Parameters - **peri** (PSRAM<'static>) - The PSRAM peripheral instance. - **config** (PsramConfig) - The configuration settings for the PSRAM. ``` -------------------------------- ### RsaModularMultiplication::start_modular_multiplication Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/rsa/struct.RsaModularMultiplication.html?search= Starts the modular multiplication operation. ```APIDOC ## pub fn start_modular_multiplication(&mut self, operand_b: &T::InputType) ### Description Starts the modular multiplication operation using the provided operand_b. ``` -------------------------------- ### zero_mode Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/pcnt/unit.rs.html Gets the mode of the last zero crossing. ```APIDOC ## zero_mode() -> ZeroMode ### Description Returns the mode associated with the last zero crossing event. ``` -------------------------------- ### Configure Application Core Startup Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/system/multi_core.rs.html Sets the entry point and stack configuration for the secondary core before execution. ```rust let entry_fn = entry_dst.cast::<()>(); START_CORE1_FUNCTION.store(entry_fn, Ordering::Release); APP_CORE_STACK_TOP.store(stack.top(), Ordering::Release); APP_CORE_STACK_GUARD.store(stack_guard.cast(), Ordering::Release); } } ``` -------------------------------- ### CpuControl Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/system/multi_core.rs.html?search=u32+-%3E+bool Interface for controlling and starting secondary CPU cores. ```APIDOC ## struct CpuControl<'d> ### Description Provides functionality to manage and start the application (secondary) CPU core. ### Methods - **start_app_core(stack: &mut Stack, f: F) -> Result** - Starts the application core using the provided stack and closure. Returns an AppCoreGuard which, when dropped, will park the core. ``` -------------------------------- ### Initializing SpiDma with Buffers Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/spi/master/struct.SpiDma.html Example of setting up a DMA-capable SPI instance using dma_buffers and the with_buffers method. ```rust use esp_hal::{ dma::{DmaRxBuf, DmaTxBuf}, dma_buffers, spi::{ Mode, master::{Config, Spi}, }, }; let (rx_buffer, rx_descriptors, tx_buffer, tx_descriptors) = dma_buffers!(32000); let dma_rx_buf = DmaRxBuf::new(rx_descriptors, rx_buffer)?; let dma_tx_buf = DmaTxBuf::new(tx_descriptors, tx_buffer)?; let mut spi = Spi::new( peripherals.SPI2, Config::default() .with_frequency(Rate::from_khz(100)) .with_mode(Mode::_0), )? .with_dma(peripherals.DMA_SPI2) .with_buffers(dma_rx_buf, dma_tx_buf); ``` -------------------------------- ### CpuControl Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/system/multi_core.rs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Interface for controlling and starting secondary CPU cores. ```APIDOC ## CpuControl ### Description Provides functionality to initialize and start the application core (CPU1) using a provided stack and closure. ### Methods - **new(peripherals.CPU_CTRL)**: Creates a new instance of CpuControl. - **start_app_core(stack, closure)**: Starts the application core. Takes a mutable reference to a `Stack` and a closure to execute on the secondary core. Returns an `AppCoreGuard` or an `Error` if the core is already running. ``` -------------------------------- ### Aes::new Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/aes/index.html Initializes a new instance of the AES peripheral. ```APIDOC ### Method `Aes::new(peripherals.AES)` ### Description Creates a new instance of the AES peripheral container to perform encryption and decryption operations. ### Parameters - **peripherals.AES** (Peripheral) - Required - The AES hardware peripheral instance. ``` -------------------------------- ### Configure and use Ext0WakeupSource Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/rtc_cntl/sleep/struct.Ext0WakeupSource.html Demonstrates initializing an Ext0WakeupSource and using it alongside a timer to wake the device from deep sleep. ```rust let delay = Delay::new(); let mut rtc = Rtc::new(peripherals.LPWR); let config = InputConfig::default().with_pull(Pull::None); let mut pin_4 = peripherals.GPIO4; let pin_4_input = Input::new(pin_4.reborrow(), config); let reason = reset_reason(Cpu::ProCpu); let wake_reason = wakeup_cause(); println!("{:?} {:?}", reason, wake_reason); let timer = TimerWakeupSource::new(Duration::from_secs(30)); core::mem::drop(pin_4_input); let ext0 = Ext0WakeupSource::new(pin_4, WakeupLevel::High); delay.delay_millis(100); rtc.sleep_deep(&[&timer, &ext0]); ``` -------------------------------- ### multiply Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/rsa/mod.rs.html?search= Starts an asynchronous multiplication operation (Z = X * Y). ```APIDOC ### Method `multiply<'t, OP>(&'t mut self, x: &'t OP::InputType, y: &'t OP::InputType, result: &'t mut OP::OutputType) -> RsaHandle<'t>` ### Description Performs standard multiplication asynchronously. The result buffer must be twice as wide as the inputs. ### Parameters - **x** (&'t OP::InputType) - Multiplicand input - **y** (&'t OP::InputType) - Multiplier input - **result** (&'t mut OP::OutputType) - Buffer to store the result ``` -------------------------------- ### Initialize and Use UART Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/src/esp_hal/uart/mod.rs.html?search= Demonstrates how to initialize a UART peripheral with default configuration and perform a basic write operation. ```rust # {before_snippet} use esp_hal::uart::{Config, Uart}; let mut uart = Uart::new(peripherals.UART0, Config::default())? .with_rx(peripherals.GPIO1) .with_tx(peripherals.GPIO2); uart.write(b"Hello world!")?; # {after_snippet} ``` -------------------------------- ### transmit_continuously Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/rmt/struct.Channel.html?search= Starts transmitting pulse codes continuously in a loop. ```APIDOC ### pub fn transmit_continuously(self, data: &[PulseCode], mode: LoopMode) -> Result, (Error, Self)> Starts transmitting the given pulse code continuously. The `mode` argument determines the loop behavior. ``` -------------------------------- ### Channel::receive Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/rmt/struct.Channel.html?search=u32+-%3E+bool Starts receiving pulse codes into a buffer. ```APIDOC ## pub fn receive<'data>(self, data: &'data mut [PulseCode]) -> Result, (Error, Self)> ### Description Start receiving pulse codes into the given buffer. This returns an RxTransaction which can be used to wait for receive to complete. ``` -------------------------------- ### Io::new Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/gpio/struct.Io.html?search=std%3A%3Avec Initializes the I/O driver using the provided IO_MUX instance. ```APIDOC ## pub fn new(_io_mux: IO_MUX<'d>) -> Self ### Description Initializes the I/O driver. This API is marked as unstable and requires the `unstable` crate feature. ``` -------------------------------- ### Channel::transmit Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/rmt/struct.Channel.html?search=u32+-%3E+bool Starts transmitting a pulse code sequence. ```APIDOC ## pub fn transmit<'data>(self, data: &'data [PulseCode]) -> Result, (Error, Self)> ### Description Start transmitting the given pulse code sequence. This returns a TxTransaction which can be used to wait for the transaction to complete. ``` -------------------------------- ### TouchPad::new Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/touch/struct.TouchPad.html Constructs a new instance of a TouchPad. ```APIDOC ### pub fn new(pin: P, _touch: &Touch<'_, Tm, Dm>) -> Self Constructs a new instance of `TouchPad`. #### Parameters - **pin** (P) - The pin that gets configured as touch pad - **_touch** (&Touch<'_, Tm, Dm>) - The `Touch` struct indicating that touch is configured. ``` -------------------------------- ### TouchPad::new Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/touch/struct.TouchPad.html?search= Constructs a new instance of a TouchPad. ```APIDOC ### pub fn new(pin: P, _touch: &Touch<'_, Tm, Dm>) -> Self Constructs a new instance of `TouchPad`. #### Parameters - **pin** (P) - The pin that gets configured as a touch pad. - **_touch** (&Touch<'_, Tm, Dm>) - The `Touch` struct indicating that touch is configured. ``` -------------------------------- ### TouchPad::new Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/touch/struct.TouchPad.html?search=u32+-%3E+bool Constructs a new instance of a TouchPad. ```APIDOC pub fn new(pin: P, _touch: &Touch<'_, Tm, Dm>) -> Self ``` -------------------------------- ### num_available_messages Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/twai/struct.Twai.html?search=u32+-%3E+bool Gets the number of messages available in the receive FIFO. ```APIDOC ## pub fn num_available_messages(&self) -> u8 ### Description Get the number of messages that the peripheral has available in the receive FIFO. ``` -------------------------------- ### num_available_messages Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/twai/struct.Twai.html?search= Gets the number of messages available in the receive FIFO. ```APIDOC ### pub fn num_available_messages(&self) -> u8 Get the number of messages that the peripheral has available in the receive FIFO. ``` -------------------------------- ### TouchPad::new Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/touch/index.html Initializes a new TouchPad instance using a GPIO pin and a configured touch peripheral. ```APIDOC ## TouchPad::new ### Description Creates a new TouchPad instance associated with a specific GPIO pin and the initialized touch peripheral. ### Signature `TouchPad::new(pin: Pin, touch: &Touch) -> TouchPad` ### Parameters - **pin** (GPIO) - Required - The GPIO pin to be used as a touch sensor. - **touch** (&Touch) - Required - A reference to the initialized touch peripheral. ``` -------------------------------- ### main Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/index.html?search= Attribute macro to declare the entry point of the program. ```APIDOC ## #[main] ### Description Attribute to declare the entry point of the program. This replaces the standard Rust main function for embedded execution. ``` -------------------------------- ### interrupts Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/spi/master/struct.SpiDma.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Gets asserted SPI interrupts. This API is unstable. ```APIDOC ### pub fn interrupts(&mut self) -> EnumSet Returns the set of currently asserted SPI interrupts. This method is only available when the `unstable` crate feature is enabled. ``` -------------------------------- ### Io::new Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/gpio/struct.Io.html?search= Initializes the I/O driver using the provided IO_MUX peripheral. ```APIDOC ## pub fn new(_io_mux: IO_MUX<'d>) -> Self ### Description Initializes the I/O driver. This API is marked as unstable and requires the `unstable` crate feature. ### Parameters - **_io_mux** (IO_MUX<'d>) - Required - The IO_MUX peripheral instance. ``` -------------------------------- ### I2s::interrupts Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/i2s/master/struct.I2s.html?search= Gets asserted I2S interrupts (Unstable). ```APIDOC ## pub fn interrupts(&mut self) -> EnumSet ### Description Returns the set of currently asserted interrupts. This API is unstable and requires the `unstable` feature. ``` -------------------------------- ### Io::new Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/gpio/struct.Io.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Initializes the I/O driver using the provided IO_MUX peripheral. ```APIDOC ## pub fn new(_io_mux: IO_MUX<'d>) -> Self ### Description Initialize the I/O driver. ### Stability This API is marked as unstable and is only available when the `unstable` crate feature is enabled. ``` -------------------------------- ### Get length of slice Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/dma/struct.DmaLoopBuf.html?search= Returns the number of elements in the slice. ```rust let a = [1, 2, 3]; assert_eq!(a.len(), 3); ``` -------------------------------- ### Get buffer capacity Source: https://docs.espressif.com/projects/rust/esp-hal/1.1.1/esp32/esp_hal/dma/struct.DmaTxBuf.html?search= Returns the total size of the underlying buffer. ```rust pub fn capacity(&self) -> usize ```