Skip to main content

gb_pak/
rumble.rs

1//! The MBC5 rumble motor.
2//!
3//! The motor is one bit of the register that also selects the SRAM bank, so a
4//! cartridge with rumble reaches eight SRAM banks at most. That register cannot
5//! be read back, so this crate remembers both fields and writes them together,
6//! whichever one a call is changing.
7//!
8//! The bit drives the motor directly: it runs until switched off.
9//!
10//! ```ignore
11//! gb_pak::rumble::set(true);
12//! // ... some frames ...
13//! gb_pak::rumble::set(false);
14//! ```
15
16use crate::{reg};
17
18/// Start or stop the motor.
19#[inline]
20pub fn set(on: bool) {
21    reg::set_rumble(on);
22}