pub struct Builder<'a> { /* private fields */ }
Expand description
Builder for constructing a display Config.
Dimensions must supplied, all other settings will use a default value if not supplied. However it’s likely that LUT values will need to be supplied to successfully use a display.
Example
use ssd1675::{Builder, Dimensions, Rotation};
let config = Builder::new()
.dimensions(Dimensions {
rows: 212,
cols: 104,
})
.rotation(Rotation::Rotate270)
.build()
.expect("invalid configuration");
Implementations
sourceimpl<'a> Builder<'a>
impl<'a> Builder<'a>
sourcepub fn dummy_line_period(self, dummy_line_period: u8) -> Self
pub fn dummy_line_period(self, dummy_line_period: u8) -> Self
Set the number of dummy line period in terms of gate line width (TGate).
Defaults to 0x07. Corresponds to command 0x3A.
sourcepub fn gate_line_width(self, gate_line_width: u8) -> Self
pub fn gate_line_width(self, gate_line_width: u8) -> Self
Set the gate line width (TGate).
Defaults to 0x04. Corresponds to command 0x3B.
sourcepub fn vcom(self, value: u8) -> Self
pub fn vcom(self, value: u8) -> Self
Set VCOM register value.
Defaults to 0x3C. Corresponds to command 0x2C.
sourcepub fn lut(self, lut: &'a [u8]) -> Self
pub fn lut(self, lut: &'a [u8]) -> Self
Set lookup table (70 bytes).
Note: The supplied slice must be exactly 70 bytes long.
There is no default for the lookup table. Corresponds to command 0x32. If not supplied then the default in the controller is used. Apparently the display manufacturer will normally supply the LUT values for a particular display batch.
sourcepub fn data_entry_mode(
self,
data_entry_mode: DataEntryMode,
increment_axis: IncrementAxis
) -> Self
pub fn data_entry_mode(
self,
data_entry_mode: DataEntryMode,
increment_axis: IncrementAxis
) -> Self
Define data entry sequence.
Defaults to DataEntryMode::IncrementAxis, IncrementAxis::Horizontal. Corresponds to command 0x11.
sourcepub fn dimensions(self, dimensions: Dimensions) -> Self
pub fn dimensions(self, dimensions: Dimensions) -> Self
Set the display dimensions.
There is no default for this setting. The dimensions must be set for the builder to successfully build a Config.
sourcepub fn rotation(self, rotation: Rotation) -> Self
pub fn rotation(self, rotation: Rotation) -> Self
Set the display rotation.
Defaults to no rotation (Rotation::Rotate0
). Use this to translate between the physical
rotation of the display and how the data is displayed on the display.
sourcepub fn build(self) -> Result<Config<'a>, BuilderError>
pub fn build(self) -> Result<Config<'a>, BuilderError>
Build the display Config.
Will fail if dimensions are not set.
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Builder<'a>
impl<'a> Send for Builder<'a>
impl<'a> Sync for Builder<'a>
impl<'a> Unpin for Builder<'a>
impl<'a> UnwindSafe for Builder<'a>
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
sourceimpl<T> CheckedAs for T
impl<T> CheckedAs for T
sourcefn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
sourcefn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
sourceimpl<T> OverflowingAs for T
impl<T> OverflowingAs for T
sourcefn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
sourcefn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
OverflowingCasts the value.
sourceimpl<T> SaturatingAs for T
impl<T> SaturatingAs for T
sourcefn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
sourcefn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
sourcefn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
sourcefn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
UnwrappedCasts the value.
sourceimpl<T> WrappingAs for T
impl<T> WrappingAs for T
sourcefn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
sourcefn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
WrappingCasts the value.