Repo for designs & driver for a TA7642 powered lightning detector

use Duty Cycle API for PwmDriver

+4 -4
+4 -4
embassy-strike-driver/src/drivers.rs
··· 6 6 dma, 7 7 interrupt::typelevel::{ADC_IRQ_FIFO, Binding}, 8 8 peripherals::ADC, 9 - pwm::{self, ChannelBPin, Pwm, Slice}, 9 + pwm::{self, ChannelBPin, Pwm, SetDutyCycle, Slice}, 10 10 }; 11 11 use embassy_sync::{blocking_mutex::raw::RawMutex, mutex::Mutex}; 12 12 ··· 92 92 config.compare_b = 0; 93 93 let pwm = Pwm::new_output_b(slice, b, config.clone()); 94 94 95 - 96 95 Self { pwm, config } 97 96 } 98 97 } 99 98 100 99 impl PwmSource for PwmDriver<'_> { 101 100 fn set_duty(&mut self, duty: u16) { 102 - self.config.compare_b = duty.clamp(0, self.config.top); 103 - self.pwm.set_config(&self.config); 101 + let duty = duty.clamp(0, self.pwm.max_duty_cycle()); 102 + 103 + self.pwm.set_duty_cycle(duty).ok(); 104 104 } 105 105 106 106 fn enable(&mut self) {