#[doc = "Register `CTRL_32K_CONF` reader"]
pub type R = crate::R<CTRL_32K_CONF_SPEC>;
#[doc = "Register `CTRL_32K_CONF` writer"]
pub type W = crate::W<CTRL_32K_CONF_SPEC>;
#[doc = "Field `CLK_32K_SEL` reader - This field indicates which one 32KHz clock will be used by timergroup. 0: OSC32K(default), 1: XTAL32K, 2/3: 32KHz from pad GPIO0."]
pub type CLK_32K_SEL_R = crate::FieldReader;
#[doc = "Field `CLK_32K_SEL` writer - This field indicates which one 32KHz clock will be used by timergroup. 0: OSC32K(default), 1: XTAL32K, 2/3: 32KHz from pad GPIO0."]
pub type CLK_32K_SEL_W<'a, REG, const O: u8> = crate::FieldWriter<'a, REG, 2, O>;
#[doc = "Field `_32K_MODEM_SEL` reader - This field indicates which one 32KHz clock will be used by MODEM_SYSTEM. 0: OSC32K(default), 1: XTAL32K, 2/3: 32KHz from pad GPIO0."]
pub type _32K_MODEM_SEL_R = crate::FieldReader;
#[doc = "Field `_32K_MODEM_SEL` writer - This field indicates which one 32KHz clock will be used by MODEM_SYSTEM. 0: OSC32K(default), 1: XTAL32K, 2/3: 32KHz from pad GPIO0."]
pub type _32K_MODEM_SEL_W<'a, REG, const O: u8> = crate::FieldWriter<'a, REG, 2, O>;
impl R {
#[doc = "Bits 0:1 - This field indicates which one 32KHz clock will be used by timergroup. 0: OSC32K(default), 1: XTAL32K, 2/3: 32KHz from pad GPIO0."]
#[inline(always)]
pub fn clk_32k_sel(&self) -> CLK_32K_SEL_R {
CLK_32K_SEL_R::new((self.bits & 3) as u8)
}
#[doc = "Bits 2:3 - This field indicates which one 32KHz clock will be used by MODEM_SYSTEM. 0: OSC32K(default), 1: XTAL32K, 2/3: 32KHz from pad GPIO0."]
#[inline(always)]
pub fn _32k_modem_sel(&self) -> _32K_MODEM_SEL_R {
_32K_MODEM_SEL_R::new(((self.bits >> 2) & 3) as u8)
}
}
#[cfg(feature = "impl-register-debug")]
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CTRL_32K_CONF")
.field(
"clk_32k_sel",
&format_args!("{}", self.clk_32k_sel().bits()),
)
.field(
"_32k_modem_sel",
&format_args!("{}", self._32k_modem_sel().bits()),
)
.finish()
}
}
#[cfg(feature = "impl-register-debug")]
impl core::fmt::Debug for crate::generic::Reg<CTRL_32K_CONF_SPEC> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
self.read().fmt(f)
}
}
impl W {
#[doc = "Bits 0:1 - This field indicates which one 32KHz clock will be used by timergroup. 0: OSC32K(default), 1: XTAL32K, 2/3: 32KHz from pad GPIO0."]
#[inline(always)]
#[must_use]
pub fn clk_32k_sel(&mut self) -> CLK_32K_SEL_W<CTRL_32K_CONF_SPEC, 0> {
CLK_32K_SEL_W::new(self)
}
#[doc = "Bits 2:3 - This field indicates which one 32KHz clock will be used by MODEM_SYSTEM. 0: OSC32K(default), 1: XTAL32K, 2/3: 32KHz from pad GPIO0."]
#[inline(always)]
#[must_use]
pub fn _32k_modem_sel(&mut self) -> _32K_MODEM_SEL_W<CTRL_32K_CONF_SPEC, 2> {
_32K_MODEM_SEL_W::new(self)
}
#[doc = r" Writes raw bits to the register."]
#[doc = r""]
#[doc = r" # Safety"]
#[doc = r""]
#[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
}
#[doc = "32KHz clock configuration register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`ctrl_32k_conf::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 [`ctrl_32k_conf::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct CTRL_32K_CONF_SPEC;
impl crate::RegisterSpec for CTRL_32K_CONF_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [`ctrl_32k_conf::R`](R) reader structure"]
impl crate::Readable for CTRL_32K_CONF_SPEC {}
#[doc = "`write(|w| ..)` method takes [`ctrl_32k_conf::W`](W) writer structure"]
impl crate::Writable for CTRL_32K_CONF_SPEC {
const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
}
#[doc = "`reset()` method sets CTRL_32K_CONF to value 0"]
impl crate::Resettable for CTRL_32K_CONF_SPEC {
const RESET_VALUE: Self::Ux = 0;
}