pub type R = crate::R<SMCRrs>;
pub type W = crate::W<SMCRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum SMS {
Disabled = 0,
ResetMode = 4,
GatedMode = 5,
TriggerMode = 6,
ExtClockMode = 7,
}
impl From<SMS> for u8 {
#[inline(always)]
fn from(variant: SMS) -> Self {
variant as _
}
}
impl crate::FieldSpec for SMS {
type Ux = u8;
}
impl crate::IsEnum for SMS {}
pub type SMS_R = crate::FieldReader<SMS>;
impl SMS_R {
#[inline(always)]
pub const fn variant(&self) -> Option<SMS> {
match self.bits {
0 => Some(SMS::Disabled),
4 => Some(SMS::ResetMode),
5 => Some(SMS::GatedMode),
6 => Some(SMS::TriggerMode),
7 => Some(SMS::ExtClockMode),
_ => None,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == SMS::Disabled
}
#[inline(always)]
pub fn is_reset_mode(&self) -> bool {
*self == SMS::ResetMode
}
#[inline(always)]
pub fn is_gated_mode(&self) -> bool {
*self == SMS::GatedMode
}
#[inline(always)]
pub fn is_trigger_mode(&self) -> bool {
*self == SMS::TriggerMode
}
#[inline(always)]
pub fn is_ext_clock_mode(&self) -> bool {
*self == SMS::ExtClockMode
}
}
pub type SMS_W<'a, REG> = crate::FieldWriter<'a, REG, 3, SMS>;
impl<'a, REG> SMS_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(SMS::Disabled)
}
#[inline(always)]
pub fn reset_mode(self) -> &'a mut crate::W<REG> {
self.variant(SMS::ResetMode)
}
#[inline(always)]
pub fn gated_mode(self) -> &'a mut crate::W<REG> {
self.variant(SMS::GatedMode)
}
#[inline(always)]
pub fn trigger_mode(self) -> &'a mut crate::W<REG> {
self.variant(SMS::TriggerMode)
}
#[inline(always)]
pub fn ext_clock_mode(self) -> &'a mut crate::W<REG> {
self.variant(SMS::ExtClockMode)
}
}
pub type TS_R = crate::FieldReader;
pub type TS_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum MSM {
NoSync = 0,
Sync = 1,
}
impl From<MSM> for bool {
#[inline(always)]
fn from(variant: MSM) -> Self {
variant as u8 != 0
}
}
pub type MSM_R = crate::BitReader<MSM>;
impl MSM_R {
#[inline(always)]
pub const fn variant(&self) -> MSM {
match self.bits {
false => MSM::NoSync,
true => MSM::Sync,
}
}
#[inline(always)]
pub fn is_no_sync(&self) -> bool {
*self == MSM::NoSync
}
#[inline(always)]
pub fn is_sync(&self) -> bool {
*self == MSM::Sync
}
}
pub type MSM_W<'a, REG> = crate::BitWriter<'a, REG, MSM>;
impl<'a, REG> MSM_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn no_sync(self) -> &'a mut crate::W<REG> {
self.variant(MSM::NoSync)
}
#[inline(always)]
pub fn sync(self) -> &'a mut crate::W<REG> {
self.variant(MSM::Sync)
}
}
impl R {
#[inline(always)]
pub fn sms(&self) -> SMS_R {
SMS_R::new((self.bits & 7) as u8)
}
#[inline(always)]
pub fn ts(&self) -> TS_R {
TS_R::new(((self.bits >> 4) & 7) as u8)
}
#[inline(always)]
pub fn msm(&self) -> MSM_R {
MSM_R::new(((self.bits >> 7) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("SMCR")
.field("msm", &self.msm())
.field("ts", &self.ts())
.field("sms", &self.sms())
.finish()
}
}
impl W {
#[inline(always)]
pub fn sms(&mut self) -> SMS_W<SMCRrs> {
SMS_W::new(self, 0)
}
#[inline(always)]
pub fn ts(&mut self) -> TS_W<SMCRrs> {
TS_W::new(self, 4)
}
#[inline(always)]
pub fn msm(&mut self) -> MSM_W<SMCRrs> {
MSM_W::new(self, 7)
}
}
pub struct SMCRrs;
impl crate::RegisterSpec for SMCRrs {
type Ux = u32;
}
impl crate::Readable for SMCRrs {}
impl crate::Writable for SMCRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for SMCRrs {}