fixed it wrong lol

This commit is contained in:
Alex Janka 2023-02-23 15:32:10 +11:00
parent 1f3d1c41f9
commit 4623c248db

View file

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