Struct unicorn_hat_hd::UnicornHatHd
[−]
[src]
pub struct UnicornHatHd { /* fields omitted */ }
Provide high-level access to the Unicorn HAT HD.
Methods
impl UnicornHatHd
[src]
fn new(spi_path: &str) -> Result<UnicornHatHd, Error>
[src]
Create a new UnicornHatHd
with the provided path
The Unicorn HAT HD should be addressable using the spidev device with the provided path
Typically, the path will be something like "/dev/spidev0.0"
where the first number if the bus and the second number
is the chip select on that bus for the device being targeted.
fn set_rotation(&mut self, rot: Rotate)
[src]
Rotate the display buffer by Rotate
degrees
before sending to the Unicorn HAT HD.
This allows for different mounting orientations of the Unicorn HAT HD
without having to translate the (x, y)
of each pixel to account for the
physical rotation of the display.
fn display(&mut self) -> Result<(), Error>
[src]
Write the display buffer to the Unicorn HAT HD.
fn set_pixel(&mut self, x: usize, y: usize, c: RGB8)
[src]
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.
fn get_pixel(&self, x: usize, y: usize) -> RGB8
[src]
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.
fn clear_pixels(&mut self)
[src]
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
impl Default for UnicornHatHd
[src]
fn default() -> UnicornHatHd
[src]
Create a UnicornHatHd
using the default path of "/dev/spidev0.0
".
This will panic if the default path is not usable.