embassy-stm32

Crates

git

Versions

stm32u073m8

Flavors

Lcd

Struct Lcd 

Source
pub struct Lcd<'d, T: Instance> { /* private fields */ }
Expand description

LCD driver.

Implementations§

Source§

impl<'d, T: Instance> Lcd<'d, T>

Source

pub fn new<const N: usize>( _peripheral: Peri<'d, T>, config: Config, vlcd_pin: Peri<'_, impl VlcdPin<T>>, pins: [LcdPin<'d, T>; N], ) -> Self

Initialize the lcd driver.

The pins parameter must contain all segment and com pins that are connected to the LCD. This is not further checked by this driver. Pins not routed to the LCD can be used for other purposes.

Source

pub fn set_contrast_control(&mut self, value: u8)

Change the contrast by changing the voltage being used.

This is from low at 0 to high at 7.

Source

pub fn set_dead_time(&mut self, value: u8)

Change the contrast by introducing a deadtime to the signals where the voltages are held at 0V.

This is from no dead time at 0 to high dead time at 7.

Source

pub fn write_com_segments(&mut self, com_index: u8, segments: u64)

Write data into the display RAM. This overwrites the data already in it for the specified com index.

The com_index value determines which part of the RAM is written to. The segments value is a bitmap where each bit represents whether a pixel is turned on or off.

This function waits last update request to be finished, but does not submit the buffer to the LCD with a new request. Submission has to be done manually using Self::submit_frame.

Source

pub fn read_com_segments(&self, com_index: u8) -> u64

Read the data from the display RAM.

The com_index value determines which part of the RAM is read from.

This function waits for the last update request to be finished.

Source

pub fn submit_frame(&mut self)

Submit the current RAM data to the LCD.

This function waits until the RAM is writable, but does not wait for the frame to be drawn.

Source

pub fn num_segments(&self) -> u8

Get the number of segments that are supported on this LCD

Source

pub fn segment_pixel_mask(&self) -> u64

Get the pixel mask for the current LCD setup. This is a mask of all bits that are allowed to be set in the Self::write_com_segments function.

Source

pub fn num_com_pins(&self) -> u8

Get the number of COM pins that were configured through the Drive config

Set the blink behavior on some pixels.

The blink frequency is an approximation. It’s divided from the clock selected by the FPS. Play with the FPS value if you want the blink frequency to be more accurate.

If a blink frequency cannot be attained, this function will panic.

Trait Implementations§

Source§

impl<'d, T: Instance> Drop for Lcd<'d, T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'d, T> Freeze for Lcd<'d, T>

§

impl<'d, T> RefUnwindSafe for Lcd<'d, T>
where T: RefUnwindSafe,

§

impl<'d, T> Send for Lcd<'d, T>
where T: Send,

§

impl<'d, T> Sync for Lcd<'d, T>
where T: Sync,

§

impl<'d, T> Unpin for Lcd<'d, T>

§

impl<'d, T> !UnwindSafe for Lcd<'d, T>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.