pub trait Cpu {
// Required method
unsafe fn write_protected(
&mut self,
change: ConfigurationChange,
register: &mut u8,
value: u8
);
// Provided methods
fn read_sp(&self) -> u16 { ... }
unsafe fn write_sp(&mut self, sp: u16) { ... }
fn read_sreg(&self) -> u8 { ... }
unsafe fn write_sreg(&mut self, sregval: u8) { ... }
fn interrupts_enabled(&self) -> bool { ... }
fn in_isr(&self) -> bool { ... }
}
Required Methods§
sourceunsafe fn write_protected(
&mut self,
change: ConfigurationChange,
register: &mut u8,
value: u8
)
unsafe fn write_protected( &mut self, change: ConfigurationChange, register: &mut u8, value: u8 )
Write to a protected register.
Provided Methods§
sourcefn read_sp(&self) -> u16
fn read_sp(&self) -> u16
Read the current stack pointer.
Note that it is critical this function is inlined if it is to read the SP value you expect :-).
sourceunsafe fn write_sp(&mut self, sp: u16)
unsafe fn write_sp(&mut self, sp: u16)
Write the stack pointer.
Note that it is critical this function is inlined if it is to read the SP value you expect :-).
sourceunsafe fn write_sreg(&mut self, sregval: u8)
unsafe fn write_sreg(&mut self, sregval: u8)
Write the status register
sourcefn interrupts_enabled(&self) -> bool
fn interrupts_enabled(&self) -> bool
Return true iff interrupts are enabled