#[non_exhaustive]pub enum DeviceModel {
NanoS,
NanoSPlus,
NanoX,
Stax,
Flex,
NanoGen5,
}Expand description
Known device models.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Implementations§
Source§impl DeviceModel
impl DeviceModel
pub const ALL: [DeviceModel; 6]
Sourcepub fn id(self) -> &'static str
pub fn id(self) -> &'static str
Short identifier, compatible with the identifiers used by the manager API.
Sourcepub fn usb_product_id(self) -> u8
pub fn usb_product_id(self) -> u8
High byte of the USB product id when running the OS.
Sourcepub fn bootloader_product_id(self) -> u16
pub fn bootloader_product_id(self) -> u16
Full USB product id when the device is in bootloader mode.
Sourcepub fn target_id_mask(self) -> u32
pub fn target_id_mask(self) -> u32
Target id mask (target_id & 0xffff0000).
Sourcepub fn memory_size(self) -> u32
pub fn memory_size(self) -> u32
Flash memory available for apps, in bytes.
Sourcepub fn block_size(self, firmware_version: &str) -> u32
pub fn block_size(self, firmware_version: &str) -> u32
Flash block size, given the firmware version (only matters for the Nano S).
Sourcepub fn has_touch_screen(self) -> bool
pub fn has_touch_screen(self) -> bool
Whether the model has a touch screen.
Sourcepub fn has_battery(self) -> bool
pub fn has_battery(self) -> bool
Whether the model has a battery.
Sourcepub fn from_product_id(pid: u16) -> Option<Self>
pub fn from_product_id(pid: u16) -> Option<Self>
Identify the model from a USB product id (OS or bootloader).
Sourcepub fn from_target_id(target_id: u32) -> Option<Self>
pub fn from_target_id(target_id: u32) -> Option<Self>
Identify the model from a target id.
Sourcepub fn is_bootloader_product_id(pid: u16) -> bool
pub fn is_bootloader_product_id(pid: u16) -> bool
Whether the given product id corresponds to bootloader mode.
Trait Implementations§
Source§impl Clone for DeviceModel
impl Clone for DeviceModel
impl Copy for DeviceModel
Source§impl Debug for DeviceModel
impl Debug for DeviceModel
Source§impl<'de> Deserialize<'de> for DeviceModel
Available on crate feature serde only.
impl<'de> Deserialize<'de> for DeviceModel
Available on crate feature
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for DeviceModel
impl Display for DeviceModel
impl Eq for DeviceModel
Source§impl Hash for DeviceModel
impl Hash for DeviceModel
Source§impl PartialEq for DeviceModel
impl PartialEq for DeviceModel
Source§impl Serialize for DeviceModel
Available on crate feature serde only.
impl Serialize for DeviceModel
Available on crate feature
serde only.impl StructuralPartialEq for DeviceModel
Auto Trait Implementations§
impl Forget for DeviceModel
impl Freeze for DeviceModel
impl RefUnwindSafe for DeviceModel
impl Send for DeviceModel
impl Sync for DeviceModel
impl Unpin for DeviceModel
impl UnsafeUnpin for DeviceModel
impl UnwindSafe for DeviceModel
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