[][src]Crate rubidium

GBA Memory-mapped IO (MMIO) stuff.

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.

This crate defines newtypes that describe the data layout of each register, and if you enable the unsafe_addresses feature it also defines the addresses of each register. The address type used for each register lets you know about the safety (or not) of accessing a given register. The safety assessment relies on the code being run only on a GBA, so if you use this crate on your desktop or something that's your fault.

This is only "work in progress" status, but please file an issue if things are unclear. While you're waiting you can also check GBATEK, which is the standard resource for GBA info (and it's most of where this crate's docs come from).

Naming Conventions

The names used for the address of each register is generally the same as, or close to, the the name given for that register in GBATEK.

For each setting within a register data newtype there will be three methods per setting contained within the newtype:

  • A const "getter" named the same as the setting (eg: foo).
  • A const "with-er" which takes self and returns a new value (eg: with_foo).
  • A "setter" which takes &mut self and updates the value in place (eg: set_foo). This will hopefully also be const in a future version of Rust.

Structs

BackgroundControlValue

Lets you adjust how each background layer is displayed.

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

BG0CNT

"Background 0 Control"

BG1CNT

"Background 1 Control"

BG2CNT

"Background 2 Control"

BG3CNT

"Background 3 Control"

DISPCNT

"Display Control"

DISPSTAT

"Display Status"

VCOUNT

"Vertical Counter"