pub struct Pwm<T: Instance> { /* private fields */ }Expand description
A PWM peripheral driven Smartled driver
Implementations§
Source§impl<T> Pwm<T>where
T: Instance,
impl<T> Pwm<T>where
T: Instance,
Sourcepub fn new<Mode>(pwm: T, pin: Pin<Mode>) -> Pwm<T>
pub fn new<Mode>(pwm: T, pin: Pin<Mode>) -> Pwm<T>
Create a new Smartled driver with a given pin and PWM engine
Sourcepub unsafe fn start_send_raw(&mut self, buf: *const [u16]) -> Result<(), ()>
pub unsafe fn start_send_raw(&mut self, buf: *const [u16]) -> Result<(), ()>
Start sending raw data
NOTE: You should probably use Pwm::send_full_buf() instead.
SAFETY: the contents of buf must live and be constant until Pwm::is_done_raw()
returns true.
Sourcepub unsafe fn set_seq1_raw(&mut self, buf: *const [u16]) -> Result<(), ()>
pub unsafe fn set_seq1_raw(&mut self, buf: *const [u16]) -> Result<(), ()>
Set the seq[1] register’s ptr and length
SAFETY: the contents of buf must live and me constant until sequence 1
is completed
Sourcepub fn is_done_raw(&self) -> bool
pub fn is_done_raw(&self) -> bool
Is the raw send complete?
Note: You probably shouldn’t use this function unless you are also using Pwm::start_send_raw().
Sourcepub fn send_full_buf(
&mut self,
colors: &[RGB8],
scratch: &mut [u16],
) -> Result<(), ()>
pub fn send_full_buf( &mut self, colors: &[RGB8], scratch: &mut [u16], ) -> Result<(), ()>
Send a series of colors and a stop pattern, using a given scratch space
NOTE: the size of scratch must be >= u16s_needed_slice(colors).
NOTE: You can also use the SmartLedsWrite::write method to avoid the need for a scratch space (it uses its own)