#[doc = "Register `PIO2_11` reader"] pub type R = crate::R; #[doc = "Register `PIO2_11` writer"] pub type W = crate::W; #[doc = "Selects pin function. All other values are reserved.\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] #[repr(u8)] pub enum Func { #[doc = "0: Selects function PIO2_11."] SelectsFunctionPio = 0, #[doc = "1: Select function SCK0 (only if pin PIO2_11/SCK0 selected in Table 147)."] SelectFunctionSck0 = 1, #[doc = "2: Select function CT32B0_CAP1."] SelectFunctionCt32 = 2, } impl From for u8 { #[inline(always)] fn from(variant: Func) -> Self { variant as _ } } impl crate::FieldSpec for Func { type Ux = u8; } #[doc = "Field `FUNC` reader - Selects pin function. All other values are reserved."] pub type FuncR = crate::FieldReader; impl FuncR { #[doc = "Get enumerated values variant"] #[inline(always)] pub const fn variant(&self) -> Option { match self.bits { 0 => Some(Func::SelectsFunctionPio), 1 => Some(Func::SelectFunctionSck0), 2 => Some(Func::SelectFunctionCt32), _ => None, } } #[doc = "Selects function PIO2_11."] #[inline(always)] pub fn is_selects_function_pio(&self) -> bool { *self == Func::SelectsFunctionPio } #[doc = "Select function SCK0 (only if pin PIO2_11/SCK0 selected in Table 147)."] #[inline(always)] pub fn is_select_function_sck0(&self) -> bool { *self == Func::SelectFunctionSck0 } #[doc = "Select function CT32B0_CAP1."] #[inline(always)] pub fn is_select_function_ct32(&self) -> bool { *self == Func::SelectFunctionCt32 } } #[doc = "Field `FUNC` writer - Selects pin function. All other values are reserved."] pub type FuncW<'a, REG> = crate::FieldWriter<'a, REG, 3, Func>; impl<'a, REG> FuncW<'a, REG> where REG: crate::Writable + crate::RegisterSpec, REG::Ux: From, { #[doc = "Selects function PIO2_11."] #[inline(always)] pub fn selects_function_pio(self) -> &'a mut crate::W { self.variant(Func::SelectsFunctionPio) } #[doc = "Select function SCK0 (only if pin PIO2_11/SCK0 selected in Table 147)."] #[inline(always)] pub fn select_function_sck0(self) -> &'a mut crate::W { self.variant(Func::SelectFunctionSck0) } #[doc = "Select function CT32B0_CAP1."] #[inline(always)] pub fn select_function_ct32(self) -> &'a mut crate::W { self.variant(Func::SelectFunctionCt32) } } #[doc = "Selects function mode (on-chip pull-up/pull-down resistor control).\n\nValue on reset: 2"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] #[repr(u8)] pub enum Mode { #[doc = "0: Inactive (no pull-down/pull-up resistor enabled)."] InactiveNoPullDo = 0, #[doc = "1: Pull-down resistor enabled."] PullDownResistorE = 1, #[doc = "2: Pull-up resistor enabled."] PullUpResistorEna = 2, #[doc = "3: Repeater mode."] RepeaterMode_ = 3, } impl From for u8 { #[inline(always)] fn from(variant: Mode) -> Self { variant as _ } } impl crate::FieldSpec for Mode { type Ux = u8; } #[doc = "Field `MODE` reader - Selects function mode (on-chip pull-up/pull-down resistor control)."] pub type ModeR = crate::FieldReader; impl ModeR { #[doc = "Get enumerated values variant"] #[inline(always)] pub const fn variant(&self) -> Mode { match self.bits { 0 => Mode::InactiveNoPullDo, 1 => Mode::PullDownResistorE, 2 => Mode::PullUpResistorEna, 3 => Mode::RepeaterMode_, _ => unreachable!(), } } #[doc = "Inactive (no pull-down/pull-up resistor enabled)."] #[inline(always)] pub fn is_inactive_no_pull_do(&self) -> bool { *self == Mode::InactiveNoPullDo } #[doc = "Pull-down resistor enabled."] #[inline(always)] pub fn is_pull_down_resistor_e(&self) -> bool { *self == Mode::PullDownResistorE } #[doc = "Pull-up resistor enabled."] #[inline(always)] pub fn is_pull_up_resistor_ena(&self) -> bool { *self == Mode::PullUpResistorEna } #[doc = "Repeater mode."] #[inline(always)] pub fn is_repeater_mode_(&self) -> bool { *self == Mode::RepeaterMode_ } } #[doc = "Field `MODE` writer - Selects function mode (on-chip pull-up/pull-down resistor control)."] pub type ModeW<'a, REG> = crate::FieldWriterSafe<'a, REG, 2, Mode>; impl<'a, REG> ModeW<'a, REG> where REG: crate::Writable + crate::RegisterSpec, REG::Ux: From, { #[doc = "Inactive (no pull-down/pull-up resistor enabled)."] #[inline(always)] pub fn inactive_no_pull_do(self) -> &'a mut crate::W { self.variant(Mode::InactiveNoPullDo) } #[doc = "Pull-down resistor enabled."] #[inline(always)] pub fn pull_down_resistor_e(self) -> &'a mut crate::W { self.variant(Mode::PullDownResistorE) } #[doc = "Pull-up resistor enabled."] #[inline(always)] pub fn pull_up_resistor_ena(self) -> &'a mut crate::W { self.variant(Mode::PullUpResistorEna) } #[doc = "Repeater mode."] #[inline(always)] pub fn repeater_mode_(self) -> &'a mut crate::W { self.variant(Mode::RepeaterMode_) } } #[doc = "Hysteresis.\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Hys { #[doc = "0: Disable."] Disable_ = 0, #[doc = "1: Enable."] Enable_ = 1, } impl From for bool { #[inline(always)] fn from(variant: Hys) -> Self { variant as u8 != 0 } } #[doc = "Field `HYS` reader - Hysteresis."] pub type HysR = crate::BitReader; impl HysR { #[doc = "Get enumerated values variant"] #[inline(always)] pub const fn variant(&self) -> Hys { match self.bits { false => Hys::Disable_, true => Hys::Enable_, } } #[doc = "Disable."] #[inline(always)] pub fn is_disable_(&self) -> bool { *self == Hys::Disable_ } #[doc = "Enable."] #[inline(always)] pub fn is_enable_(&self) -> bool { *self == Hys::Enable_ } } #[doc = "Field `HYS` writer - Hysteresis."] pub type HysW<'a, REG> = crate::BitWriter<'a, REG, Hys>; impl<'a, REG> HysW<'a, REG> where REG: crate::Writable + crate::RegisterSpec, { #[doc = "Disable."] #[inline(always)] pub fn disable_(self) -> &'a mut crate::W { self.variant(Hys::Disable_) } #[doc = "Enable."] #[inline(always)] pub fn enable_(self) -> &'a mut crate::W { self.variant(Hys::Enable_) } } #[doc = "Selects pseudo open-drain mode.\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Od { #[doc = "0: Standard GPIO output"] StandardGpioOutput = 0, #[doc = "1: Open-drain output"] OpenDrainOutput = 1, } impl From for bool { #[inline(always)] fn from(variant: Od) -> Self { variant as u8 != 0 } } #[doc = "Field `OD` reader - Selects pseudo open-drain mode."] pub type OdR = crate::BitReader; impl OdR { #[doc = "Get enumerated values variant"] #[inline(always)] pub const fn variant(&self) -> Od { match self.bits { false => Od::StandardGpioOutput, true => Od::OpenDrainOutput, } } #[doc = "Standard GPIO output"] #[inline(always)] pub fn is_standard_gpio_output(&self) -> bool { *self == Od::StandardGpioOutput } #[doc = "Open-drain output"] #[inline(always)] pub fn is_open_drain_output(&self) -> bool { *self == Od::OpenDrainOutput } } #[doc = "Field `OD` writer - Selects pseudo open-drain mode."] pub type OdW<'a, REG> = crate::BitWriter<'a, REG, Od>; impl<'a, REG> OdW<'a, REG> where REG: crate::Writable + crate::RegisterSpec, { #[doc = "Standard GPIO output"] #[inline(always)] pub fn standard_gpio_output(self) -> &'a mut crate::W { self.variant(Od::StandardGpioOutput) } #[doc = "Open-drain output"] #[inline(always)] pub fn open_drain_output(self) -> &'a mut crate::W { self.variant(Od::OpenDrainOutput) } } impl R { #[doc = "Bits 0:2 - Selects pin function. All other values are reserved."] #[inline(always)] pub fn func(&self) -> FuncR { FuncR::new((self.bits & 7) as u8) } #[doc = "Bits 3:4 - Selects function mode (on-chip pull-up/pull-down resistor control)."] #[inline(always)] pub fn mode(&self) -> ModeR { ModeR::new(((self.bits >> 3) & 3) as u8) } #[doc = "Bit 5 - Hysteresis."] #[inline(always)] pub fn hys(&self) -> HysR { HysR::new(((self.bits >> 5) & 1) != 0) } #[doc = "Bit 10 - Selects pseudo open-drain mode."] #[inline(always)] pub fn od(&self) -> OdR { OdR::new(((self.bits >> 10) & 1) != 0) } } impl W { #[doc = "Bits 0:2 - Selects pin function. All other values are reserved."] #[inline(always)] #[must_use] pub fn func(&mut self) -> FuncW { FuncW::new(self, 0) } #[doc = "Bits 3:4 - Selects function mode (on-chip pull-up/pull-down resistor control)."] #[inline(always)] #[must_use] pub fn mode(&mut self) -> ModeW { ModeW::new(self, 3) } #[doc = "Bit 5 - Hysteresis."] #[inline(always)] #[must_use] pub fn hys(&mut self) -> HysW { HysW::new(self, 5) } #[doc = "Bit 10 - Selects pseudo open-drain mode."] #[inline(always)] #[must_use] pub fn od(&mut self) -> OdW { OdW::new(self, 10) } } #[doc = "I/O configuration for pin PIO2_11/SCK0/ CT32B0_CAP1\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`pio2_11::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`pio2_11::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."] pub struct Pio2_11Spec; impl crate::RegisterSpec for Pio2_11Spec { type Ux = u32; } #[doc = "`read()` method returns [`pio2_11::R`](R) reader structure"] impl crate::Readable for Pio2_11Spec {} #[doc = "`write(|w| ..)` method takes [`pio2_11::W`](W) writer structure"] impl crate::Writable for Pio2_11Spec { type Safety = crate::Unsafe; const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0; const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0; } #[doc = "`reset()` method sets PIO2_11 to value 0xd0"] impl crate::Resettable for Pio2_11Spec { const RESET_VALUE: u32 = 0xd0; }