pub type R = crate::R<PLLSAICFGRrs>;
pub type W = crate::W<PLLSAICFGRrs>;
pub type PLLSAIN_R = crate::FieldReader<u16>;
pub type PLLSAIN_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 PLLSAIP {
Div2 = 0,
Div4 = 1,
Div6 = 2,
Div8 = 3,
}
impl From<PLLSAIP> for u8 {
#[inline(always)]
fn from(variant: PLLSAIP) -> Self {
variant as _
}
}
impl crate::FieldSpec for PLLSAIP {
type Ux = u8;
}
impl crate::IsEnum for PLLSAIP {}
pub type PLLSAIP_R = crate::FieldReader<PLLSAIP>;
impl PLLSAIP_R {
#[inline(always)]
pub const fn variant(&self) -> PLLSAIP {
match self.bits {
0 => PLLSAIP::Div2,
1 => PLLSAIP::Div4,
2 => PLLSAIP::Div6,
3 => PLLSAIP::Div8,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == PLLSAIP::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == PLLSAIP::Div4
}
#[inline(always)]
pub fn is_div6(&self) -> bool {
*self == PLLSAIP::Div6
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == PLLSAIP::Div8
}
}
pub type PLLSAIP_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PLLSAIP, crate::Safe>;
impl<'a, REG> PLLSAIP_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(PLLSAIP::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(PLLSAIP::Div4)
}
#[inline(always)]
pub fn div6(self) -> &'a mut crate::W<REG> {
self.variant(PLLSAIP::Div6)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(PLLSAIP::Div8)
}
}
pub type PLLSAIQ_R = crate::FieldReader;
pub type PLLSAIQ_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
pub type PLLSAIR_R = crate::FieldReader;
pub type PLLSAIR_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
impl R {
#[inline(always)]
pub fn pllsain(&self) -> PLLSAIN_R {
PLLSAIN_R::new(((self.bits >> 6) & 0x01ff) as u16)
}
#[inline(always)]
pub fn pllsaip(&self) -> PLLSAIP_R {
PLLSAIP_R::new(((self.bits >> 16) & 3) as u8)
}
#[inline(always)]
pub fn pllsaiq(&self) -> PLLSAIQ_R {
PLLSAIQ_R::new(((self.bits >> 24) & 0x0f) as u8)
}
#[inline(always)]
pub fn pllsair(&self) -> PLLSAIR_R {
PLLSAIR_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("PLLSAICFGR")
.field("pllsain", &self.pllsain())
.field("pllsaip", &self.pllsaip())
.field("pllsaiq", &self.pllsaiq())
.field("pllsair", &self.pllsair())
.finish()
}
}
impl W {
#[inline(always)]
pub fn pllsain(&mut self) -> PLLSAIN_W<PLLSAICFGRrs> {
PLLSAIN_W::new(self, 6)
}
#[inline(always)]
pub fn pllsaip(&mut self) -> PLLSAIP_W<PLLSAICFGRrs> {
PLLSAIP_W::new(self, 16)
}
#[inline(always)]
pub fn pllsaiq(&mut self) -> PLLSAIQ_W<PLLSAICFGRrs> {
PLLSAIQ_W::new(self, 24)
}
#[inline(always)]
pub fn pllsair(&mut self) -> PLLSAIR_W<PLLSAICFGRrs> {
PLLSAIR_W::new(self, 28)
}
}
pub struct PLLSAICFGRrs;
impl crate::RegisterSpec for PLLSAICFGRrs {
type Ux = u32;
}
impl crate::Readable for PLLSAICFGRrs {}
impl crate::Writable for PLLSAICFGRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for PLLSAICFGRrs {
const RESET_VALUE: u32 = 0x2000_3000;
}