#[repr(C)]
#[derive(Clone)]
pub struct NegconButtons {
data: u16,
}
impl NegconButtons {
const NC_SELECT: u16 = 0x0001;
const NC_START: u16 = 0x0008;
const NC_UP: u16 = 0x0010;
const NC_RIGHT: u16 = 0x0020;
const NC_DOWN: u16 = 0x0040;
const NC_LEFT: u16 = 0x0080;
const NC_R: u16 = 0x0800;
const NC_B: u16 = 0x1000;
const NC_A: u16 = 0x2000;
pub fn select(&self) -> bool {
self.data & Self::NC_SELECT == 0
}
pub fn start(&self) -> bool {
self.data & Self::NC_START == 0
}
pub fn up(&self) -> bool {
self.data & Self::NC_UP == 0
}
pub fn right(&self) -> bool {
self.data & Self::NC_RIGHT == 0
}
pub fn down(&self) -> bool {
self.data & Self::NC_DOWN == 0
}
pub fn left(&self) -> bool {
self.data & Self::NC_LEFT == 0
}
pub fn r(&self) -> bool {
self.data & Self::NC_R == 0
}
pub fn b(&self) -> bool {
self.data & Self::NC_B == 0
}
pub fn a(&self) -> bool {
self.data & Self::NC_A == 0
}
pub fn bits(&self) -> u16 {
self.data
}
}
#[repr(C)]
pub struct NegCon {
pub buttons: NegconButtons,
pub twist: u8,
pub switchi: u8,
pub switchii: u8,
pub switchl: u8
}