pub type R = crate::R<PLLCFGRrs>;
pub type W = crate::W<PLLCFGRrs>;
pub type PLLM_R = crate::FieldReader;
pub type PLLM_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
pub type PLLN_R = crate::FieldReader<u16>;
pub type PLLN_W<'a, REG> = crate::FieldWriter<'a, REG, 9, u16>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PLLP {
Div2 = 0,
Div4 = 1,
Div6 = 2,
Div8 = 3,
}
impl From<PLLP> for u8 {
#[inline(always)]
fn from(variant: PLLP) -> Self {
variant as _
}
}
impl crate::FieldSpec for PLLP {
type Ux = u8;
}
impl crate::IsEnum for PLLP {}
pub type PLLP_R = crate::FieldReader<PLLP>;
impl PLLP_R {
#[inline(always)]
pub const fn variant(&self) -> PLLP {
match self.bits {
0 => PLLP::Div2,
1 => PLLP::Div4,
2 => PLLP::Div6,
3 => PLLP::Div8,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == PLLP::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == PLLP::Div4
}
#[inline(always)]
pub fn is_div6(&self) -> bool {
*self == PLLP::Div6
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == PLLP::Div8
}
}
pub type PLLP_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PLLP, crate::Safe>;
impl<'a, REG> PLLP_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn div2(self) -> &'a mut crate::W<REG> {
self.variant(PLLP::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(PLLP::Div4)
}
#[inline(always)]
pub fn div6(self) -> &'a mut crate::W<REG> {
self.variant(PLLP::Div6)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(PLLP::Div8)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PLLSRC {
Hsi = 0,
Hse = 1,
}
impl From<PLLSRC> for bool {
#[inline(always)]
fn from(variant: PLLSRC) -> Self {
variant as u8 != 0
}
}
pub type PLLSRC_R = crate::BitReader<PLLSRC>;
impl PLLSRC_R {
#[inline(always)]
pub const fn variant(&self) -> PLLSRC {
match self.bits {
false => PLLSRC::Hsi,
true => PLLSRC::Hse,
}
}
#[inline(always)]
pub fn is_hsi(&self) -> bool {
*self == PLLSRC::Hsi
}
#[inline(always)]
pub fn is_hse(&self) -> bool {
*self == PLLSRC::Hse
}
}
pub type PLLSRC_W<'a, REG> = crate::BitWriter<'a, REG, PLLSRC>;
impl<'a, REG> PLLSRC_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn hsi(self) -> &'a mut crate::W<REG> {
self.variant(PLLSRC::Hsi)
}
#[inline(always)]
pub fn hse(self) -> &'a mut crate::W<REG> {
self.variant(PLLSRC::Hse)
}
}
pub type PLLQ_R = crate::FieldReader;
pub type PLLQ_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
pub type PLLR_R = crate::FieldReader;
pub type PLLR_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
impl R {
#[inline(always)]
pub fn pllm(&self) -> PLLM_R {
PLLM_R::new((self.bits & 0x3f) as u8)
}
#[inline(always)]
pub fn plln(&self) -> PLLN_R {
PLLN_R::new(((self.bits >> 6) & 0x01ff) as u16)
}
#[inline(always)]
pub fn pllp(&self) -> PLLP_R {
PLLP_R::new(((self.bits >> 16) & 3) as u8)
}
#[inline(always)]
pub fn pllsrc(&self) -> PLLSRC_R {
PLLSRC_R::new(((self.bits >> 22) & 1) != 0)
}
#[inline(always)]
pub fn pllq(&self) -> PLLQ_R {
PLLQ_R::new(((self.bits >> 24) & 0x0f) as u8)
}
#[inline(always)]
pub fn pllr(&self) -> PLLR_R {
PLLR_R::new(((self.bits >> 28) & 7) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("PLLCFGR")
.field("pllq", &self.pllq())
.field("pllsrc", &self.pllsrc())
.field("pllp", &self.pllp())
.field("plln", &self.plln())
.field("pllm", &self.pllm())
.field("pllr", &self.pllr())
.finish()
}
}
impl W {
#[inline(always)]
pub fn pllm(&mut self) -> PLLM_W<PLLCFGRrs> {
PLLM_W::new(self, 0)
}
#[inline(always)]
pub fn plln(&mut self) -> PLLN_W<PLLCFGRrs> {
PLLN_W::new(self, 6)
}
#[inline(always)]
pub fn pllp(&mut self) -> PLLP_W<PLLCFGRrs> {
PLLP_W::new(self, 16)
}
#[inline(always)]
pub fn pllsrc(&mut self) -> PLLSRC_W<PLLCFGRrs> {
PLLSRC_W::new(self, 22)
}
#[inline(always)]
pub fn pllq(&mut self) -> PLLQ_W<PLLCFGRrs> {
PLLQ_W::new(self, 24)
}
#[inline(always)]
pub fn pllr(&mut self) -> PLLR_W<PLLCFGRrs> {
PLLR_W::new(self, 28)
}
}
pub struct PLLCFGRrs;
impl crate::RegisterSpec for PLLCFGRrs {
type Ux = u32;
}
impl crate::Readable for PLLCFGRrs {}
impl crate::Writable for PLLCFGRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for PLLCFGRrs {
const RESET_VALUE: u32 = 0x2400_3010;
}