Available on
gb_pak_tilt and crate feature pak only.Expand description
The MBC7 accelerometer.
Two axes of tilt, the only analogue input the console can read. The sensor measures gravity, so it reports which way the cartridge is leaning rather than how fast it is moving, and shaking it reads as noise.
A reading is latched before it can be read, the same way rtc does: write
0x55 to clear, then 0xAA to sample.
ⓘ
let t = gb_pak::tilt::read();
let lean = t.x.wrapping_sub(gb_pak::tilt::CENTRE) as i16;Structs§
- Tilt
- One latched pair of axes, as the sensor reports them.
Constants§
- CENTRE
- What each axis reads when the cartridge is level.
Functions§
- read
- Sample both axes.