d1_pac/tve/
tve_line_number.rs1#[doc = "Register `tve_line_number` reader"]
2pub type R = crate::R<TVE_LINE_NUMBER_SPEC>;
3#[doc = "Register `tve_line_number` writer"]
4pub type W = crate::W<TVE_LINE_NUMBER_SPEC>;
5#[doc = "Field `num_lines` reader - Specify the total number of lines in a video frame. 11 bits unsigned integer. Allowed range is 0 to 2048. For interlaced video: When NTSC, and FirstVideoLine is greater than 20, then NumLines is restricted to be greater than 2*(FirstVideoLine+18).\n\nWhen NTSC, and FirstVideoLine is not greater than 20, then NumLines is restricted to be greater than 77. When PAL, and FirstVideoLine is greater than 22, then NumLines is restricted to be greater than 2*(FirstVideoLine+18). When PAL, and FirstVideoLine is not greater than 22, then NumLines is restricted to be greater than 81.\n\nIf NumLines is even, then it is restricted to be divisible by 4. If NumLines is odd, then it is restricted to be divisible by 4 with a remainder of 1."]
6pub type NUM_LINES_R = crate::FieldReader<u16>;
7#[doc = "Field `num_lines` writer - Specify the total number of lines in a video frame. 11 bits unsigned integer. Allowed range is 0 to 2048. For interlaced video: When NTSC, and FirstVideoLine is greater than 20, then NumLines is restricted to be greater than 2*(FirstVideoLine+18).\n\nWhen NTSC, and FirstVideoLine is not greater than 20, then NumLines is restricted to be greater than 77. When PAL, and FirstVideoLine is greater than 22, then NumLines is restricted to be greater than 2*(FirstVideoLine+18). When PAL, and FirstVideoLine is not greater than 22, then NumLines is restricted to be greater than 81.\n\nIf NumLines is even, then it is restricted to be divisible by 4. If NumLines is odd, then it is restricted to be divisible by 4 with a remainder of 1."]
8pub type NUM_LINES_W<'a, REG> = crate::FieldWriter<'a, REG, 11, u16>;
9#[doc = "Field `first_video_line` reader - Specify the index of the first line in a field/frame to have active video. 8 bits unsigned integer.\n\nFor interlaced video: When VSync5=B'0', FirstVideoLine is restricted to be greater than 7. When VSync5=B'1', FirstVideoLine is restricted to be greater than 9."]
10pub type FIRST_VIDEO_LINE_R = crate::FieldReader;
11#[doc = "Field `first_video_line` writer - Specify the index of the first line in a field/frame to have active video. 8 bits unsigned integer.\n\nFor interlaced video: When VSync5=B'0', FirstVideoLine is restricted to be greater than 7. When VSync5=B'1', FirstVideoLine is restricted to be greater than 9."]
12pub type FIRST_VIDEO_LINE_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
13impl R {
14 #[doc = "Bits 0:10 - Specify the total number of lines in a video frame. 11 bits unsigned integer. Allowed range is 0 to 2048. For interlaced video: When NTSC, and FirstVideoLine is greater than 20, then NumLines is restricted to be greater than 2*(FirstVideoLine+18).\n\nWhen NTSC, and FirstVideoLine is not greater than 20, then NumLines is restricted to be greater than 77. When PAL, and FirstVideoLine is greater than 22, then NumLines is restricted to be greater than 2*(FirstVideoLine+18). When PAL, and FirstVideoLine is not greater than 22, then NumLines is restricted to be greater than 81.\n\nIf NumLines is even, then it is restricted to be divisible by 4. If NumLines is odd, then it is restricted to be divisible by 4 with a remainder of 1."]
15 #[inline(always)]
16 pub fn num_lines(&self) -> NUM_LINES_R {
17 NUM_LINES_R::new((self.bits & 0x07ff) as u16)
18 }
19 #[doc = "Bits 16:23 - Specify the index of the first line in a field/frame to have active video. 8 bits unsigned integer.\n\nFor interlaced video: When VSync5=B'0', FirstVideoLine is restricted to be greater than 7. When VSync5=B'1', FirstVideoLine is restricted to be greater than 9."]
20 #[inline(always)]
21 pub fn first_video_line(&self) -> FIRST_VIDEO_LINE_R {
22 FIRST_VIDEO_LINE_R::new(((self.bits >> 16) & 0xff) as u8)
23 }
24}
25impl W {
26 #[doc = "Bits 0:10 - Specify the total number of lines in a video frame. 11 bits unsigned integer. Allowed range is 0 to 2048. For interlaced video: When NTSC, and FirstVideoLine is greater than 20, then NumLines is restricted to be greater than 2*(FirstVideoLine+18).\n\nWhen NTSC, and FirstVideoLine is not greater than 20, then NumLines is restricted to be greater than 77. When PAL, and FirstVideoLine is greater than 22, then NumLines is restricted to be greater than 2*(FirstVideoLine+18). When PAL, and FirstVideoLine is not greater than 22, then NumLines is restricted to be greater than 81.\n\nIf NumLines is even, then it is restricted to be divisible by 4. If NumLines is odd, then it is restricted to be divisible by 4 with a remainder of 1."]
27 #[inline(always)]
28 #[must_use]
29 pub fn num_lines(&mut self) -> NUM_LINES_W<TVE_LINE_NUMBER_SPEC> {
30 NUM_LINES_W::new(self, 0)
31 }
32 #[doc = "Bits 16:23 - Specify the index of the first line in a field/frame to have active video. 8 bits unsigned integer.\n\nFor interlaced video: When VSync5=B'0', FirstVideoLine is restricted to be greater than 7. When VSync5=B'1', FirstVideoLine is restricted to be greater than 9."]
33 #[inline(always)]
34 #[must_use]
35 pub fn first_video_line(&mut self) -> FIRST_VIDEO_LINE_W<TVE_LINE_NUMBER_SPEC> {
36 FIRST_VIDEO_LINE_W::new(self, 16)
37 }
38 #[doc = r" Writes raw bits to the register."]
39 #[doc = r""]
40 #[doc = r" # Safety"]
41 #[doc = r""]
42 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
43 #[inline(always)]
44 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
45 self.bits = bits;
46 self
47 }
48}
49#[doc = "TV Encoder Line Number Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`tve_line_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_line_number::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
50pub struct TVE_LINE_NUMBER_SPEC;
51impl crate::RegisterSpec for TVE_LINE_NUMBER_SPEC {
52 type Ux = u32;
53}
54#[doc = "`read()` method returns [`tve_line_number::R`](R) reader structure"]
55impl crate::Readable for TVE_LINE_NUMBER_SPEC {}
56#[doc = "`write(|w| ..)` method takes [`tve_line_number::W`](W) writer structure"]
57impl crate::Writable for TVE_LINE_NUMBER_SPEC {
58 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
59 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
60}
61#[doc = "`reset()` method sets tve_line_number to value 0x0016_020d"]
62impl crate::Resettable for TVE_LINE_NUMBER_SPEC {
63 const RESET_VALUE: Self::Ux = 0x0016_020d;
64}