rp2040_pac/generic/
raw.rs
1use super::{marker, BitM, FieldSpec, RegisterSpec, Unsafe, Writable};
2pub struct R<REG: RegisterSpec> {
3 pub(crate) bits: REG::Ux,
4 pub(super) _reg: marker::PhantomData<REG>,
5}
6pub struct W<REG: RegisterSpec> {
7 #[doc = "Writable bits"]
8 pub(crate) bits: REG::Ux,
9 pub(super) _reg: marker::PhantomData<REG>,
10}
11pub struct FieldReader<FI = u8>
12where
13 FI: FieldSpec,
14{
15 pub(crate) bits: FI::Ux,
16 _reg: marker::PhantomData<FI>,
17}
18impl<FI: FieldSpec> FieldReader<FI> {
19 #[doc = " Creates a new instance of the reader."]
20 #[allow(unused)]
21 #[inline(always)]
22 pub(crate) const fn new(bits: FI::Ux) -> Self {
23 Self {
24 bits,
25 _reg: marker::PhantomData,
26 }
27 }
28}
29pub struct BitReader<FI = bool> {
30 pub(crate) bits: bool,
31 _reg: marker::PhantomData<FI>,
32}
33impl<FI> BitReader<FI> {
34 #[doc = " Creates a new instance of the reader."]
35 #[allow(unused)]
36 #[inline(always)]
37 pub(crate) const fn new(bits: bool) -> Self {
38 Self {
39 bits,
40 _reg: marker::PhantomData,
41 }
42 }
43}
44pub struct FieldWriter<'a, REG, const WI: u8, FI = u8, Safety = Unsafe>
45where
46 REG: Writable + RegisterSpec,
47 FI: FieldSpec,
48{
49 pub(crate) w: &'a mut W<REG>,
50 pub(crate) o: u8,
51 _field: marker::PhantomData<(FI, Safety)>,
52}
53impl<'a, REG, const WI: u8, FI, Safety> FieldWriter<'a, REG, WI, FI, Safety>
54where
55 REG: Writable + RegisterSpec,
56 FI: FieldSpec,
57{
58 #[doc = " Creates a new instance of the writer"]
59 #[allow(unused)]
60 #[inline(always)]
61 pub(crate) fn new(w: &'a mut W<REG>, o: u8) -> Self {
62 Self {
63 w,
64 o,
65 _field: marker::PhantomData,
66 }
67 }
68}
69pub struct BitWriter<'a, REG, FI = bool, M = BitM>
70where
71 REG: Writable + RegisterSpec,
72 bool: From<FI>,
73{
74 pub(crate) w: &'a mut W<REG>,
75 pub(crate) o: u8,
76 _field: marker::PhantomData<(FI, M)>,
77}
78impl<'a, REG, FI, M> BitWriter<'a, REG, FI, M>
79where
80 REG: Writable + RegisterSpec,
81 bool: From<FI>,
82{
83 #[doc = " Creates a new instance of the writer"]
84 #[allow(unused)]
85 #[inline(always)]
86 pub(crate) fn new(w: &'a mut W<REG>, o: u8) -> Self {
87 Self {
88 w,
89 o,
90 _field: marker::PhantomData,
91 }
92 }
93}