#[doc = "Serial Peripheral Interface 0"]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Spi0 {
ptr: *mut u8,
}
unsafe impl Send for Spi0 {}
unsafe impl Sync for Spi0 {}
impl Spi0 {
#[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 = "Control Register"]
#[inline(always)]
pub const fn cr(self) -> crate::common::Reg<regs::Cr, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Mode Register"]
#[inline(always)]
pub const fn mr(self) -> crate::common::Reg<regs::Mr, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Receive Data Register"]
#[inline(always)]
pub const fn rdr(self) -> crate::common::Reg<regs::Rdr, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Transmit Data Register"]
#[inline(always)]
pub const fn tdr(self) -> crate::common::Reg<regs::Tdr, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
#[doc = "Status Register"]
#[inline(always)]
pub const fn sr(self) -> crate::common::Reg<regs::Sr, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
#[doc = "Interrupt Enable Register"]
#[inline(always)]
pub const fn ier(self) -> crate::common::Reg<regs::Ier, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x14usize) as _) }
}
#[doc = "Interrupt Disable Register"]
#[inline(always)]
pub const fn idr(self) -> crate::common::Reg<regs::Idr, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x18usize) as _) }
}
#[doc = "Interrupt Mask Register"]
#[inline(always)]
pub const fn imr(self) -> crate::common::Reg<regs::Imr, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x1cusize) as _) }
}
#[doc = "Chip Select Register"]
#[inline(always)]
pub const fn csr(self, n: usize) -> crate::common::Reg<regs::Csr, crate::common::RW> {
assert!(n < 4usize);
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x30usize + n * 4usize) as _) }
}
#[doc = "Write Protection Control Register"]
#[inline(always)]
pub const fn wpmr(self) -> crate::common::Reg<regs::Wpmr, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xe4usize) as _) }
}
#[doc = "Write Protection Status Register"]
#[inline(always)]
pub const fn wpsr(self) -> crate::common::Reg<regs::Wpsr, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xe8usize) as _) }
}
}
pub mod regs;
pub mod vals;