pub struct Sweep(/* private fields */);Expand description
Channel 1 frequency sweep (NR10).
| Bit | Field | Access | Meaning |
|---|---|---|---|
| 7 | — | Unused. | |
| 6-4 | pace | R/W | An iteration every pace 128 Hz ticks; 0 disables the sweep. |
| 3 | subtract | R/W | Period direction: clear adds, set subtracts. |
| 2-0 | step | R/W | Shift applied to the period each iteration. |
Implementations§
Source§impl Sweep
impl Sweep
Sourcepub const fn with_step_checked(self, value: u8) -> Result<Self, ()>
pub const fn with_step_checked(self, value: u8) -> Result<Self, ()>
Step: shift applied to the period each iteration.
Bits: 0..3
Sourcepub const fn with_step(self, value: u8) -> Self
pub const fn with_step(self, value: u8) -> Self
Step: shift applied to the period each iteration.
Bits: 0..3
Sourcepub const fn set_step(&mut self, value: u8)
pub const fn set_step(&mut self, value: u8)
Step: shift applied to the period each iteration.
Bits: 0..3
Sourcepub const fn set_step_checked(&mut self, value: u8) -> Result<(), ()>
pub const fn set_step_checked(&mut self, value: u8) -> Result<(), ()>
Step: shift applied to the period each iteration.
Bits: 0..3
Sourcepub const fn subtract(&self) -> bool
pub const fn subtract(&self) -> bool
Direction: false adds to the period, true subtracts.
Bits: 3..4
Sourcepub const fn with_subtract_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_subtract_checked(self, value: bool) -> Result<Self, ()>
Direction: false adds to the period, true subtracts.
Bits: 3..4
Sourcepub const fn with_subtract(self, value: bool) -> Self
pub const fn with_subtract(self, value: bool) -> Self
Direction: false adds to the period, true subtracts.
Bits: 3..4
Sourcepub const fn set_subtract(&mut self, value: bool)
pub const fn set_subtract(&mut self, value: bool)
Direction: false adds to the period, true subtracts.
Bits: 3..4
Sourcepub const fn set_subtract_checked(&mut self, value: bool) -> Result<(), ()>
pub const fn set_subtract_checked(&mut self, value: bool) -> Result<(), ()>
Direction: false adds to the period, true subtracts.
Bits: 3..4
Sourcepub const fn pace(&self) -> u8
pub const fn pace(&self) -> u8
Pace: an iteration every pace 128 Hz ticks (0 disables sweep).
Bits: 4..7
Sourcepub const fn with_pace_checked(self, value: u8) -> Result<Self, ()>
pub const fn with_pace_checked(self, value: u8) -> Result<Self, ()>
Pace: an iteration every pace 128 Hz ticks (0 disables sweep).
Bits: 4..7
Sourcepub const fn with_pace(self, value: u8) -> Self
pub const fn with_pace(self, value: u8) -> Self
Pace: an iteration every pace 128 Hz ticks (0 disables sweep).
Bits: 4..7