This commit is contained in:
Caleb Jamison 2024-10-09 16:51:52 -04:00
parent 041eef5c2d
commit 1b32b7bcb4

View File

@ -1,13 +1,12 @@
//! PIO backed PWM driver //! PIO backed PWM driver
use core::time::Duration; use core::time::Duration;
use crate::pio::Pin;
use pio::InstructionOperands; use pio::InstructionOperands;
use crate::clocks; use crate::clocks;
use crate::gpio::Level; use crate::gpio::Level;
use crate::pio::{Common, Config, Direction, Instance, LoadedProgram, PioPin, StateMachine}; use crate::pio::{Common, Config, Direction, Instance, LoadedProgram, Pin, PioPin, StateMachine};
/// This converts the duration provided into the number of cycles the PIO needs to run to make it take the same time /// This converts the duration provided into the number of cycles the PIO needs to run to make it take the same time
fn to_pio_cycles(duration: Duration) -> u32 { fn to_pio_cycles(duration: Duration) -> u32 {
@ -45,7 +44,7 @@ impl<'a, PIO: Instance> PioPwmProgram<'a, PIO> {
/// Pio backed PWM output /// Pio backed PWM output
pub struct PioPwm<'d, T: Instance, const SM: usize> { pub struct PioPwm<'d, T: Instance, const SM: usize> {
sm: StateMachine<'d, T, SM>, sm: StateMachine<'d, T, SM>,
pin: Pin<'d, T> pin: Pin<'d, T>,
} }
impl<'d, T: Instance, const SM: usize> PioPwm<'d, T, SM> { impl<'d, T: Instance, const SM: usize> PioPwm<'d, T, SM> {