fix stupids

This commit is contained in:
Alex Janka 2023-02-23 14:21:00 +11:00
parent c925beae8a
commit 1f3d1c41f9

View file

@ -210,9 +210,9 @@ impl PwmChannel {
pub(super) fn update_sweep(&mut self, data: u8) { pub(super) fn update_sweep(&mut self, data: u8) {
self.sweep.pace = (data & 0b1110000) >> 4; self.sweep.pace = (data & 0b1110000) >> 4;
self.sweep.mode = if get_bit(data, 3) { self.sweep.mode = if get_bit(data, 3) {
EnvelopeMode::Decrease
} else {
EnvelopeMode::Increase EnvelopeMode::Increase
} else {
EnvelopeMode::Decrease
}; };
self.sweep.slope = data & 0b111; self.sweep.slope = data & 0b111;
} }
@ -221,7 +221,7 @@ impl PwmChannel {
set_or_clear_bit( set_or_clear_bit(
(0b10000000 | (self.sweep.pace << 4) & 0b1110000) | (self.sweep.slope & 0b111), (0b10000000 | (self.sweep.pace << 4) & 0b1110000) | (self.sweep.slope & 0b111),
3, 3,
self.sweep.mode == EnvelopeMode::Decrease, self.sweep.mode == EnvelopeMode::Increase,
) )
} }
@ -251,7 +251,7 @@ impl PwmChannel {
(self.queued_envelope.rate & 0b111) (self.queued_envelope.rate & 0b111)
| ((self.queued_envelope.initial_volume & 0b1111) << 4), | ((self.queued_envelope.initial_volume & 0b1111) << 4),
3, 3,
self.queued_envelope.mode == EnvelopeMode::Decrease, self.queued_envelope.mode == EnvelopeMode::Increase,
) )
} }