pub struct Lcd<'d, T: Instance> { /* private fields */ }Expand description
LCD driver.
Implementations§
Source§impl<'d, T: Instance> Lcd<'d, T>
impl<'d, T: Instance> Lcd<'d, T>
Sourcepub fn new<const N: usize>(
_peripheral: Peri<'d, T>,
config: Config,
vlcd_pin: Peri<'_, impl VlcdPin<T>>,
pins: [LcdPin<'d, T>; N],
) -> Self
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.
Sourcepub fn set_contrast_control(&mut self, value: u8)
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.
Sourcepub fn set_dead_time(&mut self, value: u8)
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.
Sourcepub fn write_com_segments(&mut self, com_index: u8, segments: u64)
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.
Sourcepub fn read_com_segments(&self, com_index: u8) -> u64
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.
Sourcepub fn submit_frame(&mut self)
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.
Sourcepub fn num_segments(&self) -> u8
pub fn num_segments(&self) -> u8
Get the number of segments that are supported on this LCD
Sourcepub fn segment_pixel_mask(&self) -> u64
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.
Sourcepub fn num_com_pins(&self) -> u8
pub fn num_com_pins(&self) -> u8
Get the number of COM pins that were configured through the Drive config
Sourcepub fn set_blink(&mut self, selector: BlinkSelector, freq: BlinkFreq)
pub fn set_blink(&mut self, selector: BlinkSelector, freq: BlinkFreq)
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.