Crate vga_framebuffer[][src]

VGA Frame Buffer for Embedded Microcontrollers

Generates an 800 x 600 @ 60 Hz SVGA signal from a 48 column x 36 row monochrome text buffer. The image has a border.

TODO: Implement smooth scrolling in the vertical direction with an extra text row.

Width = 400 double width pixels => 400 = 8 + (48 x 8) + 8

Height = 600 pixels => 600 = 12 + (36 x 16) + 12

This example is not tested
<-------------- 400 px, pixel doubled to 800 px ------------->
+------------------------------------------------------------+
|<--> 8 pixel border     ^                8 pixel border <-->|
|                        | 12 px border                      |
|                        v                                   |
|    +--------------------------------------------------+    |
|    | <--^------ 48 chars x 8 px = 384  px ----------->|    |
|    |    |                                             |    |
|    |    |                                             |    |
|    |    | 36 rows x 16 px = 576 px                    |    |
|    |    |                                             |    |
|    |    |                                             |    |
|    |    v                                             |    |
|    +--------------------------------------------------+    |
|                          ^                                 |
|                          | 12 px border                    |
|                          v                                 |
+------------------------------------------------------------+

Requires pixels to be emitted with a 20 MHz pixel clock (against a nominal 40 MHz pixel clock, in order to acheive the horizontal doubling).

In order to maintain performance, only one font size is supported: 8x16 pixels. But you can substitute your own font if required (e.g. for Teletext support).

See https://github.com/thejpster/monotron for an example.

Re-exports

pub use console_traits::*;

Modules

freebsd_cp850
freebsd_teletext

Structs

Attr

This structure describes the attributes for a Char. They're all packed into 8 bits to save RAM.

FrameBuffer

This structure represents the framebuffer - a 2D array of monochome pixels.

Mode2

Represents Mode2 1-bpp graphics

Point

A point on the screen. The arguments are X (column), Y (row)

TextRow

Enums

Char

This MS-DOS CodePage 850. It offers a compromise between the box characters of CodePage 437 and the accents of ISO 8859-1 / Latin-1.

Colour
DoubleHeightMode

You can set this on a row to make the text double-height. This was common on the BBC Micro in Mode 7/Teletext mode.

Constants

HORIZONTAL_OCTETS

How many words in a line (including the border)

LEFT_RIGHT_BORDER_WIDTH
MAX_X

Highest X co-ord

MAX_Y

Highest Y co-ord

TEXT_MAX_COL

Highest X co-ord for text

TEXT_MAX_ROW

Highest Y co-ord for text

TEXT_NUM_COLS

How many characters in a row

TEXT_NUM_ROWS

How many rows of characters on the screen

TOP_BOTTOM_BORDER_HEIGHT

Top/bottom border height

USABLE_COLS

Number of columns in frame buffer

USABLE_HORIZONTAL_OCTETS

How many words in a line (excluding the border)

USABLE_LINES

Number of lines in frame buffer

USABLE_LINES_MODE2

Number of lines in the mode2 frame buffer (which is line-doubled)

Traits

Hardware

Implement this on your microcontroller's timer object.