Skip to main content

Device

Trait Device 

Source
pub trait Device:
    Network
    + Serial
    + Wifi {
    type Dir: Dir;

Show 15 methods // Required methods fn now(&self) -> Instant; fn delay(&self, d: Duration); fn read_input(&mut self) -> Option<InputState>; fn get_name(&mut self) -> Option<&'static str>; fn log_debug<D: Display>(&mut self, src: &str, msg: D); fn log_error<D: Display>(&mut self, src: &str, msg: D); fn random(&mut self) -> u32; fn open_dir(&mut self, path: &[&str]) -> Result<Self::Dir, FSError>; fn has_headphones(&mut self) -> bool; fn get_audio_buffer(&mut self) -> &mut [i16]; fn get_battery_status(&mut self) -> Option<BatteryStatus>; fn write_main_flash( &mut self, offset: u32, data: &[u8], ) -> Result<(), &'static str>; fn write_io_flash( &mut self, offset: u32, data: &[u8], ) -> Result<(), NetworkError>; fn switch_main_partition(&mut self, part: u8) -> Result<(), &'static str>; fn switch_io_partition(&mut self, part: u8) -> Result<(), NetworkError>;
}

Required Associated Types§

Required Methods§

Source

fn now(&self) -> Instant

The current time.

Should be precise enough for adjusting the delay between frames.

Usually implemented as rtic_time.Monotonic. May also sometimes be implemented as rtic_monotonic.Monotonic.

Source

fn delay(&self, d: Duration)

Suspends the current thread for the given duration.

Should be precise enough for adjusting the delay between frames.

Usually implemented as embedded_hal.DelayNs.

Source

fn read_input(&mut self) -> Option<InputState>

Read gamepad input.

Source

fn get_name(&mut self) -> Option<&'static str>

Get device name override.

Used by emulator in multiplayer to give different names to multiple emulators running on the save vfs.

Source

fn log_debug<D: Display>(&mut self, src: &str, msg: D)

Log a debug message into console.

On hosted environments, it just prints into stdout. On embedded systems, use defmt.

Source

fn log_error<D: Display>(&mut self, src: &str, msg: D)

Log an error into console.

On hosted environments, it just prints into stderr. On embedded systems, use defmt.

Source

fn random(&mut self) -> u32

Get a random number.

Source

fn open_dir(&mut self, path: &[&str]) -> Result<Self::Dir, FSError>

Source

fn has_headphones(&mut self) -> bool

Returns true if headphones are connected.

Source

fn get_audio_buffer(&mut self) -> &mut [i16]

Get a writable slice of free audio buffer region.

Source

fn get_battery_status(&mut self) -> Option<BatteryStatus>

Source

fn write_main_flash( &mut self, offset: u32, data: &[u8], ) -> Result<(), &'static str>

Source

fn write_io_flash( &mut self, offset: u32, data: &[u8], ) -> Result<(), NetworkError>

Source

fn switch_main_partition(&mut self, part: u8) -> Result<(), &'static str>

Source

fn switch_io_partition(&mut self, part: u8) -> Result<(), NetworkError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§