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}
44#[must_use = "after creating `FieldWriter` you need to call field value setting method"]
45pub struct FieldWriter<'a, REG, const WI: u8, FI = u8, Safety = Unsafe>
46where
47 REG: Writable + RegisterSpec,
48 FI: FieldSpec,
49{
50 pub(crate) w: &'a mut W<REG>,
51 pub(crate) o: u8,
52 _field: marker::PhantomData<(FI, Safety)>,
53}
54impl<'a, REG, const WI: u8, FI, Safety> FieldWriter<'a, REG, WI, FI, Safety>
55where
56 REG: Writable + RegisterSpec,
57 FI: FieldSpec,
58{
59 #[doc = " Creates a new instance of the writer"]
60 #[allow(unused)]
61 #[inline(always)]
62 pub(crate) fn new(w: &'a mut W<REG>, o: u8) -> Self {
63 Self {
64 w,
65 o,
66 _field: marker::PhantomData,
67 }
68 }
69}
70#[must_use = "after creating `BitWriter` you need to call bit setting method"]
71pub struct BitWriter<'a, REG, FI = bool, M = BitM>
72where
73 REG: Writable + RegisterSpec,
74 bool: From<FI>,
75{
76 pub(crate) w: &'a mut W<REG>,
77 pub(crate) o: u8,
78 _field: marker::PhantomData<(FI, M)>,
79}
80impl<'a, REG, FI, M> BitWriter<'a, REG, FI, M>
81where
82 REG: Writable + RegisterSpec,
83 bool: From<FI>,
84{
85 #[doc = " Creates a new instance of the writer"]
86 #[allow(unused)]
87 #[inline(always)]
88 pub(crate) fn new(w: &'a mut W<REG>, o: u8) -> Self {
89 Self {
90 w,
91 o,
92 _field: marker::PhantomData,
93 }
94 }
95}