Expand description
LED Control peripheral (which also creates PWM signals for other purposes)
Interface to the LED Control (LEDC) peripheral
§Examples
Create a 25 kHz PWM signal with 75 % duty cycle on GPIO 1
use esp_idf_hal::ledc::{config::TimerConfig, Channel, LedcDriver, LedcTimerDriver, Timer};
use esp_idf_hal::peripherals::Peripherals;
use esp_idf_hal::prelude::*;
let peripherals = Peripherals::take().unwrap();
let timer_driver = LedcTimerDriver::new(peripherals.ledc.timer0, &TimerConfig::default().frequency(25.kHz().into()))?;
let mut driver = LedcDriver::new(peripherals.ledc.channel0, timer_driver, peripherals.pins.gpio1)?;
let max_duty = driver.get_max_duty();
driver.set_duty(max_duty * 3 / 4)?;See the examples/ folder of this repository for more.
Modules§
- config
- Types for configuring the LED Control peripheral
Structs§
- CHANNE
L0 - CHANNE
L1 - CHANNE
L2 - CHANNE
L3 - CHANNE
L4 - CHANNE
L5 - LEDC
- The LED Control device peripheral
- Ledc
Driver - LED Control driver
- Ledc
Timer Driver - LED Control timer driver
- LowSpeed
- Low speed mode for the LED Control peripheral
- PwmError
- TIMER0
- TIMER1
- TIMER2
- TIMER3
Enums§
Traits§
- Ledc
Channel - LED Control peripheral output channel
- Ledc
Timer - LED Control peripheral timer
- Speed
Mode - Speed mode for the LED Control peripheral The ESP32 supports two speed modes: low and high speed All others support only low speed mode.