Trait vga_framebuffer::Hardware [−][src]
pub trait Hardware {
fn configure(
&mut self,
width: u32,
sync_end: u32,
line_start: u32,
clock_rate: u32
);
fn vsync_on(&mut self);
fn vsync_off(&mut self);
fn write_pixels(&mut self, red: u32, green: u32, blue: u32);
}Implement this on your microcontroller's timer object.
Required Methods
fn configure(
&mut self,
width: u32,
sync_end: u32,
line_start: u32,
clock_rate: u32
)
&mut self,
width: u32,
sync_end: u32,
line_start: u32,
clock_rate: u32
)
Called at start-up to configure timer.
The timer must be periodic, with period width, which is measured
clock ticks (or VGA pixels), assuming the given clock rate. If you
have a clock that runs at half the given rate, then double the given
values.
You will receive calls to write_pixels as pixels are generated. Do
not emit any pixels until the line_start timer elapses (store them
in a FIFO).
The H-Sync pin must rise at the start of the loop and fall after
sync_end clock ticks. We don't control it here because that would
add too much latency - you must change the H-Sync GPIO pin early in
the ISR yourself.
V-Sync is controlled by the current line number; you should implement
vsync_on and vsync_off which this code will call at the
appropriate time.
width- length of a line (inclock_ratepixels)sync_end- elapsed time (inclock_ratepixels) before H-Sync needs to fallline_start- elapsed time (inclock_ratepixels) before line_start ISR needs to fireclock_rate- the pixel clock rate in Hz (e.g. 40_000_000 for 40 MHz)
fn vsync_on(&mut self)
Called when V-Sync needs to be high.
fn vsync_off(&mut self)
Called when V-Sync needs to be low.
fn write_pixels(&mut self, red: u32, green: u32, blue: u32)
Called word by word as pixels are calculated