Trait Hardware

Source
pub trait Hardware {
    // Required methods
    fn configure(&mut self, mode_info: &ModeInfo);
    fn vsync_on(&mut self);
    fn vsync_off(&mut self);
    fn write_pixels(&mut self, xrgb: XRGBColour);
}
Expand description

Implement this on your microcontroller’s timer object.

Required Methods§

Source

fn configure(&mut self, mode_info: &ModeInfo)

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.

Source

fn vsync_on(&mut self)

Called when V-Sync needs to be high.

Source

fn vsync_off(&mut self)

Called when V-Sync needs to be low.

Source

fn write_pixels(&mut self, xrgb: XRGBColour)

Called word by word as pixels are calculated

Implementors§