Struct rp2040_hal::vector_table::VectorTable
source · #[repr(C, align(256))]pub struct VectorTable { /* private fields */ }
Expand description
Data type for a properly aligned interrupt vector table
The VTOR register can only point to a 256 byte offsets - see Cortex-M0+ Devices Generic User Guide - so that is our required alignment. The vector table length depends on the number of interrupts the system supports. The first 16 words are defined in the ARM Cortex-M spec. The M0+ cores on RP2040 have 32 interrupts, of which only 26 are wired to external interrupt signals - but the last 6 can be used for software interrupts so leave room for them
Implementations§
source§impl VectorTable
impl VectorTable
sourcepub const fn new() -> VectorTable
pub const fn new() -> VectorTable
Create a new vector table. All entries will point to 0 - you must call init() on this to copy the current vector table before setting it as active
sourcepub fn init(&mut self, ppb: &mut PPB)
pub fn init(&mut self, ppb: &mut PPB)
Initialise our vector table by copying the current table on top of it
sourcepub fn register_handler(
&mut self,
interrupt_idx: usize,
interrupt_fn: extern "C" fn()
)
pub fn register_handler( &mut self, interrupt_idx: usize, interrupt_fn: extern "C" fn() )
Dynamically register a function as being an interrupt handler
sourcepub unsafe fn set_sp(&mut self, stack_pointer_address: usize)
pub unsafe fn set_sp(&mut self, stack_pointer_address: usize)
Set the stack pointer address in a VectorTable. This will be used on Reset
§Safety
There is no checking whether this is a valid stack pointer address
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VectorTable
impl RefUnwindSafe for VectorTable
impl Send for VectorTable
impl Sync for VectorTable
impl Unpin for VectorTable
impl UnwindSafe for VectorTable
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more