pub struct Triangle {
pub length: LengthCounter,
/* private fields */
}Expand description
Triangle channel state.
Fields§
§length: LengthCounterLength counter (uses control bit $4008 bit 7 as halt-flag too).
Implementations§
Source§impl Triangle
impl Triangle
Sourcepub fn write_linear(&mut self, value: u8)
pub fn write_linear(&mut self, value: u8)
$4008 write: control bit + linear counter reload value.
Sourcepub fn write_timer_lo(&mut self, value: u8)
pub fn write_timer_lo(&mut self, value: u8)
$400A write: timer low.
Sourcepub fn write_timer_hi(&mut self, value: u8)
pub fn write_timer_hi(&mut self, value: u8)
$400B write: length load + timer high. Sets the linear reload flag.
Sourcepub fn clock_timer(&mut self)
pub fn clock_timer(&mut self)
One CPU clock.
Sourcepub fn clock_quarter_frame(&mut self)
pub fn clock_quarter_frame(&mut self)
Quarter-frame clock: linear counter.
Sourcepub fn clock_half_frame(&mut self)
pub fn clock_half_frame(&mut self)
Half-frame clock: length counter.
Sourcepub fn output(&self) -> u8
pub fn output(&self) -> u8
Per-cycle output (0..=15).
The ultrasonic-silence behavior is implemented in Self::clock_timer
by freezing the sequencer when timer_period < 2; the output simply
holds the current step (so it does not pop), matching hardware.
Trait Implementations§
impl Copy for Triangle
Auto Trait Implementations§
impl Freeze for Triangle
impl RefUnwindSafe for Triangle
impl Send for Triangle
impl Sync for Triangle
impl Unpin for Triangle
impl UnsafeUnpin for Triangle
impl UnwindSafe for Triangle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more