nrf52840_pac/radio/
prefix0.rs

1#[doc = "Register `PREFIX0` reader"]
2pub struct R(crate::R<PREFIX0_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PREFIX0_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PREFIX0_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PREFIX0_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `PREFIX0` writer"]
17pub struct W(crate::W<PREFIX0_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<PREFIX0_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<PREFIX0_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<PREFIX0_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `AP0` reader - Address prefix 0."]
38pub type AP0_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `AP0` writer - Address prefix 0."]
40pub type AP0_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PREFIX0_SPEC, u8, u8, 8, O>;
41#[doc = "Field `AP1` reader - Address prefix 1."]
42pub type AP1_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `AP1` writer - Address prefix 1."]
44pub type AP1_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PREFIX0_SPEC, u8, u8, 8, O>;
45#[doc = "Field `AP2` reader - Address prefix 2."]
46pub type AP2_R = crate::FieldReader<u8, u8>;
47#[doc = "Field `AP2` writer - Address prefix 2."]
48pub type AP2_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PREFIX0_SPEC, u8, u8, 8, O>;
49#[doc = "Field `AP3` reader - Address prefix 3."]
50pub type AP3_R = crate::FieldReader<u8, u8>;
51#[doc = "Field `AP3` writer - Address prefix 3."]
52pub type AP3_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PREFIX0_SPEC, u8, u8, 8, O>;
53impl R {
54    #[doc = "Bits 0:7 - Address prefix 0."]
55    #[inline(always)]
56    pub fn ap0(&self) -> AP0_R {
57        AP0_R::new((self.bits & 0xff) as u8)
58    }
59    #[doc = "Bits 8:15 - Address prefix 1."]
60    #[inline(always)]
61    pub fn ap1(&self) -> AP1_R {
62        AP1_R::new(((self.bits >> 8) & 0xff) as u8)
63    }
64    #[doc = "Bits 16:23 - Address prefix 2."]
65    #[inline(always)]
66    pub fn ap2(&self) -> AP2_R {
67        AP2_R::new(((self.bits >> 16) & 0xff) as u8)
68    }
69    #[doc = "Bits 24:31 - Address prefix 3."]
70    #[inline(always)]
71    pub fn ap3(&self) -> AP3_R {
72        AP3_R::new(((self.bits >> 24) & 0xff) as u8)
73    }
74}
75impl W {
76    #[doc = "Bits 0:7 - Address prefix 0."]
77    #[inline(always)]
78    pub fn ap0(&mut self) -> AP0_W<0> {
79        AP0_W::new(self)
80    }
81    #[doc = "Bits 8:15 - Address prefix 1."]
82    #[inline(always)]
83    pub fn ap1(&mut self) -> AP1_W<8> {
84        AP1_W::new(self)
85    }
86    #[doc = "Bits 16:23 - Address prefix 2."]
87    #[inline(always)]
88    pub fn ap2(&mut self) -> AP2_W<16> {
89        AP2_W::new(self)
90    }
91    #[doc = "Bits 24:31 - Address prefix 3."]
92    #[inline(always)]
93    pub fn ap3(&mut self) -> AP3_W<24> {
94        AP3_W::new(self)
95    }
96    #[doc = "Writes raw bits to the register."]
97    #[inline(always)]
98    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
99        self.0.bits(bits);
100        self
101    }
102}
103#[doc = "Prefixes bytes for logical addresses 0-3\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [prefix0](index.html) module"]
104pub struct PREFIX0_SPEC;
105impl crate::RegisterSpec for PREFIX0_SPEC {
106    type Ux = u32;
107}
108#[doc = "`read()` method returns [prefix0::R](R) reader structure"]
109impl crate::Readable for PREFIX0_SPEC {
110    type Reader = R;
111}
112#[doc = "`write(|w| ..)` method takes [prefix0::W](W) writer structure"]
113impl crate::Writable for PREFIX0_SPEC {
114    type Writer = W;
115}
116#[doc = "`reset()` method sets PREFIX0 to value 0"]
117impl crate::Resettable for PREFIX0_SPEC {
118    #[inline(always)]
119    fn reset_value() -> Self::Ux {
120        0
121    }
122}