pub struct PeriodCtrl(/* private fields */);Expand description
Period high bits and channel control (NR14 / NR24 / NR34).
| Bit | Field | Access | Meaning |
|---|---|---|---|
| 7 | trigger | W | (Re)start the channel. |
| 6 | length_enable | R/W | Stop the channel when the length timer expires. |
| 5-3 | — | Unused. | |
| 2-0 | period_high | W | Upper 3 bits of the 11-bit period (low 8 in NRx3). |
Implementations§
Source§impl PeriodCtrl
impl PeriodCtrl
Sourcepub const fn period_high(&self) -> u8
pub const fn period_high(&self) -> u8
Upper 3 bits of the 11-bit period (low 8 bits live in NRx3).
Bits: 0..3
Sourcepub const fn with_period_high_checked(self, value: u8) -> Result<Self, ()>
pub const fn with_period_high_checked(self, value: u8) -> Result<Self, ()>
Upper 3 bits of the 11-bit period (low 8 bits live in NRx3).
Bits: 0..3
Sourcepub const fn with_period_high(self, value: u8) -> Self
pub const fn with_period_high(self, value: u8) -> Self
Upper 3 bits of the 11-bit period (low 8 bits live in NRx3).
Bits: 0..3
Sourcepub const fn set_period_high(&mut self, value: u8)
pub const fn set_period_high(&mut self, value: u8)
Upper 3 bits of the 11-bit period (low 8 bits live in NRx3).
Bits: 0..3
Sourcepub const fn set_period_high_checked(&mut self, value: u8) -> Result<(), ()>
pub const fn set_period_high_checked(&mut self, value: u8) -> Result<(), ()>
Upper 3 bits of the 11-bit period (low 8 bits live in NRx3).
Bits: 0..3
Sourcepub const fn length_enable(&self) -> bool
pub const fn length_enable(&self) -> bool
Stop the channel when the length timer expires.
Bits: 6..7
Sourcepub const fn with_length_enable_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_length_enable_checked(self, value: bool) -> Result<Self, ()>
Stop the channel when the length timer expires.
Bits: 6..7
Sourcepub const fn with_length_enable(self, value: bool) -> Self
pub const fn with_length_enable(self, value: bool) -> Self
Stop the channel when the length timer expires.
Bits: 6..7
Sourcepub const fn set_length_enable(&mut self, value: bool)
pub const fn set_length_enable(&mut self, value: bool)
Stop the channel when the length timer expires.
Bits: 6..7
Sourcepub const fn set_length_enable_checked(&mut self, value: bool) -> Result<(), ()>
pub const fn set_length_enable_checked(&mut self, value: bool) -> Result<(), ()>
Stop the channel when the length timer expires.
Bits: 6..7
Sourcepub const fn with_trigger_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_trigger_checked(self, value: bool) -> Result<Self, ()>
Trigger (write-only): (re)start the channel.
Bits: 7..8
Sourcepub const fn with_trigger(self, value: bool) -> Self
pub const fn with_trigger(self, value: bool) -> Self
Trigger (write-only): (re)start the channel.
Bits: 7..8
Sourcepub const fn set_trigger(&mut self, value: bool)
pub const fn set_trigger(&mut self, value: bool)
Trigger (write-only): (re)start the channel.
Bits: 7..8
Trait Implementations§
Source§impl Clone for PeriodCtrl
impl Clone for PeriodCtrl
Source§fn clone(&self) -> PeriodCtrl
fn clone(&self) -> PeriodCtrl
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more