sam3x8e-pac 0.1.6-dev

Peripheral Access Crate (PAC) for the Atmel SAM3X8E.
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Fcmd(u8);
impl Fcmd {
    #[doc = "Get Flash Descriptor"]
    pub const GETD: Self = Self(0x0);
    #[doc = "Write page"]
    pub const WP: Self = Self(0x01);
    #[doc = "Write page and lock"]
    pub const WPL: Self = Self(0x02);
    #[doc = "Erase page and write page"]
    pub const EWP: Self = Self(0x03);
    #[doc = "Erase page and write page then lock"]
    pub const EWPL: Self = Self(0x04);
    #[doc = "Erase all"]
    pub const EA: Self = Self(0x05);
    #[doc = "Set Lock Bit"]
    pub const SLB: Self = Self(0x08);
    #[doc = "Clear Lock Bit"]
    pub const CLB: Self = Self(0x09);
    #[doc = "Get Lock Bit"]
    pub const GLB: Self = Self(0x0a);
    #[doc = "Set GPNVM Bit"]
    pub const SGPB: Self = Self(0x0b);
    #[doc = "Clear GPNVM Bit"]
    pub const CGPB: Self = Self(0x0c);
    #[doc = "Get GPNVM Bit"]
    pub const GGPB: Self = Self(0x0d);
    #[doc = "Start Read Unique Identifier"]
    pub const STUI: Self = Self(0x0e);
    #[doc = "Stop Read Unique Identifier"]
    pub const SPUI: Self = Self(0x0f);
    #[doc = "Get CALIB Bit"]
    pub const GCALB: Self = Self(0x10);
}
impl Fcmd {
    pub const fn from_bits(val: u8) -> Fcmd {
        Self(val & 0xff)
    }
    pub const fn to_bits(self) -> u8 {
        self.0
    }
}
impl core::fmt::Debug for Fcmd {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        match self.0 {
            0x0 => f.write_str("GETD"),
            0x01 => f.write_str("WP"),
            0x02 => f.write_str("WPL"),
            0x03 => f.write_str("EWP"),
            0x04 => f.write_str("EWPL"),
            0x05 => f.write_str("EA"),
            0x08 => f.write_str("SLB"),
            0x09 => f.write_str("CLB"),
            0x0a => f.write_str("GLB"),
            0x0b => f.write_str("SGPB"),
            0x0c => f.write_str("CGPB"),
            0x0d => f.write_str("GGPB"),
            0x0e => f.write_str("STUI"),
            0x0f => f.write_str("SPUI"),
            0x10 => f.write_str("GCALB"),
            other => core::write!(f, "0x{:02X}", other),
        }
    }
}
#[cfg(feature = "defmt")]
impl defmt::Format for Fcmd {
    fn format(&self, f: defmt::Formatter) {
        match self.0 {
            0x0 => defmt::write!(f, "GETD"),
            0x01 => defmt::write!(f, "WP"),
            0x02 => defmt::write!(f, "WPL"),
            0x03 => defmt::write!(f, "EWP"),
            0x04 => defmt::write!(f, "EWPL"),
            0x05 => defmt::write!(f, "EA"),
            0x08 => defmt::write!(f, "SLB"),
            0x09 => defmt::write!(f, "CLB"),
            0x0a => defmt::write!(f, "GLB"),
            0x0b => defmt::write!(f, "SGPB"),
            0x0c => defmt::write!(f, "CGPB"),
            0x0d => defmt::write!(f, "GGPB"),
            0x0e => defmt::write!(f, "STUI"),
            0x0f => defmt::write!(f, "SPUI"),
            0x10 => defmt::write!(f, "GCALB"),
            other => defmt::write!(f, "0x{:02X}", other),
        }
    }
}
impl From<u8> for Fcmd {
    #[inline(always)]
    fn from(val: u8) -> Fcmd {
        Fcmd::from_bits(val)
    }
}
impl From<Fcmd> for u8 {
    #[inline(always)]
    fn from(val: Fcmd) -> u8 {
        Fcmd::to_bits(val)
    }
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Fkey(u8);
impl Fkey {
    #[doc = "The 0x5A value enables the command defined by the bits of the register. If the field is written with a different value, the write is not performed and no action is started."]
    pub const PASSWD: Self = Self(0x5a);
}
impl Fkey {
    pub const fn from_bits(val: u8) -> Fkey {
        Self(val & 0xff)
    }
    pub const fn to_bits(self) -> u8 {
        self.0
    }
}
impl core::fmt::Debug for Fkey {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        match self.0 {
            0x5a => f.write_str("PASSWD"),
            other => core::write!(f, "0x{:02X}", other),
        }
    }
}
#[cfg(feature = "defmt")]
impl defmt::Format for Fkey {
    fn format(&self, f: defmt::Formatter) {
        match self.0 {
            0x5a => defmt::write!(f, "PASSWD"),
            other => defmt::write!(f, "0x{:02X}", other),
        }
    }
}
impl From<u8> for Fkey {
    #[inline(always)]
    fn from(val: u8) -> Fkey {
        Fkey::from_bits(val)
    }
}
impl From<Fkey> for u8 {
    #[inline(always)]
    fn from(val: Fkey) -> u8 {
        Fkey::to_bits(val)
    }
}