mimxrt685s_pac/sysctl0/
tempsensorctl.rs

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