Skip to main content

parse_dpad_button

Function parse_dpad_button 

Source
pub fn parse_dpad_button(value: u8) -> Result<DPadButton, DPadButtonError>
Expand description

Extracts a DPadButton from the upper nibble of a packed input byte.

The button ID is stored in bits 4–6 of the byte (mask 0x70).

§Errors

Returns DPadButtonError::NonExistentDPadButton if the extracted 3-bit value does not map to a known D-pad direction (valid range is 0–4).