#[repr(C)]pub struct FrameBuffer<T>where
T: Hardware,{ /* private fields */ }
Expand description
This structure represents the framebuffer - a 2D array of monochome pixels.
The framebuffer is stored as an array of horizontal lines, where each line is comprised of 8 bit words. This suits our timing needs as although the SPI peripheral on an LM4F120 which can emit 16 bits at a time, 8 proves easier to work with.
Implementations§
Source§impl<T> FrameBuffer<T>where
T: Hardware,
impl<T> FrameBuffer<T>where
T: Hardware,
pub fn new() -> FrameBuffer<T>
pub fn borrow_hw_mut(&mut self) -> Option<&mut T>
pub fn borrow_hw(&self) -> Option<&T>
pub fn set_cursor_visible(&mut self, visible: bool)
Sourcepub fn mode2(&mut self, buffer: &[u8], start_line: usize)
pub fn mode2(&mut self, buffer: &[u8], start_line: usize)
Enable mode2 - a 1-bit-per-pixel graphical buffer which is coloured according to the colour attributes for the matching text cells. Supply a u8 slice that is some multiple of MODE0_USABLE_HORIZONTAL_OCTETS long. The buffer will be line-doubled and so can be up to 288 lines long.
pub fn mode2_shift(&mut self, new_start_line: usize)
Sourcepub fn mode2_release(&mut self)
pub fn mode2_release(&mut self)
Releases the memory for mode2. The rendering code may keep reading this memory buffer up until the end of the frame.
pub fn map_line(&mut self, visible_line: u16, rendered_line: u16)
Sourcepub fn line(&self) -> Option<usize>
pub fn line(&self) -> Option<usize>
Returns the current visible line number or None in the blanking period.
Sourcepub fn total_line(&self) -> u64
pub fn total_line(&self) -> u64
Returns the number of lines since startup.
Sourcepub fn set_custom_font(&mut self, new_font: Option<&'static [u8]>)
pub fn set_custom_font(&mut self, new_font: Option<&'static [u8]>)
Change the current font
Sourcepub fn write_glyph_at(&mut self, glyph: Char, pos: Position, attr: Option<Attr>)
pub fn write_glyph_at(&mut self, glyph: Char, pos: Position, attr: Option<Attr>)
Puts a glyph on screen at the specified place
Sourcepub fn read_glyph_at(&mut self, pos: Position) -> Option<(Char, Attr)>
pub fn read_glyph_at(&mut self, pos: Position) -> Option<(Char, Attr)>
Read a glyph on screen at the specified place
Sourcepub fn write_glyph(&mut self, glyph: Char, attr: Option<Attr>)
pub fn write_glyph(&mut self, glyph: Char, attr: Option<Attr>)
Puts a glyph on screen at the current position.
Sourcepub fn write_char(&mut self, ch: u8, attr: Option<Attr>)
pub fn write_char(&mut self, ch: u8, attr: Option<Attr>)
Write a single Unicode char to the screen at the current position.
Sourcepub fn set_attr_at(&mut self, pos: Position, attr: Attr)
pub fn set_attr_at(&mut self, pos: Position, attr: Attr)
Changes the attribute for a given position, leaving the glyph unchanged.
Sourcepub fn set_line_mode_at(&mut self, row: Row, double_height: DoubleHeightMode)
pub fn set_line_mode_at(&mut self, row: Row, double_height: DoubleHeightMode)
Change font height for a given line.
Sourcepub fn set_line_mode(&mut self, double_height: DoubleHeightMode)
pub fn set_line_mode(&mut self, double_height: DoubleHeightMode)
Change font height for the current line.
Trait Implementations§
Source§impl<T> AsciiConsole for FrameBuffer<T>where
T: Hardware,
impl<T> AsciiConsole for FrameBuffer<T>where
T: Hardware,
Source§fn handle_escape(&mut self, escaped_char: u8) -> bool
fn handle_escape(&mut self, escaped_char: u8) -> bool
Handle an escape char. We take a, b, c, d, e, f, g, h as being a background colour and A..H as being a foreground colour. ‘Z’ means clear the screen.
Source§fn write_char_at(&mut self, ch: u8, pos: Position) -> Result<(), Self::Error>
fn write_char_at(&mut self, ch: u8, pos: Position) -> Result<(), Self::Error>
Write a single Unicode char to the screen at the given position without updating the current position.
Source§fn write_string(&mut self, s: &[u8]) -> Result<(), Self::Error>
fn write_string(&mut self, s: &[u8]) -> Result<(), Self::Error>
Source§fn write_character(&mut self, ch: u8) -> Result<(), Self::Error>
fn write_character(&mut self, ch: u8) -> Result<(), Self::Error>
Source§fn write_string_at(
&mut self,
s: &[u8],
pos: Position,
) -> Result<(), Self::Error>
fn write_string_at( &mut self, s: &[u8], pos: Position, ) -> Result<(), Self::Error>
Source§fn is_special(&self, ch: u8) -> Option<SpecialChar>
fn is_special(&self, ch: u8) -> Option<SpecialChar>
Source§impl<T> BaseConsole for FrameBuffer<T>where
T: Hardware,
impl<T> BaseConsole for FrameBuffer<T>where
T: Hardware,
Source§fn get_height(&self) -> Row
fn get_height(&self) -> Row
Gets the last row on the screen.
Source§fn set_col(&mut self, col: Col) -> Result<(), Self::Error>
fn set_col(&mut self, col: Col) -> Result<(), Self::Error>
Set the horizontal position for the next text output.
Source§fn set_row(&mut self, row: Row) -> Result<(), Self::Error>
fn set_row(&mut self, row: Row) -> Result<(), Self::Error>
Set the vertical position for the next text output.
Source§fn set_pos(&mut self, pos: Position) -> Result<(), Self::Error>
fn set_pos(&mut self, pos: Position) -> Result<(), Self::Error>
Set the horizontal and vertical position for the next text output.
Source§fn set_control_char_mode(&mut self, mode: ControlCharMode)
fn set_control_char_mode(&mut self, mode: ControlCharMode)
Set the control char mode
Source§fn get_control_char_mode(&self) -> ControlCharMode
fn get_control_char_mode(&self) -> ControlCharMode
Get the current control char mode
Source§fn set_escape_char_mode(&mut self, mode: EscapeCharMode)
fn set_escape_char_mode(&mut self, mode: EscapeCharMode)
Set the escape char mode
Source§fn get_escape_char_mode(&self) -> EscapeCharMode
fn get_escape_char_mode(&self) -> EscapeCharMode
Get the current escape char mode
Source§fn scroll_screen(&mut self) -> Result<(), Self::Error>
fn scroll_screen(&mut self) -> Result<(), Self::Error>
Called when the screen needs to scroll up one row.