-
Notifications
You must be signed in to change notification settings - Fork 5
/
pads.rs
31 lines (31 loc) · 933 Bytes
/
pads.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Pads {
ptr: *mut u8,
}
unsafe impl Send for Pads {}
unsafe impl Sync for Pads {}
impl Pads {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Voltage select. Per bank control"]
#[inline(always)]
pub const fn voltage_select(
self,
) -> crate::common::Reg<regs::VoltageSelect, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0usize) as _) }
}
#[doc = "Pad control register"]
#[inline(always)]
pub const fn gpio(self, n: usize) -> crate::common::Reg<regs::GpioCtrl, crate::common::RW> {
assert!(n < 32usize);
unsafe { crate::common::Reg::from_ptr(self.ptr.add(4usize + n * 4usize) as _) }
}
}
pub mod regs;
pub mod vals;