chore: improve code quality

This commit is contained in:
Rekai Nyangadzayi Musuka 2021-03-15 22:36:27 -05:00
parent 3d82465b04
commit 1a8506c04f
1 changed files with 6 additions and 13 deletions

View File

@ -240,19 +240,6 @@ impl From<SoundDuty> for u8 {
}
}
impl From<WavePattern> for u8 {
fn from(pattern: WavePattern) -> Self {
use WavePattern::*;
match pattern {
OneEighth => 0b00,
OneQuarter => 0b01,
OneHalf => 0b10,
ThreeQuarters => 0b11,
}
}
}
#[derive(Debug, Clone, Copy)]
pub enum WavePattern {
OneEighth = 0, // 12.5% ( _-------_-------_------- )
@ -267,6 +254,12 @@ impl Default for WavePattern {
}
}
impl From<WavePattern> for u8 {
fn from(pattern: WavePattern) -> Self {
pattern as u8
}
}
impl From<u8> for WavePattern {
fn from(byte: u8) -> Self {
match byte {