pub fn from_reg(val: u8) -> Sweep {
        let dir =
            match val & 8 != 0 {
                false => SweepDirection::Up,
                true  => SweepDirection::Down,
            };

        let shift = val & 7;

        let l = ((val & 0x70) >> 4) as u32;

        Sweep {
            direction:     dir,
            shift:         shift,
            step_duration: l * 0x8000,
            counter:       0,
        }
    }
// Build Sweep from NR10 register value
Build Sweep from NR10 register value
Build Sweep from NR10 register value
pub fn from_reg(val: u8) -> Sweep {
        let dir =
            match val & 8 != 0 {
                false => SweepDirection::Up,
                true  => SweepDirection::Down,
            };
        let shift = val & 7;
        let l = ((val & 0x70) >> 4) as u32;
        Sweep {
            direction:     dir,
            shift:         shift,
            step_duration: l * 0x8000,
            counter:       0,
        }
    }
pub fn from_reg ( val : u8 ) -> Sweep { let dir = match val & 8 != 0 { false => SweepDirection :: Up , true => SweepDirection :: Down , } ; let shift = val & 7 ; let l = ( ( val & 0x70 ) >> 4 ) as u32 ; Sweep { direction : dir , shift : shift , step_duration : l * 0x8000 , counter : 0 , } }
Build Sweep from NR10 register value
Build Sweep from NR10 register value
val
u8
val
u8