d1_pac/tve_top/
tve_dac_status.rs

1#[doc = "Register `tve_dac_status` reader"]
2pub type R = crate::R<TVE_DAC_STATUS_SPEC>;
3#[doc = "Register `tve_dac_status` writer"]
4pub type W = crate::W<TVE_DAC_STATUS_SPEC>;
5#[doc = "Field `dac_status` reader - "]
6pub type DAC_STATUS_R = crate::FieldReader<DAC_STATUS_A>;
7#[doc = "\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9#[repr(u8)]
10pub enum DAC_STATUS_A {
11    #[doc = "0: Unconnected"]
12    U_NCONNECTED = 0,
13    #[doc = "1: Connected"]
14    C_ONNECTED = 1,
15    #[doc = "3: Short to ground"]
16    S_HORT = 3,
17}
18impl From<DAC_STATUS_A> for u8 {
19    #[inline(always)]
20    fn from(variant: DAC_STATUS_A) -> Self {
21        variant as _
22    }
23}
24impl crate::FieldSpec for DAC_STATUS_A {
25    type Ux = u8;
26}
27impl DAC_STATUS_R {
28    #[doc = "Get enumerated values variant"]
29    #[inline(always)]
30    pub const fn variant(&self) -> Option<DAC_STATUS_A> {
31        match self.bits {
32            0 => Some(DAC_STATUS_A::U_NCONNECTED),
33            1 => Some(DAC_STATUS_A::C_ONNECTED),
34            3 => Some(DAC_STATUS_A::S_HORT),
35            _ => None,
36        }
37    }
38    #[doc = "Unconnected"]
39    #[inline(always)]
40    pub fn is_u_nconnected(&self) -> bool {
41        *self == DAC_STATUS_A::U_NCONNECTED
42    }
43    #[doc = "Connected"]
44    #[inline(always)]
45    pub fn is_c_onnected(&self) -> bool {
46        *self == DAC_STATUS_A::C_ONNECTED
47    }
48    #[doc = "Short to ground"]
49    #[inline(always)]
50    pub fn is_s_hort(&self) -> bool {
51        *self == DAC_STATUS_A::S_HORT
52    }
53}
54impl R {
55    #[doc = "Bits 0:1"]
56    #[inline(always)]
57    pub fn dac_status(&self) -> DAC_STATUS_R {
58        DAC_STATUS_R::new((self.bits & 3) as u8)
59    }
60}
61impl W {
62    #[doc = r" Writes raw bits to the register."]
63    #[doc = r""]
64    #[doc = r" # Safety"]
65    #[doc = r""]
66    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
67    #[inline(always)]
68    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
69        self.bits = bits;
70        self
71    }
72}
73#[doc = "TV Encoder DAC STAUTS Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`tve_dac_status::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`tve_dac_status::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
74pub struct TVE_DAC_STATUS_SPEC;
75impl crate::RegisterSpec for TVE_DAC_STATUS_SPEC {
76    type Ux = u32;
77}
78#[doc = "`read()` method returns [`tve_dac_status::R`](R) reader structure"]
79impl crate::Readable for TVE_DAC_STATUS_SPEC {}
80#[doc = "`write(|w| ..)` method takes [`tve_dac_status::W`](W) writer structure"]
81impl crate::Writable for TVE_DAC_STATUS_SPEC {
82    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
83    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
84}
85#[doc = "`reset()` method sets tve_dac_status to value 0"]
86impl crate::Resettable for TVE_DAC_STATUS_SPEC {
87    const RESET_VALUE: Self::Ux = 0;
88}