mct8316a eeprom programming
This commit is contained in:
@@ -1,20 +1,21 @@
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::time::Duration;
|
||||
use embedded_hal::pwm::{ErrorKind, ErrorType, SetDutyCycle};
|
||||
use log::trace;
|
||||
use rpi_pal::pwm::Pwm;
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::time::Duration;
|
||||
|
||||
const PWM_PERIOD: Duration = Duration::from_micros(1000); // 1kHz
|
||||
|
||||
pub struct PwmWrapper {
|
||||
pwm: Pwm
|
||||
pwm: Pwm,
|
||||
}
|
||||
|
||||
impl PwmWrapper {
|
||||
pub fn new(pwm: Pwm) -> anyhow::Result<Self> {
|
||||
pub fn new(mut pwm: Pwm) -> anyhow::Result<Self> {
|
||||
trace!("PwmWrapper::new(pwm: {pwm:?})");
|
||||
pwm.set_period(PWM_PERIOD)?;
|
||||
pwm.enable()?;
|
||||
pwm.set_reset_on_drop(true);
|
||||
Ok(Self {
|
||||
pwm
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user