d1_pac/tve/
tve_vsync_number.rs

1#[doc = "Register `tve_vsync_number` reader"]
2pub type R = crate::R<TVE_VSYNC_NUMBER_SPEC>;
3#[doc = "Register `tve_vsync_number` writer"]
4pub type W = crate::W<TVE_VSYNC_NUMBER_SPEC>;
5#[doc = "Field `vsync5` reader - VSync5 Number of equalization pulse selection\n\nThis bit selects whether the number of equalization pulses is 5 or 6. This parameter is applicable only for interlaced video."]
6pub type VSYNC5_R = crate::BitReader<VSYNC5_A>;
7#[doc = "VSync5 Number of equalization pulse selection\n\nThis bit selects whether the number of equalization pulses is 5 or 6. This parameter is applicable only for interlaced video.\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum VSYNC5_A {
10    #[doc = "0: 5 equalization pulse(default)"]
11    _5 = 0,
12    #[doc = "1: 6 equalization pulses"]
13    _6 = 1,
14}
15impl From<VSYNC5_A> for bool {
16    #[inline(always)]
17    fn from(variant: VSYNC5_A) -> Self {
18        variant as u8 != 0
19    }
20}
21impl VSYNC5_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> VSYNC5_A {
25        match self.bits {
26            false => VSYNC5_A::_5,
27            true => VSYNC5_A::_6,
28        }
29    }
30    #[doc = "5 equalization pulse(default)"]
31    #[inline(always)]
32    pub fn is_5(&self) -> bool {
33        *self == VSYNC5_A::_5
34    }
35    #[doc = "6 equalization pulses"]
36    #[inline(always)]
37    pub fn is_6(&self) -> bool {
38        *self == VSYNC5_A::_6
39    }
40}
41#[doc = "Field `vsync5` writer - VSync5 Number of equalization pulse selection\n\nThis bit selects whether the number of equalization pulses is 5 or 6. This parameter is applicable only for interlaced video."]
42pub type VSYNC5_W<'a, REG> = crate::BitWriter<'a, REG, VSYNC5_A>;
43impl<'a, REG> VSYNC5_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "5 equalization pulse(default)"]
48    #[inline(always)]
49    pub fn _5(self) -> &'a mut crate::W<REG> {
50        self.variant(VSYNC5_A::_5)
51    }
52    #[doc = "6 equalization pulses"]
53    #[inline(always)]
54    pub fn _6(self) -> &'a mut crate::W<REG> {
55        self.variant(VSYNC5_A::_6)
56    }
57}
58impl R {
59    #[doc = "Bit 0 - VSync5 Number of equalization pulse selection\n\nThis bit selects whether the number of equalization pulses is 5 or 6. This parameter is applicable only for interlaced video."]
60    #[inline(always)]
61    pub fn vsync5(&self) -> VSYNC5_R {
62        VSYNC5_R::new((self.bits & 1) != 0)
63    }
64}
65impl W {
66    #[doc = "Bit 0 - VSync5 Number of equalization pulse selection\n\nThis bit selects whether the number of equalization pulses is 5 or 6. This parameter is applicable only for interlaced video."]
67    #[inline(always)]
68    #[must_use]
69    pub fn vsync5(&mut self) -> VSYNC5_W<TVE_VSYNC_NUMBER_SPEC> {
70        VSYNC5_W::new(self, 0)
71    }
72    #[doc = r" Writes raw bits to the register."]
73    #[doc = r""]
74    #[doc = r" # Safety"]
75    #[doc = r""]
76    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
77    #[inline(always)]
78    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
79        self.bits = bits;
80        self
81    }
82}
83#[doc = "TV Encoder VSYNC Number Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`tve_vsync_number::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_vsync_number::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
84pub struct TVE_VSYNC_NUMBER_SPEC;
85impl crate::RegisterSpec for TVE_VSYNC_NUMBER_SPEC {
86    type Ux = u32;
87}
88#[doc = "`read()` method returns [`tve_vsync_number::R`](R) reader structure"]
89impl crate::Readable for TVE_VSYNC_NUMBER_SPEC {}
90#[doc = "`write(|w| ..)` method takes [`tve_vsync_number::W`](W) writer structure"]
91impl crate::Writable for TVE_VSYNC_NUMBER_SPEC {
92    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
93    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
94}
95#[doc = "`reset()` method sets tve_vsync_number to value 0"]
96impl crate::Resettable for TVE_VSYNC_NUMBER_SPEC {
97    const RESET_VALUE: Self::Ux = 0;
98}