pub struct Display {
pub width: u8,
pub height: u8,
pub dc_pin: OutputPin,
pub cs_pin: OutputPin,
pub rst_pin: OutputPin,
pub bl_pin: OutputPin,
pub protocol: Protocol,
pub bus: Spi,
pub memory: Buffer,
}
Fields§
§width: u8
§height: u8
§dc_pin: OutputPin
§cs_pin: OutputPin
§rst_pin: OutputPin
§bl_pin: OutputPin
§protocol: Protocol
§bus: Spi
§memory: Buffer
Implementations§
Source§impl Display
impl Display
Sourcepub fn write_command(&mut self, byte: &[u8]) -> Result<()>
pub fn write_command(&mut self, byte: &[u8]) -> Result<()>
Write a command byte to the device. The byte should be of the type &[u8]
. The DC pin is
set low to indicate that the byte being written is a command byte.
Sourcepub fn write_data(&mut self, byte: &[u8]) -> Result<()>
pub fn write_data(&mut self, byte: &[u8]) -> Result<()>
Write a data byte to the device. The byte should be of the type &[u8]
. The DC pin is set
high to indicate that the byte being written is a data byte
Sourcepub fn spi_write_byte(&mut self, byte: &[u8]) -> Result<()>
pub fn spi_write_byte(&mut self, byte: &[u8]) -> Result<()>
Raw SPI write byte function. DO NOT USE. use write_command
or write_data
instead.
Sourcepub fn i2c_write_byte(&self, _byte: &[u8]) -> Result<()>
pub fn i2c_write_byte(&self, _byte: &[u8]) -> Result<()>
TODO: Add Support for I2C
Sourcepub fn render(&mut self) -> Result<()>
pub fn render(&mut self) -> Result<()>
The Graphics buffer is stored in the Display { memory: Vec<u8> }
field. The
ws_oled_driver::gfx
library functions work on the memory field. It writes the pixes onto the
memory field. The render
function dumps the memory
field onto the display.
Examples found in repository?
More examples
Sourcepub fn initialize(&mut self) -> Result<()>
pub fn initialize(&mut self) -> Result<()>
Initializes the display device.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Display
impl !RefUnwindSafe for Display
impl Send for Display
impl !Sync for Display
impl Unpin for Display
impl !UnwindSafe for Display
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more