embassy-usb

Crates

git

Versions

default

Flavors

Skip to main content

ConsumerReport

Struct ConsumerReport 

Source
pub struct ConsumerReport {
    pub usage_id: u16,
}
Expand description

Consumer Control report carrying a 16-bit usage code (2 bytes).

When no media key is pressed, usage_id is set to 0.

Fields§

§usage_id: u16

16-bit Consumer Page Usage ID.

Implementations§

Source§

impl ConsumerReport

Source

pub const PLAY_PAUSE: u16 = 0x00CD

Play/Pause toggle.

Source

pub const SCAN_NEXT_TRACK: u16 = 0x00B5

Scan next track.

Source

pub const SCAN_PREV_TRACK: u16 = 0x00B6

Scan previous track.

Source

pub const STOP: u16 = 0x00B7

Stop playback.

Source

pub const RECORD: u16 = 0x00B2

Record.

Source

pub const FAST_FORWARD: u16 = 0x00B3

Fast forward.

Source

pub const REWIND: u16 = 0x00B4

Rewind.

Source

pub const EJECT: u16 = 0x00B8

Eject media.

Source

pub const VOLUME_INCREMENT: u16 = 0x00E9

Volume increment (Volume Up).

Source

pub const VOLUME_DECREMENT: u16 = 0x00EA

Volume decrement (Volume Down).

Source

pub const MUTE: u16 = 0x00E2

Mute audio.

Source

pub const BRIGHTNESS_INCREMENT: u16 = 0x006F

Increase display brightness.

Source

pub const BRIGHTNESS_DECREMENT: u16 = 0x0070

Decrease display brightness.

Source

pub const AL_CALCULATOR: u16 = 0x0192

Launch Calculator.

Source

pub const AL_EMAIL: u16 = 0x018A

Launch Default Email Client.

Source

pub const AL_BROWSER: u16 = 0x0196

Launch Internet Browser.

Source

pub const AL_FILE_BROWSER: u16 = 0x0194

Launch File Browser / Local Machine Browser.

Contextual Search.

Source

pub const AC_HOME: u16 = 0x0223

Browser / App Home.

Source

pub const AC_BACK: u16 = 0x0224

Browser / App Back.

Source

pub const AC_FORWARD: u16 = 0x0225

Browser / App Forward.

Source

pub const AC_STOP: u16 = 0x0226

Browser / App Stop.

Source

pub const AC_REFRESH: u16 = 0x0227

Browser / App Refresh.

Source

pub const AC_BOOKMARKS: u16 = 0x022A

Browser Bookmarks.

Source

pub const DESCRIPTOR: &'static [u8]

Standard USB HID Consumer Control report descriptor without report ID (2 bytes input report).

Source

pub fn parse(buf: &[u8]) -> Option<Self>

Parse a consumer report from a byte slice. Returns None if buf is shorter than 2 bytes.

Source

pub const fn to_bytes(&self) -> [u8; 2]

Serialize the consumer report into 2 little-endian bytes.

Source

pub const fn release() -> Self

Creates a report with no keys pressed (usage_id = 0).

Source

pub const fn from_key(usage_id: u16) -> Self

Creates a report with the specified media key.

Trait Implementations§

Source§

impl Clone for ConsumerReport

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ConsumerReport

Source§

impl Debug for ConsumerReport

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ConsumerReport

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for ConsumerReport

Source§

impl Format for ConsumerReport

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl PartialEq for ConsumerReport

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ConsumerReport

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.