#[doc = "Register `PMC_PCK0` reader"]
pub type R = crate::R<PmcPck0Spec>;
#[doc = "Register `PMC_PCK0` writer"]
pub type W = crate::W<PmcPck0Spec>;
#[doc = "Master Clock Source Selection"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Css {
#[doc = "0: Slow Clock is selected"]
SlowClk = 0,
#[doc = "1: Main Clock is selected"]
MainClk = 1,
#[doc = "2: PLLA Clock is selected"]
PllaClk = 2,
#[doc = "3: UPLL Clock is selected"]
UpllClk = 3,
#[doc = "4: Master Clock is selected"]
Mck = 4,
}
impl From<Css> for u8 {
#[inline(always)]
fn from(variant: Css) -> Self {
variant as _
}
}
impl crate::FieldSpec for Css {
type Ux = u8;
}
impl crate::IsEnum for Css {}
#[doc = "Field `CSS` reader - Master Clock Source Selection"]
pub type CssR = crate::FieldReader<Css>;
impl CssR {
#[doc = "Get enumerated values variant"]
#[inline(always)]
pub const fn variant(&self) -> Option<Css> {
match self.bits {
0 => Some(Css::SlowClk),
1 => Some(Css::MainClk),
2 => Some(Css::PllaClk),
3 => Some(Css::UpllClk),
4 => Some(Css::Mck),
_ => None,
}
}
#[doc = "Slow Clock is selected"]
#[inline(always)]
pub fn is_slow_clk(&self) -> bool {
*self == Css::SlowClk
}
#[doc = "Main Clock is selected"]
#[inline(always)]
pub fn is_main_clk(&self) -> bool {
*self == Css::MainClk
}
#[doc = "PLLA Clock is selected"]
#[inline(always)]
pub fn is_plla_clk(&self) -> bool {
*self == Css::PllaClk
}
#[doc = "UPLL Clock is selected"]
#[inline(always)]
pub fn is_upll_clk(&self) -> bool {
*self == Css::UpllClk
}
#[doc = "Master Clock is selected"]
#[inline(always)]
pub fn is_mck(&self) -> bool {
*self == Css::Mck
}
}
#[doc = "Field `CSS` writer - Master Clock Source Selection"]
pub type CssW<'a, REG> = crate::FieldWriter<'a, REG, 3, Css>;
impl<'a, REG> CssW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[doc = "Slow Clock is selected"]
#[inline(always)]
pub fn slow_clk(self) -> &'a mut crate::W<REG> {
self.variant(Css::SlowClk)
}
#[doc = "Main Clock is selected"]
#[inline(always)]
pub fn main_clk(self) -> &'a mut crate::W<REG> {
self.variant(Css::MainClk)
}
#[doc = "PLLA Clock is selected"]
#[inline(always)]
pub fn plla_clk(self) -> &'a mut crate::W<REG> {
self.variant(Css::PllaClk)
}
#[doc = "UPLL Clock is selected"]
#[inline(always)]
pub fn upll_clk(self) -> &'a mut crate::W<REG> {
self.variant(Css::UpllClk)
}
#[doc = "Master Clock is selected"]
#[inline(always)]
pub fn mck(self) -> &'a mut crate::W<REG> {
self.variant(Css::Mck)
}
}
#[doc = "Programmable Clock Prescaler"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Pres {
#[doc = "0: Selected clock"]
Clk1 = 0,
#[doc = "1: Selected clock divided by 2"]
Clk2 = 1,
#[doc = "2: Selected clock divided by 4"]
Clk4 = 2,
#[doc = "3: Selected clock divided by 8"]
Clk8 = 3,
#[doc = "4: Selected clock divided by 16"]
Clk16 = 4,
#[doc = "5: Selected clock divided by 32"]
Clk32 = 5,
#[doc = "6: Selected clock divided by 64"]
Clk64 = 6,
}
impl From<Pres> for u8 {
#[inline(always)]
fn from(variant: Pres) -> Self {
variant as _
}
}
impl crate::FieldSpec for Pres {
type Ux = u8;
}
impl crate::IsEnum for Pres {}
#[doc = "Field `PRES` reader - Programmable Clock Prescaler"]
pub type PresR = crate::FieldReader<Pres>;
impl PresR {
#[doc = "Get enumerated values variant"]
#[inline(always)]
pub const fn variant(&self) -> Option<Pres> {
match self.bits {
0 => Some(Pres::Clk1),
1 => Some(Pres::Clk2),
2 => Some(Pres::Clk4),
3 => Some(Pres::Clk8),
4 => Some(Pres::Clk16),
5 => Some(Pres::Clk32),
6 => Some(Pres::Clk64),
_ => None,
}
}
#[doc = "Selected clock"]
#[inline(always)]
pub fn is_clk_1(&self) -> bool {
*self == Pres::Clk1
}
#[doc = "Selected clock divided by 2"]
#[inline(always)]
pub fn is_clk_2(&self) -> bool {
*self == Pres::Clk2
}
#[doc = "Selected clock divided by 4"]
#[inline(always)]
pub fn is_clk_4(&self) -> bool {
*self == Pres::Clk4
}
#[doc = "Selected clock divided by 8"]
#[inline(always)]
pub fn is_clk_8(&self) -> bool {
*self == Pres::Clk8
}
#[doc = "Selected clock divided by 16"]
#[inline(always)]
pub fn is_clk_16(&self) -> bool {
*self == Pres::Clk16
}
#[doc = "Selected clock divided by 32"]
#[inline(always)]
pub fn is_clk_32(&self) -> bool {
*self == Pres::Clk32
}
#[doc = "Selected clock divided by 64"]
#[inline(always)]
pub fn is_clk_64(&self) -> bool {
*self == Pres::Clk64
}
}
#[doc = "Field `PRES` writer - Programmable Clock Prescaler"]
pub type PresW<'a, REG> = crate::FieldWriter<'a, REG, 3, Pres>;
impl<'a, REG> PresW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[doc = "Selected clock"]
#[inline(always)]
pub fn clk_1(self) -> &'a mut crate::W<REG> {
self.variant(Pres::Clk1)
}
#[doc = "Selected clock divided by 2"]
#[inline(always)]
pub fn clk_2(self) -> &'a mut crate::W<REG> {
self.variant(Pres::Clk2)
}
#[doc = "Selected clock divided by 4"]
#[inline(always)]
pub fn clk_4(self) -> &'a mut crate::W<REG> {
self.variant(Pres::Clk4)
}
#[doc = "Selected clock divided by 8"]
#[inline(always)]
pub fn clk_8(self) -> &'a mut crate::W<REG> {
self.variant(Pres::Clk8)
}
#[doc = "Selected clock divided by 16"]
#[inline(always)]
pub fn clk_16(self) -> &'a mut crate::W<REG> {
self.variant(Pres::Clk16)
}
#[doc = "Selected clock divided by 32"]
#[inline(always)]
pub fn clk_32(self) -> &'a mut crate::W<REG> {
self.variant(Pres::Clk32)
}
#[doc = "Selected clock divided by 64"]
#[inline(always)]
pub fn clk_64(self) -> &'a mut crate::W<REG> {
self.variant(Pres::Clk64)
}
}
impl R {
#[doc = "Bits 0:2 - Master Clock Source Selection"]
#[inline(always)]
pub fn css(&self) -> CssR {
CssR::new((self.bits & 7) as u8)
}
#[doc = "Bits 4:6 - Programmable Clock Prescaler"]
#[inline(always)]
pub fn pres(&self) -> PresR {
PresR::new(((self.bits >> 4) & 7) as u8)
}
}
impl W {
#[doc = "Bits 0:2 - Master Clock Source Selection"]
#[inline(always)]
#[must_use]
pub fn css(&mut self) -> CssW<PmcPck0Spec> {
CssW::new(self, 0)
}
#[doc = "Bits 4:6 - Programmable Clock Prescaler"]
#[inline(always)]
#[must_use]
pub fn pres(&mut self) -> PresW<PmcPck0Spec> {
PresW::new(self, 4)
}
}
#[doc = "Programmable Clock 0 Register 0\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`pmc_pck0::R`](R). You can [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`pmc_pck0::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct PmcPck0Spec;
impl crate::RegisterSpec for PmcPck0Spec {
type Ux = u32;
}
#[doc = "`read()` method returns [`pmc_pck0::R`](R) reader structure"]
impl crate::Readable for PmcPck0Spec {}
#[doc = "`write(|w| ..)` method takes [`pmc_pck0::W`](W) writer structure"]
impl crate::Writable for PmcPck0Spec {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}