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