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§
Sourcefn now(&self) -> Instant
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.
Sourcefn delay(&self, d: Duration)
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.
Sourcefn read_input(&mut self) -> Option<InputState>
fn read_input(&mut self) -> Option<InputState>
Read gamepad input.
Sourcefn get_name(&mut self) -> Option<&'static str>
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.
Sourcefn log_debug<D: Display>(&mut self, src: &str, msg: D)
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.
Sourcefn log_error<D: Display>(&mut self, src: &str, msg: D)
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.
fn open_dir(&mut self, path: &[&str]) -> Result<Self::Dir, FSError>
Sourcefn has_headphones(&mut self) -> bool
fn has_headphones(&mut self) -> bool
Returns true if headphones are connected.
Sourcefn get_audio_buffer(&mut self) -> &mut [i16]
fn get_audio_buffer(&mut self) -> &mut [i16]
Get a writable slice of free audio buffer region.
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>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".