Struct unicorn_hat_hd_2::UnicornHatHd
source · [−]pub struct UnicornHatHd { /* private fields */ }
Expand description
Provide high-level access to the Unicorn HAT HD.
Implementations
sourceimpl UnicornHatHd
impl UnicornHatHd
sourcepub fn new(bus: Bus, slave_select: SlaveSelect) -> Result<UnicornHatHd, Error>
pub fn new(bus: Bus, slave_select: SlaveSelect) -> Result<UnicornHatHd, Error>
Create a new UnicornHatHd
with the provided Bus and SlaveSelect
sourcepub fn set_pixel(&mut self, x_coord: usize, y_coord: usize, c: RGB8)
pub fn set_pixel(&mut self, x_coord: usize, y_coord: usize, c: RGB8)
Set an individual pixel’s RGB value.
The origin ((0, 0)
) is the top-left of the display, with x
& y
increasing to the right, and down, respectively.
sourcepub fn get_pixel(&self, x_coord: usize, y_coord: usize) -> RGB8
pub fn get_pixel(&self, x_coord: usize, y_coord: usize) -> RGB8
Return a tuple of an individual pixel’s RGB value.
The origin ((0, 0)
) is the top-left of the display, with x
& y
increasing to the right, and down, respectively.
NOTE: This returns what’s in the display buffer, not what the physical pixel is set to.
sourcepub fn clear_pixels(&mut self)
pub fn clear_pixels(&mut self)
Clear the internal buffer of pixel states.
To clear the display itself, you’ll still need to call
display
to update the Unicorn HAT HD.
Trait Implementations
sourceimpl Default for UnicornHatHd
impl Default for UnicornHatHd
sourcefn default() -> UnicornHatHd
fn default() -> UnicornHatHd
Create a UnicornHatHd
using the default Bus::Spi0
and SlaveSelect::Ss0
.
This will panic if initialization fails.
Auto Trait Implementations
impl RefUnwindSafe for UnicornHatHd
impl Send for UnicornHatHd
impl !Sync for UnicornHatHd
impl Unpin for UnicornHatHd
impl UnwindSafe for UnicornHatHd
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more