#[doc = "Register `CFG23` reader"]
pub struct R(crate::R<CFG23_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<CFG23_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<CFG23_SPEC>> for R {
    fn from(reader: crate::R<CFG23_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `CFG23` writer"]
pub struct W(crate::W<CFG23_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<CFG23_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl core::convert::From<crate::W<CFG23_SPEC>> for W {
    fn from(writer: crate::W<CFG23_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Selects the routing inputs for the counter load signal\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum CNT_LD_SEL_A {
    #[doc = "0: No description available"]
    SC_IN0 = 0,
    #[doc = "1: No description available"]
    SC_IN1 = 1,
    #[doc = "2: No description available"]
    SC_IN2 = 2,
    #[doc = "3: No description available"]
    SC_IN3 = 3,
}
impl From<CNT_LD_SEL_A> for u8 {
    #[inline(always)]
    fn from(variant: CNT_LD_SEL_A) -> Self {
        variant as _
    }
}
#[doc = "Field `CNT_LD_SEL` reader - Selects the routing inputs for the counter load signal"]
pub struct CNT_LD_SEL_R(crate::FieldReader<u8, CNT_LD_SEL_A>);
impl CNT_LD_SEL_R {
    pub(crate) fn new(bits: u8) -> Self {
        CNT_LD_SEL_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> CNT_LD_SEL_A {
        match self.bits {
            0 => CNT_LD_SEL_A::SC_IN0,
            1 => CNT_LD_SEL_A::SC_IN1,
            2 => CNT_LD_SEL_A::SC_IN2,
            3 => CNT_LD_SEL_A::SC_IN3,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `SC_IN0`"]
    #[inline(always)]
    pub fn is_sc_in0(&self) -> bool {
        **self == CNT_LD_SEL_A::SC_IN0
    }
    #[doc = "Checks if the value of the field is `SC_IN1`"]
    #[inline(always)]
    pub fn is_sc_in1(&self) -> bool {
        **self == CNT_LD_SEL_A::SC_IN1
    }
    #[doc = "Checks if the value of the field is `SC_IN2`"]
    #[inline(always)]
    pub fn is_sc_in2(&self) -> bool {
        **self == CNT_LD_SEL_A::SC_IN2
    }
    #[doc = "Checks if the value of the field is `SC_IN3`"]
    #[inline(always)]
    pub fn is_sc_in3(&self) -> bool {
        **self == CNT_LD_SEL_A::SC_IN3
    }
}
impl core::ops::Deref for CNT_LD_SEL_R {
    type Target = crate::FieldReader<u8, CNT_LD_SEL_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `CNT_LD_SEL` writer - Selects the routing inputs for the counter load signal"]
pub struct CNT_LD_SEL_W<'a> {
    w: &'a mut W,
}
impl<'a> CNT_LD_SEL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: CNT_LD_SEL_A) -> &'a mut W {
        self.bits(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn sc_in0(self) -> &'a mut W {
        self.variant(CNT_LD_SEL_A::SC_IN0)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn sc_in1(self) -> &'a mut W {
        self.variant(CNT_LD_SEL_A::SC_IN1)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn sc_in2(self) -> &'a mut W {
        self.variant(CNT_LD_SEL_A::SC_IN2)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn sc_in3(self) -> &'a mut W {
        self.variant(CNT_LD_SEL_A::SC_IN3)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !0x03) | (value as u8 & 0x03);
        self.w
    }
}
#[doc = "Selects the routing inputs for the counter enable signal\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum CNT_EN_SEL_A {
    #[doc = "0: No description available"]
    SC_IN4 = 0,
    #[doc = "1: No description available"]
    SC_IN5 = 1,
    #[doc = "2: No description available"]
    SC_IN6 = 2,
    #[doc = "3: No description available"]
    SC_IO = 3,
}
impl From<CNT_EN_SEL_A> for u8 {
    #[inline(always)]
    fn from(variant: CNT_EN_SEL_A) -> Self {
        variant as _
    }
}
#[doc = "Field `CNT_EN_SEL` reader - Selects the routing inputs for the counter enable signal"]
pub struct CNT_EN_SEL_R(crate::FieldReader<u8, CNT_EN_SEL_A>);
impl CNT_EN_SEL_R {
    pub(crate) fn new(bits: u8) -> Self {
        CNT_EN_SEL_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> CNT_EN_SEL_A {
        match self.bits {
            0 => CNT_EN_SEL_A::SC_IN4,
            1 => CNT_EN_SEL_A::SC_IN5,
            2 => CNT_EN_SEL_A::SC_IN6,
            3 => CNT_EN_SEL_A::SC_IO,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `SC_IN4`"]
    #[inline(always)]
    pub fn is_sc_in4(&self) -> bool {
        **self == CNT_EN_SEL_A::SC_IN4
    }
    #[doc = "Checks if the value of the field is `SC_IN5`"]
    #[inline(always)]
    pub fn is_sc_in5(&self) -> bool {
        **self == CNT_EN_SEL_A::SC_IN5
    }
    #[doc = "Checks if the value of the field is `SC_IN6`"]
    #[inline(always)]
    pub fn is_sc_in6(&self) -> bool {
        **self == CNT_EN_SEL_A::SC_IN6
    }
    #[doc = "Checks if the value of the field is `SC_IO`"]
    #[inline(always)]
    pub fn is_sc_io(&self) -> bool {
        **self == CNT_EN_SEL_A::SC_IO
    }
}
impl core::ops::Deref for CNT_EN_SEL_R {
    type Target = crate::FieldReader<u8, CNT_EN_SEL_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `CNT_EN_SEL` writer - Selects the routing inputs for the counter enable signal"]
pub struct CNT_EN_SEL_W<'a> {
    w: &'a mut W,
}
impl<'a> CNT_EN_SEL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: CNT_EN_SEL_A) -> &'a mut W {
        self.bits(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn sc_in4(self) -> &'a mut W {
        self.variant(CNT_EN_SEL_A::SC_IN4)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn sc_in5(self) -> &'a mut W {
        self.variant(CNT_EN_SEL_A::SC_IN5)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn sc_in6(self) -> &'a mut W {
        self.variant(CNT_EN_SEL_A::SC_IN6)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn sc_io(self) -> &'a mut W {
        self.variant(CNT_EN_SEL_A::SC_IO)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x03 << 2)) | ((value as u8 & 0x03) << 2);
        self.w
    }
}
#[doc = "Configure the counter load signal for routing input\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ROUTE_LD_A {
    #[doc = "0: No description available"]
    DISABLE = 0,
    #[doc = "1: No description available"]
    ROUTED = 1,
}
impl From<ROUTE_LD_A> for bool {
    #[inline(always)]
    fn from(variant: ROUTE_LD_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `ROUTE_LD` reader - Configure the counter load signal for routing input"]
pub struct ROUTE_LD_R(crate::FieldReader<bool, ROUTE_LD_A>);
impl ROUTE_LD_R {
    pub(crate) fn new(bits: bool) -> Self {
        ROUTE_LD_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> ROUTE_LD_A {
        match self.bits {
            false => ROUTE_LD_A::DISABLE,
            true => ROUTE_LD_A::ROUTED,
        }
    }
    #[doc = "Checks if the value of the field is `DISABLE`"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        **self == ROUTE_LD_A::DISABLE
    }
    #[doc = "Checks if the value of the field is `ROUTED`"]
    #[inline(always)]
    pub fn is_routed(&self) -> bool {
        **self == ROUTE_LD_A::ROUTED
    }
}
impl core::ops::Deref for ROUTE_LD_R {
    type Target = crate::FieldReader<bool, ROUTE_LD_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `ROUTE_LD` writer - Configure the counter load signal for routing input"]
pub struct ROUTE_LD_W<'a> {
    w: &'a mut W,
}
impl<'a> ROUTE_LD_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: ROUTE_LD_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut W {
        self.variant(ROUTE_LD_A::DISABLE)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn routed(self) -> &'a mut W {
        self.variant(ROUTE_LD_A::ROUTED)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 4)) | ((value as u8 & 0x01) << 4);
        self.w
    }
}
#[doc = "Configure the counter enable signal for routing input\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ROUTE_EN_A {
    #[doc = "0: No description available"]
    DISABLE = 0,
    #[doc = "1: No description available"]
    ROUTED = 1,
}
impl From<ROUTE_EN_A> for bool {
    #[inline(always)]
    fn from(variant: ROUTE_EN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `ROUTE_EN` reader - Configure the counter enable signal for routing input"]
pub struct ROUTE_EN_R(crate::FieldReader<bool, ROUTE_EN_A>);
impl ROUTE_EN_R {
    pub(crate) fn new(bits: bool) -> Self {
        ROUTE_EN_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> ROUTE_EN_A {
        match self.bits {
            false => ROUTE_EN_A::DISABLE,
            true => ROUTE_EN_A::ROUTED,
        }
    }
    #[doc = "Checks if the value of the field is `DISABLE`"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        **self == ROUTE_EN_A::DISABLE
    }
    #[doc = "Checks if the value of the field is `ROUTED`"]
    #[inline(always)]
    pub fn is_routed(&self) -> bool {
        **self == ROUTE_EN_A::ROUTED
    }
}
impl core::ops::Deref for ROUTE_EN_R {
    type Target = crate::FieldReader<bool, ROUTE_EN_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `ROUTE_EN` writer - Configure the counter enable signal for routing input"]
pub struct ROUTE_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> ROUTE_EN_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: ROUTE_EN_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut W {
        self.variant(ROUTE_EN_A::DISABLE)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn routed(self) -> &'a mut W {
        self.variant(ROUTE_EN_A::ROUTED)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 5)) | ((value as u8 & 0x01) << 5);
        self.w
    }
}
#[doc = "Configure the alternate operating mode of the counter\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ALT_CNT_A {
    #[doc = "0: No description available"]
    DEFAULT_MODE = 0,
    #[doc = "1: No description available"]
    ALT_MODE = 1,
}
impl From<ALT_CNT_A> for bool {
    #[inline(always)]
    fn from(variant: ALT_CNT_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `ALT_CNT` reader - Configure the alternate operating mode of the counter"]
pub struct ALT_CNT_R(crate::FieldReader<bool, ALT_CNT_A>);
impl ALT_CNT_R {
    pub(crate) fn new(bits: bool) -> Self {
        ALT_CNT_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> ALT_CNT_A {
        match self.bits {
            false => ALT_CNT_A::DEFAULT_MODE,
            true => ALT_CNT_A::ALT_MODE,
        }
    }
    #[doc = "Checks if the value of the field is `DEFAULT_MODE`"]
    #[inline(always)]
    pub fn is_default_mode(&self) -> bool {
        **self == ALT_CNT_A::DEFAULT_MODE
    }
    #[doc = "Checks if the value of the field is `ALT_MODE`"]
    #[inline(always)]
    pub fn is_alt_mode(&self) -> bool {
        **self == ALT_CNT_A::ALT_MODE
    }
}
impl core::ops::Deref for ALT_CNT_R {
    type Target = crate::FieldReader<bool, ALT_CNT_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `ALT_CNT` writer - Configure the alternate operating mode of the counter"]
pub struct ALT_CNT_W<'a> {
    w: &'a mut W,
}
impl<'a> ALT_CNT_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: ALT_CNT_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn default_mode(self) -> &'a mut W {
        self.variant(ALT_CNT_A::DEFAULT_MODE)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn alt_mode(self) -> &'a mut W {
        self.variant(ALT_CNT_A::ALT_MODE)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 6)) | ((value as u8 & 0x01) << 6);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:1 - Selects the routing inputs for the counter load signal"]
    #[inline(always)]
    pub fn cnt_ld_sel(&self) -> CNT_LD_SEL_R {
        CNT_LD_SEL_R::new((self.bits & 0x03) as u8)
    }
    #[doc = "Bits 2:3 - Selects the routing inputs for the counter enable signal"]
    #[inline(always)]
    pub fn cnt_en_sel(&self) -> CNT_EN_SEL_R {
        CNT_EN_SEL_R::new(((self.bits >> 2) & 0x03) as u8)
    }
    #[doc = "Bit 4 - Configure the counter load signal for routing input"]
    #[inline(always)]
    pub fn route_ld(&self) -> ROUTE_LD_R {
        ROUTE_LD_R::new(((self.bits >> 4) & 0x01) != 0)
    }
    #[doc = "Bit 5 - Configure the counter enable signal for routing input"]
    #[inline(always)]
    pub fn route_en(&self) -> ROUTE_EN_R {
        ROUTE_EN_R::new(((self.bits >> 5) & 0x01) != 0)
    }
    #[doc = "Bit 6 - Configure the alternate operating mode of the counter"]
    #[inline(always)]
    pub fn alt_cnt(&self) -> ALT_CNT_R {
        ALT_CNT_R::new(((self.bits >> 6) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bits 0:1 - Selects the routing inputs for the counter load signal"]
    #[inline(always)]
    pub fn cnt_ld_sel(&mut self) -> CNT_LD_SEL_W {
        CNT_LD_SEL_W { w: self }
    }
    #[doc = "Bits 2:3 - Selects the routing inputs for the counter enable signal"]
    #[inline(always)]
    pub fn cnt_en_sel(&mut self) -> CNT_EN_SEL_W {
        CNT_EN_SEL_W { w: self }
    }
    #[doc = "Bit 4 - Configure the counter load signal for routing input"]
    #[inline(always)]
    pub fn route_ld(&mut self) -> ROUTE_LD_W {
        ROUTE_LD_W { w: self }
    }
    #[doc = "Bit 5 - Configure the counter enable signal for routing input"]
    #[inline(always)]
    pub fn route_en(&mut self) -> ROUTE_EN_W {
        ROUTE_EN_W { w: self }
    }
    #[doc = "Bit 6 - Configure the alternate operating mode of the counter"]
    #[inline(always)]
    pub fn alt_cnt(&mut self) -> ALT_CNT_W {
        ALT_CNT_W { w: self }
    }
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "Counter Control\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cfg23](index.html) module"]
pub struct CFG23_SPEC;
impl crate::RegisterSpec for CFG23_SPEC {
    type Ux = u8;
}
#[doc = "`read()` method returns [cfg23::R](R) reader structure"]
impl crate::Readable for CFG23_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [cfg23::W](W) writer structure"]
impl crate::Writable for CFG23_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets CFG23 to value 0"]
impl crate::Resettable for CFG23_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
