pub struct SimulatedHal { /* private fields */ }Expand description
Desktop/simulator HAL: 32 virtual GPIO pins + a tick counter for delay. PWM duty/freq tables, UART loopback buffers, and I2C/SPI echo devices.
Implementations§
Source§impl SimulatedHal
impl SimulatedHal
pub fn new() -> Self
Sourcepub fn set_adc(&mut self, channel: u8, raw: u16)
pub fn set_adc(&mut self, channel: u8, raw: u16)
Simulate an external sensor value on an ADC channel.
Sourcepub fn drive_pin(&mut self, pin: Pin, high: bool)
pub fn drive_pin(&mut self, pin: Pin, high: bool)
Externally drive a pin level (as if a button/sensor pulled it).
pub fn elapsed_ms(&self) -> u64
pub fn pwm_duty(&self, pin: Pin) -> Result<u16, String>
pub fn pwm_freq(&self, pin: Pin) -> Result<u32, String>
pub fn i2c_last_write(&self, addr: I2cAddr) -> Option<Vec<u8>>
Trait Implementations§
Source§impl Clone for SimulatedHal
impl Clone for SimulatedHal
Source§impl Debug for SimulatedHal
impl Debug for SimulatedHal
Source§impl Default for SimulatedHal
impl Default for SimulatedHal
Source§impl Gpio for SimulatedHal
impl Gpio for SimulatedHal
Source§impl I2c for SimulatedHal
impl I2c for SimulatedHal
Source§impl Pwm for SimulatedHal
impl Pwm for SimulatedHal
Source§impl Spi for SimulatedHal
impl Spi for SimulatedHal
Auto Trait Implementations§
impl !RefUnwindSafe for SimulatedHal
impl !Send for SimulatedHal
impl !Sync for SimulatedHal
impl !UnwindSafe for SimulatedHal
impl Freeze for SimulatedHal
impl Unpin for SimulatedHal
impl UnsafeUnpin for SimulatedHal
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
Mutably borrows from an owned value. Read more