Skip to content

Commit

Permalink
ws281x: Use static inline function through inline namespace
Browse files Browse the repository at this point in the history
Merges: #88
  • Loading branch information
chrysn authored Apr 15, 2024
2 parents de348dc + eff903b commit ea8d7fa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/ws281x.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,19 @@ impl<C: ChannelType + Default + Copy, const N: usize> BufferedWs281x<C, N> {
impl<C: ChannelType, const N: usize> BufferedWs281x<C, N> {
pub fn write(&mut self) {
unsafe {
riot_sys::ws281x_prepare_transmission(crate::inline_cast_mut(&mut self.dev as *mut _));
riot_sys::inline::ws281x_prepare_transmission(crate::inline_cast_mut(
&mut self.dev as *mut _,
));
riot_sys::ws281x_write_buffer(
&mut self.dev,
&self.buffer as *const _ as *const core::ffi::c_void,
(N * core::mem::size_of::<C>())
.try_into()
.expect("Buffer exceeds experssible range"),
);
riot_sys::ws281x_end_transmission(crate::inline_cast_mut(&mut self.dev as *mut _));
riot_sys::inline::ws281x_end_transmission(crate::inline_cast_mut(
&mut self.dev as *mut _,
));
}
}
}
Expand Down

0 comments on commit ea8d7fa

Please sign in to comment.