Struct uc8151::Uc8151

source ·
pub struct Uc8151<SPI, CS, DC, BUSY, RESET> {
    pub spi: SPI,
    pub cs: CS,
    pub dc: DC,
    pub busy: BUSY,
    pub reset: RESET,
    pub lut: LUT,
    /* private fields */
}
Expand description

Uc8151 driver

Fields§

§spi: SPI§cs: CS§dc: DC§busy: BUSY§reset: RESET§lut: LUT

Implementations§

source§

impl<SPI, CS, DC, BUSY, RESET> Uc8151<SPI, CS, DC, BUSY, RESET>where SPI: Write<u8>, CS: OutputPin, DC: OutputPin, BUSY: InputPin, RESET: OutputPin,

source

pub fn new(spi: SPI, cs: CS, dc: DC, busy: BUSY, reset: RESET) -> Self

Create new UC8151 instance from the given SPI and GPIO pins

source

pub fn enable(&mut self)

Enable the display controller

source

pub fn disable(&mut self)

Disable the display controller

source

pub fn is_busy(&self) -> bool

Returns true if the display controller is busy

source

pub fn get_lut(&self) -> &'static Lut

Return the currently selected LUT

source

pub fn get_update_speed(&self) -> &Lut

Return the currently update speed

source

pub fn get_update_time(&self) -> u16

Return the update interval for the current LUT

source

pub fn reset(&mut self, delay_source: &mut impl DelayUs<u32>)

Reset the display

source

pub fn command( &mut self, reg: Instruction, data: &[u8] ) -> Result<(), SpiDataError>

Send command via SPI to the display

source

pub fn data(&mut self, data: &[u8]) -> Result<(), SpiDataError>

Send data via SPI to the display

source

pub fn transmit_framebuffer(&mut self) -> Result<(), SpiDataError>

Send framebuffer to display via SPI. This is a low-level function, call update() if you just want to update the display

source

pub fn transmit_framebuffer_range( &mut self, range: Range<usize> ) -> Result<(), SpiDataError>

Transmits a subset of the framebuffer via SPI. Call partial_update if you are looking to update a partial area of the display.

source

pub fn setup( &mut self, delay_source: &mut impl DelayUs<u32>, speed: LUT ) -> Result<(), SpiDataError>

Configure the display

source

pub fn invert_colors(&mut self, inverted: bool) -> Result<(), SpiDataError>

Invert the colors of the screen - normal = black on white, inverted = white on black

source

pub fn off(&mut self) -> Result<(), SpiDataError>

Ask the display to power itself off

source

pub fn pixel(&mut self, x: u32, y: u32, v: bool)

Set or clear the specified pixel

source

pub fn update(&mut self) -> Result<(), SpiDataError>

Refresh the display with what is in the framebuffer

source

pub fn partial_update( &mut self, region: UpdateRegion ) -> Result<(), SpiDataError>

Peform a partial refresh of the display over the area defined by the DisplayRegion.

Trait Implementations§

source§

impl<SPI, CS, DC, BUSY, RESET> DrawTarget for Uc8151<SPI, CS, DC, BUSY, RESET>where SPI: Write<u8>, CS: OutputPin, DC: OutputPin, BUSY: InputPin, RESET: OutputPin,

§

type Color = BinaryColor

The pixel color type the targetted display supports.
§

type Error = Infallible

Error type to return when a drawing operation fails. Read more
source§

fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>where I: IntoIterator<Item = Pixel<Self::Color>>,

Draw individual pixels to the display without a defined order. Read more
source§

fn fill_contiguous<I>( &mut self, area: &Rectangle, colors: I ) -> Result<(), Self::Error>where I: IntoIterator<Item = Self::Color>,

Fill a given area with an iterator providing a contiguous stream of pixel colors. Read more
source§

fn fill_solid( &mut self, area: &Rectangle, color: Self::Color ) -> Result<(), Self::Error>

Fill a given area with a solid color. Read more
source§

fn clear(&mut self, color: Self::Color) -> Result<(), Self::Error>

Fill the entire display with a solid color. Read more
source§

impl<SPI, CS, DC, BUSY, RESET> OriginDimensions for Uc8151<SPI, CS, DC, BUSY, RESET>where SPI: Write<u8>, CS: OutputPin, DC: OutputPin, BUSY: InputPin, RESET: OutputPin,

source§

fn size(&self) -> Size

Returns the size of the bounding box.

Auto Trait Implementations§

§

impl<SPI, CS, DC, BUSY, RESET> RefUnwindSafe for Uc8151<SPI, CS, DC, BUSY, RESET>where BUSY: RefUnwindSafe, CS: RefUnwindSafe, DC: RefUnwindSafe, RESET: RefUnwindSafe, SPI: RefUnwindSafe,

§

impl<SPI, CS, DC, BUSY, RESET> Send for Uc8151<SPI, CS, DC, BUSY, RESET>where BUSY: Send, CS: Send, DC: Send, RESET: Send, SPI: Send,

§

impl<SPI, CS, DC, BUSY, RESET> Sync for Uc8151<SPI, CS, DC, BUSY, RESET>where BUSY: Sync, CS: Sync, DC: Sync, RESET: Sync, SPI: Sync,

§

impl<SPI, CS, DC, BUSY, RESET> Unpin for Uc8151<SPI, CS, DC, BUSY, RESET>where BUSY: Unpin, CS: Unpin, DC: Unpin, RESET: Unpin, SPI: Unpin,

§

impl<SPI, CS, DC, BUSY, RESET> UnwindSafe for Uc8151<SPI, CS, DC, BUSY, RESET>where BUSY: UnwindSafe, CS: UnwindSafe, DC: UnwindSafe, RESET: UnwindSafe, SPI: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dstwhere T: Cast<Dst>,

Casts the value.
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Src, Dst> CastFrom<Src> for Dstwhere Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
source§

impl<T> Dimensions for Twhere T: OriginDimensions,

source§

fn bounding_box(&self) -> Rectangle

Returns the bounding box.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dstwhere T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dstwhere T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dstwhere T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.