File tree Expand file tree Collapse file tree 1 file changed +0
-30
lines changed Expand file tree Collapse file tree 1 file changed +0
-30
lines changed Original file line number Diff line number Diff line change 7
7
use core:: cell:: UnsafeCell ;
8
8
use core:: marker:: PhantomData ;
9
9
10
- /// A peripheral
11
- #[ derive( Debug ) ]
12
- pub struct Peripheral < T >
13
- where
14
- T : ' static ,
15
- {
16
- address : * mut T ,
17
- }
18
-
19
- impl < T > Peripheral < T > {
20
- /// Creates a new peripheral
21
- ///
22
- /// `address` is the base address of the register block
23
- pub const unsafe fn new ( address : usize ) -> Self {
24
- Peripheral {
25
- address : address as * mut T ,
26
- }
27
- }
28
-
29
- /// Borrows the peripheral for the duration of a critical section
30
- pub fn borrow < ' cs > ( & self , _ctxt : CriticalSection < ' cs > ) -> & ' cs T {
31
- unsafe { & * self . get ( ) }
32
- }
33
-
34
- /// Returns a pointer to the register block
35
- pub fn get ( & self ) -> * mut T {
36
- self . address as * mut T
37
- }
38
- }
39
-
40
10
/// Critical section token
41
11
///
42
12
/// Indicates that you are executing code within a critical section
You can’t perform that action at this time.
0 commit comments