pub type R = crate::R<TIMECMP2rs>;
pub type W = crate::W<TIMECMP2rs>;
pub type TcmpvalR = crate::FieldReader;
pub type TcmpvalW<'a, REG> = crate::FieldWriter<'a, REG, 8>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum TSTART {
Disable = 0,
Txeof = 1,
Txc = 2,
Rxact = 3,
Rxeof = 4,
}
impl From<TSTART> for u8 {
#[inline(always)]
fn from(variant: TSTART) -> Self {
variant as _
}
}
impl crate::FieldSpec for TSTART {
type Ux = u8;
}
impl crate::IsEnum for TSTART {}
pub type TstartR = crate::FieldReader<TSTART>;
impl TstartR {
#[inline(always)]
pub const fn variant(&self) -> Option<TSTART> {
match self.bits {
0 => Some(TSTART::Disable),
1 => Some(TSTART::Txeof),
2 => Some(TSTART::Txc),
3 => Some(TSTART::Rxact),
4 => Some(TSTART::Rxeof),
_ => None,
}
}
#[inline(always)]
pub fn is_disable(&self) -> bool {
*self == TSTART::Disable
}
#[inline(always)]
pub fn is_txeof(&self) -> bool {
*self == TSTART::Txeof
}
#[inline(always)]
pub fn is_txc(&self) -> bool {
*self == TSTART::Txc
}
#[inline(always)]
pub fn is_rxact(&self) -> bool {
*self == TSTART::Rxact
}
#[inline(always)]
pub fn is_rxeof(&self) -> bool {
*self == TSTART::Rxeof
}
}
pub type TstartW<'a, REG> = crate::FieldWriter<'a, REG, 3, TSTART>;
impl<'a, REG> TstartW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn disable(self) -> &'a mut crate::W<REG> {
self.variant(TSTART::Disable)
}
#[inline(always)]
pub fn txeof(self) -> &'a mut crate::W<REG> {
self.variant(TSTART::Txeof)
}
#[inline(always)]
pub fn txc(self) -> &'a mut crate::W<REG> {
self.variant(TSTART::Txc)
}
#[inline(always)]
pub fn rxact(self) -> &'a mut crate::W<REG> {
self.variant(TSTART::Rxact)
}
#[inline(always)]
pub fn rxeof(self) -> &'a mut crate::W<REG> {
self.variant(TSTART::Rxeof)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum TSTOP {
Tcmp2 = 0,
Txst = 1,
Rxact = 2,
Rxactn = 3,
}
impl From<TSTOP> for u8 {
#[inline(always)]
fn from(variant: TSTOP) -> Self {
variant as _
}
}
impl crate::FieldSpec for TSTOP {
type Ux = u8;
}
impl crate::IsEnum for TSTOP {}
pub type TstopR = crate::FieldReader<TSTOP>;
impl TstopR {
#[inline(always)]
pub const fn variant(&self) -> Option<TSTOP> {
match self.bits {
0 => Some(TSTOP::Tcmp2),
1 => Some(TSTOP::Txst),
2 => Some(TSTOP::Rxact),
3 => Some(TSTOP::Rxactn),
_ => None,
}
}
#[inline(always)]
pub fn is_tcmp2(&self) -> bool {
*self == TSTOP::Tcmp2
}
#[inline(always)]
pub fn is_txst(&self) -> bool {
*self == TSTOP::Txst
}
#[inline(always)]
pub fn is_rxact(&self) -> bool {
*self == TSTOP::Rxact
}
#[inline(always)]
pub fn is_rxactn(&self) -> bool {
*self == TSTOP::Rxactn
}
}
pub type TstopW<'a, REG> = crate::FieldWriter<'a, REG, 3, TSTOP>;
impl<'a, REG> TstopW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn tcmp2(self) -> &'a mut crate::W<REG> {
self.variant(TSTOP::Tcmp2)
}
#[inline(always)]
pub fn txst(self) -> &'a mut crate::W<REG> {
self.variant(TSTOP::Txst)
}
#[inline(always)]
pub fn rxact(self) -> &'a mut crate::W<REG> {
self.variant(TSTOP::Rxact)
}
#[inline(always)]
pub fn rxactn(self) -> &'a mut crate::W<REG> {
self.variant(TSTOP::Rxactn)
}
}
pub type RestartenR = crate::BitReader;
pub type RestartenW<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[inline(always)]
pub fn tcmpval(&self) -> TcmpvalR {
TcmpvalR::new((self.bits & 0xff) as u8)
}
#[inline(always)]
pub fn tstart(&self) -> TstartR {
TstartR::new(((self.bits >> 16) & 7) as u8)
}
#[inline(always)]
pub fn tstop(&self) -> TstopR {
TstopR::new(((self.bits >> 20) & 7) as u8)
}
#[inline(always)]
pub fn restarten(&self) -> RestartenR {
RestartenR::new(((self.bits >> 24) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TIMECMP2")
.field("tcmpval", &self.tcmpval())
.field("tstart", &self.tstart())
.field("tstop", &self.tstop())
.field("restarten", &self.restarten())
.finish()
}
}
impl W {
#[inline(always)]
pub fn tcmpval(&mut self) -> TcmpvalW<'_, TIMECMP2rs> {
TcmpvalW::new(self, 0)
}
#[inline(always)]
pub fn tstart(&mut self) -> TstartW<'_, TIMECMP2rs> {
TstartW::new(self, 16)
}
#[inline(always)]
pub fn tstop(&mut self) -> TstopW<'_, TIMECMP2rs> {
TstopW::new(self, 20)
}
#[inline(always)]
pub fn restarten(&mut self) -> RestartenW<'_, TIMECMP2rs> {
RestartenW::new(self, 24)
}
}
pub struct TIMECMP2rs;
impl crate::RegisterSpec for TIMECMP2rs {
type Ux = u32;
}
impl crate::Readable for TIMECMP2rs {}
impl crate::Writable for TIMECMP2rs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for TIMECMP2rs {}