Skip to main content

mcxa_pac/dac0/
tcr.rs

1#[doc = "Register `TCR` reader"]
2pub type R = crate::R<TcrSpec>;
3#[doc = "Register `TCR` writer"]
4pub type W = crate::W<TcrSpec>;
5#[doc = "Software Trigger\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Swtrg {
9    #[doc = "0: Not valid"]
10    NotValid = 0,
11    #[doc = "1: Valid"]
12    Valid = 1,
13}
14impl From<Swtrg> for bool {
15    #[inline(always)]
16    fn from(variant: Swtrg) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `SWTRG` reader - Software Trigger"]
21pub type SwtrgR = crate::BitReader<Swtrg>;
22impl SwtrgR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Swtrg {
26        match self.bits {
27            false => Swtrg::NotValid,
28            true => Swtrg::Valid,
29        }
30    }
31    #[doc = "Not valid"]
32    #[inline(always)]
33    pub fn is_not_valid(&self) -> bool {
34        *self == Swtrg::NotValid
35    }
36    #[doc = "Valid"]
37    #[inline(always)]
38    pub fn is_valid(&self) -> bool {
39        *self == Swtrg::Valid
40    }
41}
42#[doc = "Field `SWTRG` writer - Software Trigger"]
43pub type SwtrgW<'a, REG> = crate::BitWriter<'a, REG, Swtrg>;
44impl<'a, REG> SwtrgW<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "Not valid"]
49    #[inline(always)]
50    pub fn not_valid(self) -> &'a mut crate::W<REG> {
51        self.variant(Swtrg::NotValid)
52    }
53    #[doc = "Valid"]
54    #[inline(always)]
55    pub fn valid(self) -> &'a mut crate::W<REG> {
56        self.variant(Swtrg::Valid)
57    }
58}
59impl R {
60    #[doc = "Bit 0 - Software Trigger"]
61    #[inline(always)]
62    pub fn swtrg(&self) -> SwtrgR {
63        SwtrgR::new((self.bits & 1) != 0)
64    }
65}
66#[cfg(feature = "debug")]
67impl core::fmt::Debug for R {
68    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
69        f.debug_struct("TCR").field("swtrg", &self.swtrg()).finish()
70    }
71}
72impl W {
73    #[doc = "Bit 0 - Software Trigger"]
74    #[inline(always)]
75    pub fn swtrg(&mut self) -> SwtrgW<'_, TcrSpec> {
76        SwtrgW::new(self, 0)
77    }
78}
79#[doc = "Trigger Control\n\nYou can [`read`](crate::Reg::read) this register and get [`tcr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`tcr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
80pub struct TcrSpec;
81impl crate::RegisterSpec for TcrSpec {
82    type Ux = u32;
83}
84#[doc = "`read()` method returns [`tcr::R`](R) reader structure"]
85impl crate::Readable for TcrSpec {}
86#[doc = "`write(|w| ..)` method takes [`tcr::W`](W) writer structure"]
87impl crate::Writable for TcrSpec {
88    type Safety = crate::Unsafe;
89}
90#[doc = "`reset()` method sets TCR to value 0"]
91impl crate::Resettable for TcrSpec {}