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 { bits, _reg: marker::PhantomData }
24 }
25}
26pub struct BitReader<FI = bool> {
27 pub(crate) bits: bool,
28 _reg: marker::PhantomData<FI>,
29}
30impl<FI> BitReader<FI> {
31 #[doc = " Creates a new instance of the reader."]
32 #[allow(unused)]
33 #[inline(always)]
34 pub(crate) const fn new(bits: bool) -> Self {
35 Self { bits, _reg: marker::PhantomData }
36 }
37}
38#[must_use = "after creating `FieldWriter` you need to call field value setting method"]
39pub struct FieldWriter<'a, REG, const WI: u8, FI = u8, Safety = Unsafe>
40where
41 REG: Writable + RegisterSpec,
42 FI: FieldSpec,
43{
44 pub(crate) w: &'a mut W<REG>,
45 pub(crate) o: u8,
46 _field: marker::PhantomData<(FI, Safety)>,
47}
48impl<'a, REG, const WI: u8, FI, Safety> FieldWriter<'a, REG, WI, FI, Safety>
49where
50 REG: Writable + RegisterSpec,
51 FI: FieldSpec,
52{
53 #[doc = " Creates a new instance of the writer"]
54 #[allow(unused)]
55 #[inline(always)]
56 pub(crate) fn new(w: &'a mut W<REG>, o: u8) -> Self {
57 Self { w, o, _field: marker::PhantomData }
58 }
59}
60#[must_use = "after creating `BitWriter` you need to call bit setting method"]
61pub struct BitWriter<'a, REG, FI = bool, M = BitM>
62where
63 REG: Writable + RegisterSpec,
64 bool: From<FI>,
65{
66 pub(crate) w: &'a mut W<REG>,
67 pub(crate) o: u8,
68 _field: marker::PhantomData<(FI, M)>,
69}
70impl<'a, REG, FI, M> BitWriter<'a, REG, FI, M>
71where
72 REG: Writable + RegisterSpec,
73 bool: From<FI>,
74{
75 #[doc = " Creates a new instance of the writer"]
76 #[allow(unused)]
77 #[inline(always)]
78 pub(crate) fn new(w: &'a mut W<REG>, o: u8) -> Self {
79 Self { w, o, _field: marker::PhantomData }
80 }
81}