Struct vga_framebuffer::FrameBuffer [−][src]
pub struct FrameBuffer<'a, T> where
T: Hardware, { /* fields omitted */ }
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.
Methods
impl<'a, T> FrameBuffer<'a, T> where
T: Hardware,
[src]
impl<'a, T> FrameBuffer<'a, T> where
T: Hardware,
pub const fn new() -> FrameBuffer<'a, T>
[src]
pub const fn new() -> FrameBuffer<'a, T>
Create a new FrameBuffer
pub fn init(&mut self, hw: T)
[src]
pub fn init(&mut self, hw: T)
Initialise the hardware (by calling the configure
callback).
pub fn mode2(&mut self, buffer: &'a mut [u8], start_line: usize)
[src]
pub fn mode2(&mut self, buffer: &'a mut [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 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)
[src]
pub fn mode2_shift(&mut self, new_start_line: usize)
pub fn mode2_release(&mut self) -> Option<(&'a mut [u8], usize)>
[src]
pub fn mode2_release(&mut self) -> Option<(&'a mut [u8], usize)>
Releases the memory for mode2. The rendering code may keep reading this memory buffer up until the end of the frame.
pub fn frame(&self) -> usize
[src]
pub fn frame(&self) -> usize
Returns the current frame number.
pub fn line(&self) -> Option<usize>
[src]
pub fn line(&self) -> Option<usize>
Returns the current visible line number or None in the blanking period.
pub fn total_line(&self) -> u64
[src]
pub fn total_line(&self) -> u64
Returns the number of lines since startup.
pub fn isr_sol(&mut self)
[src]
pub fn isr_sol(&mut self)
Call this at the start of every line.
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
Clears the screen and resets the cursor to 0,0.
pub fn write_glyph_at(&mut self, glyph: Char, pos: Position, attr: Option<Attr>)
[src]
pub fn write_glyph_at(&mut self, glyph: Char, pos: Position, attr: Option<Attr>)
Puts a glyph on screen at the specified place
pub fn write_glyph(&mut self, glyph: Char, attr: Option<Attr>)
[src]
pub fn write_glyph(&mut self, glyph: Char, attr: Option<Attr>)
Puts a glyph on screen at the current position.
pub fn set_attr_at(&mut self, pos: Position, attr: Attr)
[src]
pub fn set_attr_at(&mut self, pos: Position, attr: Attr)
Changes the attribute for a given position, leaving the glyph unchanged.
pub fn set_attr(&mut self, attr: Attr) -> Attr
[src]
pub fn set_attr(&mut self, attr: Attr) -> Attr
Change the current character attribute
pub fn get_attr(&mut self) -> Attr
[src]
pub fn get_attr(&mut self) -> Attr
Get the current character attribute
Trait Implementations
impl<'a, T> BaseConsole for FrameBuffer<'a, T> where
T: Hardware,
[src]
impl<'a, T> BaseConsole for FrameBuffer<'a, T> where
T: Hardware,
type Error = ()
fn get_width(&self) -> Col
[src]
fn get_width(&self) -> Col
Gets the last col on the screen.
fn get_height(&self) -> Row
[src]
fn get_height(&self) -> Row
Gets the last row on the screen.
fn set_col(&mut self, col: Col) -> Result<(), Self::Error>
[src]
fn set_col(&mut self, col: Col) -> Result<(), Self::Error>
Set the horizontal position for the next text output.
fn set_row(&mut self, row: Row) -> Result<(), Self::Error>
[src]
fn set_row(&mut self, row: Row) -> Result<(), Self::Error>
Set the vertical position for the next text output.
fn set_pos(&mut self, pos: Position) -> Result<(), Self::Error>
[src]
fn set_pos(&mut self, pos: Position) -> Result<(), Self::Error>
Set the horizontal and vertical position for the next text output.
fn get_pos(&self) -> Position
[src]
fn get_pos(&self) -> Position
Get the current screen position.
fn set_control_char_mode(&mut self, mode: ControlCharMode)
[src]
fn set_control_char_mode(&mut self, mode: ControlCharMode)
Set the control char mode
fn get_control_char_mode(&self) -> ControlCharMode
[src]
fn get_control_char_mode(&self) -> ControlCharMode
Get the current control char mode
fn set_escape_char_mode(&mut self, mode: EscapeCharMode)
[src]
fn set_escape_char_mode(&mut self, mode: EscapeCharMode)
Set the escape char mode
fn get_escape_char_mode(&self) -> EscapeCharMode
[src]
fn get_escape_char_mode(&self) -> EscapeCharMode
Get the current escape char mode
fn scroll_screen(&mut self) -> Result<(), Self::Error>
[src]
fn scroll_screen(&mut self) -> Result<(), Self::Error>
Called when the screen needs to scroll up one row.
fn set_pos_unbounded(&mut self, pos: Position)
[src]
fn set_pos_unbounded(&mut self, pos: Position)
Set the horizontal and vertical position for the next text output. Don't bounds check the value, we've already done it. Read more
fn move_cursor_right(&mut self) -> Result<(), Self::Error>
[src]
fn move_cursor_right(&mut self) -> Result<(), Self::Error>
Move the current cursor right one position. Wraps at the end of the line. Returns Ok(true) if the screen needs to scroll, or Ok(false) if it does not. Read more
impl<'a, T> AsciiConsole for FrameBuffer<'a, T> where
T: Hardware,
[src]
impl<'a, T> AsciiConsole for FrameBuffer<'a, T> where
T: Hardware,
fn handle_escape(&mut self, escaped_char: u8) -> bool
[src]
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.
fn write_char_at(&mut self, ch: u8, pos: Position) -> Result<(), Self::Error>
[src]
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.
fn write_string(&mut self, s: &[u8]) -> Result<(), Self::Error>
[src]
fn write_string(&mut self, s: &[u8]) -> Result<(), Self::Error>
Write an 8-bit string to the screen at the given position. Updates the current position to the end of the string. Strings will wrap across the end of the screen and scroll the screen if they reach the bottom. Read more
fn write_character(&mut self, ch: u8) -> Result<(), Self::Error>
[src]
fn write_character(&mut self, ch: u8) -> Result<(), Self::Error>
Write a single 8-bit char to the screen at the current position.
fn write_string_at(
&mut self,
s: &[u8],
pos: Position
) -> Result<(), Self::Error>
[src]
fn write_string_at(
&mut self,
s: &[u8],
pos: Position
) -> Result<(), Self::Error>
Write an 8-bit string to the screen at the given position. Updates the current position to the end of the string. Strings will wrap across the end of the screen and scroll the screen if they reach the bottom. Read more
fn is_special(&self, ch: u8) -> Option<SpecialChar>
[src]
fn is_special(&self, ch: u8) -> Option<SpecialChar>
Check if an 8-bit char is special
impl<'a, T> Write for FrameBuffer<'a, T> where
T: Hardware,
[src]
impl<'a, T> Write for FrameBuffer<'a, T> where
T: Hardware,
fn write_str(&mut self, s: &str) -> Result
[src]
fn write_str(&mut self, s: &str) -> Result
Writes a slice of bytes into this writer, returning whether the write succeeded. Read more
fn write_char(&mut self, c: char) -> Result<(), Error>
1.1.0[src]
fn write_char(&mut self, c: char) -> Result<(), Error>
Writes a [char
] into this writer, returning whether the write succeeded. Read more
fn write_fmt(&mut self, args: Arguments) -> Result<(), Error>
1.0.0[src]
fn write_fmt(&mut self, args: Arguments) -> Result<(), Error>
Glue for usage of the [write!
] macro with implementors of this trait. Read more
Auto Trait Implementations
impl<'a, T> Send for FrameBuffer<'a, T> where
T: Send,
impl<'a, T> Send for FrameBuffer<'a, T> where
T: Send,
impl<'a, T> Sync for FrameBuffer<'a, T> where
T: Sync,
impl<'a, T> Sync for FrameBuffer<'a, T> where
T: Sync,