This commit is contained in:
2026-09-07 18:46:42 -05:00
parent 60e073a706
commit 9141629a58
3 changed files with 29 additions and 36 deletions
+2 -12
View File
@@ -6,8 +6,6 @@ mod led;
use esp_backtrace as _;
use esp_bootloader_esp_idf::esp_app_desc;
use esp_hal::ledc::timer::{self, TimerIFace};
use esp_hal::ledc::{LSGlobalClkSource, Ledc, LowSpeed};
use esp_hal::{init, rmt::Rmt, time::Rate, Config};
use esp_println::println;
use smart_leds::hsv::{hsv2rgb, Hsv};
@@ -24,16 +22,8 @@ fn main() -> ! {
led::RgbLed::new(rmt.channel0, peripherals.GPIO8).expect("Failed to init RGB LED")
};
let mut ledc = Ledc::new(peripherals.LEDC);
ledc.set_global_slow_clock(LSGlobalClkSource::APBClk);
let mut timer = ledc.timer::<LowSpeed>(timer::Number::Timer0);
timer
.configure(timer::config::Config {
duty: timer::config::Duty::Duty8Bit,
clock_source: timer::LSClockSource::APBClk,
frequency: Rate::from_khz(5),
})
.expect("Failed to configure backlight timer");
let (_ledc, timer) =
backlight::setup_timer(peripherals.LEDC).expect("Failed to init backlight timer");
let mut backlight =
backlight::LcdBacklight::new(&timer, peripherals.GPIO22).expect("Failed to init backlight");