d1_pac/csic/csic_parser0/
csic_prs_ncsic_bt656_head_cfg.rs

1#[doc = "Register `csic_prs_ncsic_bt656_head_cfg` reader"]
2pub type R = crate::R<CSIC_PRS_NCSIC_BT656_HEAD_CFG_SPEC>;
3#[doc = "Register `csic_prs_ncsic_bt656_head_cfg` writer"]
4pub type W = crate::W<CSIC_PRS_NCSIC_BT656_HEAD_CFG_SPEC>;
5#[doc = "Field `ch_id[0-3]` reader - The low 4-bit of BT656 header for channel \\[i\\]\n\nOnly valid in BT656 multi-channel mode"]
6pub type CH_ID_R = crate::FieldReader;
7#[doc = "Field `ch_id[0-3]` writer - The low 4-bit of BT656 header for channel \\[i\\]\n\nOnly valid in BT656 multi-channel mode"]
8pub type CH_ID_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
9impl R {
10    #[doc = "The low 4-bit of BT656 header for channel \\[i\\]\n\nOnly valid in BT656 multi-channel mode\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `ch0_id` field"]
11    #[inline(always)]
12    pub fn ch_id(&self, n: u8) -> CH_ID_R {
13        #[allow(clippy::no_effect)]
14        [(); 4][n as usize];
15        CH_ID_R::new(((self.bits >> (n * 8)) & 0x0f) as u8)
16    }
17    #[doc = "Bits 0:3 - The low 4-bit of BT656 header for channel \\[i\\]\n\nOnly valid in BT656 multi-channel mode"]
18    #[inline(always)]
19    pub fn ch0_id(&self) -> CH_ID_R {
20        CH_ID_R::new((self.bits & 0x0f) as u8)
21    }
22    #[doc = "Bits 8:11 - The low 4-bit of BT656 header for channel \\[i\\]\n\nOnly valid in BT656 multi-channel mode"]
23    #[inline(always)]
24    pub fn ch1_id(&self) -> CH_ID_R {
25        CH_ID_R::new(((self.bits >> 8) & 0x0f) as u8)
26    }
27    #[doc = "Bits 16:19 - The low 4-bit of BT656 header for channel \\[i\\]\n\nOnly valid in BT656 multi-channel mode"]
28    #[inline(always)]
29    pub fn ch2_id(&self) -> CH_ID_R {
30        CH_ID_R::new(((self.bits >> 16) & 0x0f) as u8)
31    }
32    #[doc = "Bits 24:27 - The low 4-bit of BT656 header for channel \\[i\\]\n\nOnly valid in BT656 multi-channel mode"]
33    #[inline(always)]
34    pub fn ch3_id(&self) -> CH_ID_R {
35        CH_ID_R::new(((self.bits >> 24) & 0x0f) as u8)
36    }
37}
38impl W {
39    #[doc = "The low 4-bit of BT656 header for channel \\[i\\]\n\nOnly valid in BT656 multi-channel mode\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `ch0_id` field"]
40    #[inline(always)]
41    #[must_use]
42    pub fn ch_id(&mut self, n: u8) -> CH_ID_W<CSIC_PRS_NCSIC_BT656_HEAD_CFG_SPEC> {
43        #[allow(clippy::no_effect)]
44        [(); 4][n as usize];
45        CH_ID_W::new(self, n * 8)
46    }
47    #[doc = "Bits 0:3 - The low 4-bit of BT656 header for channel \\[i\\]\n\nOnly valid in BT656 multi-channel mode"]
48    #[inline(always)]
49    #[must_use]
50    pub fn ch0_id(&mut self) -> CH_ID_W<CSIC_PRS_NCSIC_BT656_HEAD_CFG_SPEC> {
51        CH_ID_W::new(self, 0)
52    }
53    #[doc = "Bits 8:11 - The low 4-bit of BT656 header for channel \\[i\\]\n\nOnly valid in BT656 multi-channel mode"]
54    #[inline(always)]
55    #[must_use]
56    pub fn ch1_id(&mut self) -> CH_ID_W<CSIC_PRS_NCSIC_BT656_HEAD_CFG_SPEC> {
57        CH_ID_W::new(self, 8)
58    }
59    #[doc = "Bits 16:19 - The low 4-bit of BT656 header for channel \\[i\\]\n\nOnly valid in BT656 multi-channel mode"]
60    #[inline(always)]
61    #[must_use]
62    pub fn ch2_id(&mut self) -> CH_ID_W<CSIC_PRS_NCSIC_BT656_HEAD_CFG_SPEC> {
63        CH_ID_W::new(self, 16)
64    }
65    #[doc = "Bits 24:27 - The low 4-bit of BT656 header for channel \\[i\\]\n\nOnly valid in BT656 multi-channel mode"]
66    #[inline(always)]
67    #[must_use]
68    pub fn ch3_id(&mut self) -> CH_ID_W<CSIC_PRS_NCSIC_BT656_HEAD_CFG_SPEC> {
69        CH_ID_W::new(self, 24)
70    }
71    #[doc = r" Writes raw bits to the register."]
72    #[doc = r""]
73    #[doc = r" # Safety"]
74    #[doc = r""]
75    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
76    #[inline(always)]
77    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
78        self.bits = bits;
79        self
80    }
81}
82#[doc = "CSIC Parser NCSIC BT656 Header Configuration Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`csic_prs_ncsic_bt656_head_cfg::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 [`csic_prs_ncsic_bt656_head_cfg::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
83pub struct CSIC_PRS_NCSIC_BT656_HEAD_CFG_SPEC;
84impl crate::RegisterSpec for CSIC_PRS_NCSIC_BT656_HEAD_CFG_SPEC {
85    type Ux = u32;
86}
87#[doc = "`read()` method returns [`csic_prs_ncsic_bt656_head_cfg::R`](R) reader structure"]
88impl crate::Readable for CSIC_PRS_NCSIC_BT656_HEAD_CFG_SPEC {}
89#[doc = "`write(|w| ..)` method takes [`csic_prs_ncsic_bt656_head_cfg::W`](W) writer structure"]
90impl crate::Writable for CSIC_PRS_NCSIC_BT656_HEAD_CFG_SPEC {
91    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
92    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
93}
94#[doc = "`reset()` method sets csic_prs_ncsic_bt656_head_cfg to value 0x0302_0100"]
95impl crate::Resettable for CSIC_PRS_NCSIC_BT656_HEAD_CFG_SPEC {
96    const RESET_VALUE: Self::Ux = 0x0302_0100;
97}