Struct vga_framebuffer::FrameBuffer
[−]
[src]
pub struct FrameBuffer<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<T> FrameBuffer<T> where
T: Hardware,
[src]
T: Hardware,
pub const fn new() -> FrameBuffer<T>
[src]
Create a new FrameBuffer
pub fn init(&mut self, hw: T)
[src]
Initialise the hardware (by calling the configure
callback).
pub fn frame(&self) -> usize
[src]
Returns the current frame number.
pub fn isr_sol(&mut self)
[src]
Call this at the start of every line.
pub fn clear(&mut self)
[src]
Clears the screen and resets the cursor to 0,0.
pub fn write_glyph_at(
&mut self,
glyph: Glyph,
pos: Position,
attr: Option<Attr>
)
[src]
&mut self,
glyph: Glyph,
pos: Position,
attr: Option<Attr>
)
Puts a glyph on screen at the specified place
pub fn write_glyph(&mut self, glyph: Glyph, attr: Option<Attr>)
[src]
Puts a glyph on screen at the current position.
pub fn set_attr(&mut self, attr: Attr) -> Attr
[src]
Change the current character attribute
pub fn get_attr(&mut self) -> Attr
[src]
Get the current character attribute
Trait Implementations
impl<T> Console for FrameBuffer<T> where
T: Hardware,
[src]
T: Hardware,
type Error = ()
fn get_width(&self) -> Col
[src]
Gets the last col on the screen.
fn get_height(&self) -> Row
[src]
Gets the last row on the screen.
fn set_col(&mut self, col: Col) -> Result<(), Self::Error>
[src]
Set the horizontal position for the next text output.
fn set_row(&mut self, row: Row) -> Result<(), Self::Error>
[src]
Set the vertical position for the next text output.
fn set_pos(&mut self, pos: Position) -> Result<(), Self::Error>
[src]
Set the horizontal and vertical position for the next text output.
fn get_pos(&self) -> Position
[src]
Get the current screen position.
fn set_control_char_mode(&mut self, mode: ControlCharMode)
[src]
Set the control char mode
fn get_control_char_mode(&self) -> ControlCharMode
[src]
Get the current control char mode
fn set_escape_char_mode(&mut self, mode: EscapeCharMode)
[src]
Set the escape char mode
fn get_escape_char_mode(&self) -> EscapeCharMode
[src]
Get the current escape char mode
fn scroll_screen(&mut self) -> Result<(), Self::Error>
[src]
Called when the screen needs to scroll up one row.
fn handle_escape(&mut self, escaped_char: char) -> bool
[src]
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: char, pos: Position) -> Result<(), Self::Error>
[src]
Write a single Unicode char to the screen at the given position without updating the current position.
fn set_pos_unbounded(&mut self, pos: Position)
[src]
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 write_string(&mut self, str: &str) -> Result<(), Self::Error>
[src]
Write a 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_char(&mut self, ch: char) -> Result<(), Self::Error>
[src]
Write a single Unicode char to the screen at the current position.
fn write_string_at(
&mut self,
str: &str,
pos: Position
) -> Result<(), Self::Error>
[src]
&mut self,
str: &str,
pos: Position
) -> Result<(), Self::Error>
Write a 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 move_cursor_right(&mut self) -> Result<(), Self::Error>
[src]
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
fn is_special(&self, ch: char) -> Option<SpecialChar>
[src]
Check if a char is special
impl<T> Write for FrameBuffer<T> where
T: Hardware,
[src]
T: Hardware,
fn write_str(&mut self, s: &str) -> Result
[src]
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]
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]
Glue for usage of the [write!
] macro with implementors of this trait. Read more
Auto Trait Implementations
impl<T> Send for FrameBuffer<T> where
T: Send,
T: Send,
impl<T> Sync for FrameBuffer<T> where
T: Sync,
T: Sync,