pub type R = crate::R<SSCGRrs>;
pub type W = crate::W<SSCGRrs>;
pub type MODPER_R = crate::FieldReader<u16>;
pub type MODPER_W<'a, REG> = crate::FieldWriter<'a, REG, 13, u16, crate::Safe>;
pub type INCSTEP_R = crate::FieldReader<u16>;
pub type INCSTEP_W<'a, REG> = crate::FieldWriter<'a, REG, 15, u16, crate::Safe>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SPREADSEL {
Center = 0,
Down = 1,
}
impl From<SPREADSEL> for bool {
#[inline(always)]
fn from(variant: SPREADSEL) -> Self {
variant as u8 != 0
}
}
pub type SPREADSEL_R = crate::BitReader<SPREADSEL>;
impl SPREADSEL_R {
#[inline(always)]
pub const fn variant(&self) -> SPREADSEL {
match self.bits {
false => SPREADSEL::Center,
true => SPREADSEL::Down,
}
}
#[inline(always)]
pub fn is_center(&self) -> bool {
*self == SPREADSEL::Center
}
#[inline(always)]
pub fn is_down(&self) -> bool {
*self == SPREADSEL::Down
}
}
pub type SPREADSEL_W<'a, REG> = crate::BitWriter<'a, REG, SPREADSEL>;
impl<'a, REG> SPREADSEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn center(self) -> &'a mut crate::W<REG> {
self.variant(SPREADSEL::Center)
}
#[inline(always)]
pub fn down(self) -> &'a mut crate::W<REG> {
self.variant(SPREADSEL::Down)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SSCGEN {
Disabled = 0,
Enabled = 1,
}
impl From<SSCGEN> for bool {
#[inline(always)]
fn from(variant: SSCGEN) -> Self {
variant as u8 != 0
}
}
pub type SSCGEN_R = crate::BitReader<SSCGEN>;
impl SSCGEN_R {
#[inline(always)]
pub const fn variant(&self) -> SSCGEN {
match self.bits {
false => SSCGEN::Disabled,
true => SSCGEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == SSCGEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == SSCGEN::Enabled
}
}
pub type SSCGEN_W<'a, REG> = crate::BitWriter<'a, REG, SSCGEN>;
impl<'a, REG> SSCGEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(SSCGEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(SSCGEN::Enabled)
}
}
impl R {
#[inline(always)]
pub fn modper(&self) -> MODPER_R {
MODPER_R::new((self.bits & 0x1fff) as u16)
}
#[inline(always)]
pub fn incstep(&self) -> INCSTEP_R {
INCSTEP_R::new(((self.bits >> 13) & 0x7fff) as u16)
}
#[inline(always)]
pub fn spreadsel(&self) -> SPREADSEL_R {
SPREADSEL_R::new(((self.bits >> 30) & 1) != 0)
}
#[inline(always)]
pub fn sscgen(&self) -> SSCGEN_R {
SSCGEN_R::new(((self.bits >> 31) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("SSCGR")
.field("sscgen", &self.sscgen())
.field("spreadsel", &self.spreadsel())
.field("incstep", &self.incstep())
.field("modper", &self.modper())
.finish()
}
}
impl W {
#[inline(always)]
pub fn modper(&mut self) -> MODPER_W<SSCGRrs> {
MODPER_W::new(self, 0)
}
#[inline(always)]
pub fn incstep(&mut self) -> INCSTEP_W<SSCGRrs> {
INCSTEP_W::new(self, 13)
}
#[inline(always)]
pub fn spreadsel(&mut self) -> SPREADSEL_W<SSCGRrs> {
SPREADSEL_W::new(self, 30)
}
#[inline(always)]
pub fn sscgen(&mut self) -> SSCGEN_W<SSCGRrs> {
SSCGEN_W::new(self, 31)
}
}
pub struct SSCGRrs;
impl crate::RegisterSpec for SSCGRrs {
type Ux = u32;
}
impl crate::Readable for SSCGRrs {}
impl crate::Writable for SSCGRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for SSCGRrs {}