[−][src]Crate rubidium
GBA Memory-mapped IO (MMIO) stuff.
The standard resource on how a GBA works is of course GBATEK, so if something isn't explained here you can also try there.
The GBA is controlled via MMIO. An MMIO location is called a "register", similar to the CPU having registers. The different registers are all globally accessible, so user code must have its own convention for who is supposed to touch what values when.
Crate Conventions
For each register, there is a named constant that gives the address of the
register wrapped in a Rust newtype. The names are generally the same, as or
close to, the GBATEK names for that register. The address newtype used
depends on how you're allowed to interact with the registers. Most MMIO
registers are fully safe to interact with, though perhaps they are read-only
or write-only. The DMA and interrupt registers are unsafe
to write to,
even when carefully wrapped for ease of use within Rust.
The actual data stored in a register is generally 16-bit or 32-bit.
Sometimes it's actually supposed to be interpreted as a signed or unsigned
integer, but usually it's a number of settings packed into the bits
available. In this case, a newtype is provided to make the bit packing easy.
For each setting foo
there will be:
- A const "getter" named
foo
. - A const "with-er"
with_foo
which takesself
and returns a new value. - A "setter"
set_foo
which takes&mut self
and updates the value in place. Hopefully this will also be const in a future version of Rust.
Structs
DangerWriteVolAddr | Represents an MMIO address that can be safely read, but writes are dangerous. |
DisplayControlValue | Top level control for the LCD display. |
DisplayStatusValue | Relates to the status of the display. |
ReadOnlyVolAddr | Represents an MMIO address that can be safely read, but not written. |
SimpleVolAddr | Represents a simple MMIO address that can be safely read or written. |
VideoMode | The video modes available on the GBA. |
Constants
DISPCNT | "Display Control" |
DISPSTAT | "Display Status" |
VCOUNT | "Vertical Counter" |