1#[repr(C)]
3pub struct RegisterBlock {
4 pub cr1: CR1,
6 pub cr2: CR2,
8 pub smcr: SMCR,
10 pub dier: DIER,
12 pub sr: SR,
14 pub egr: EGR,
16 _reserved_6_ccmr1: [u8; 0x04],
17 _reserved_7_ccmr2: [u8; 0x04],
18 pub ccer: CCER,
20 pub cnt: CNT,
22 pub psc: PSC,
24 pub arr: ARR,
26 pub rcr: RCR,
28 pub ccr: [CCR; 4],
30 pub bdtr: BDTR,
32}
33impl RegisterBlock {
34 #[inline(always)]
36 pub const fn ccmr1_input(&self) -> &CCMR1_INPUT {
37 unsafe { &*(self as *const Self).cast::<u8>().add(24usize).cast() }
38 }
39 #[inline(always)]
41 pub const fn ccmr1_output(&self) -> &CCMR1_OUTPUT {
42 unsafe { &*(self as *const Self).cast::<u8>().add(24usize).cast() }
43 }
44 #[inline(always)]
46 pub const fn ccmr2_input(&self) -> &CCMR2_INPUT {
47 unsafe { &*(self as *const Self).cast::<u8>().add(28usize).cast() }
48 }
49 #[inline(always)]
51 pub const fn ccmr2_output(&self) -> &CCMR2_OUTPUT {
52 unsafe { &*(self as *const Self).cast::<u8>().add(28usize).cast() }
53 }
54 #[inline(always)]
56 pub fn ccr1(&self) -> &CCR {
57 &self.ccr[0]
58 }
59 #[inline(always)]
61 pub fn ccr2(&self) -> &CCR {
62 &self.ccr[1]
63 }
64 #[inline(always)]
66 pub fn ccr3(&self) -> &CCR {
67 &self.ccr[2]
68 }
69 #[inline(always)]
71 pub fn ccr4(&self) -> &CCR {
72 &self.ccr[3]
73 }
74}
75pub type CR1 = crate::Reg<cr1::CR1_SPEC>;
77pub mod cr1;
79pub type CR2 = crate::Reg<cr2::CR2_SPEC>;
81pub mod cr2;
83pub type SMCR = crate::Reg<smcr::SMCR_SPEC>;
85pub mod smcr;
87pub type DIER = crate::Reg<dier::DIER_SPEC>;
89pub mod dier;
91pub type SR = crate::Reg<sr::SR_SPEC>;
93pub mod sr;
95pub type EGR = crate::Reg<egr::EGR_SPEC>;
97pub mod egr;
99pub type CCMR1_OUTPUT = crate::Reg<ccmr1_output::CCMR1_OUTPUT_SPEC>;
101pub mod ccmr1_output;
103pub type CCMR1_INPUT = crate::Reg<ccmr1_input::CCMR1_INPUT_SPEC>;
105pub mod ccmr1_input;
107pub type CCMR2_OUTPUT = crate::Reg<ccmr2_output::CCMR2_OUTPUT_SPEC>;
109pub mod ccmr2_output;
111pub type CCMR2_INPUT = crate::Reg<ccmr2_input::CCMR2_INPUT_SPEC>;
113pub mod ccmr2_input;
115pub type CCER = crate::Reg<ccer::CCER_SPEC>;
117pub mod ccer;
119pub type CNT = crate::Reg<cnt::CNT_SPEC>;
121pub mod cnt;
123pub type PSC = crate::Reg<psc::PSC_SPEC>;
125pub mod psc;
127pub type ARR = crate::Reg<arr::ARR_SPEC>;
129pub mod arr;
131pub type RCR = crate::Reg<rcr::RCR_SPEC>;
133pub mod rcr;
135pub type CCR = crate::Reg<ccr::CCR_SPEC>;
137pub mod ccr;
139pub type BDTR = crate::Reg<bdtr::BDTR_SPEC>;
141pub mod bdtr;