DeviceCommand

Enum DeviceCommand 

Source
pub enum DeviceCommand {
Show 29 variants Start, Pause, Terminate, Restart, GetStatus, SetDigitalOutput { pin: u32, value: bool, }, SetAnalogOutput { pin: u32, value: u32, }, SetPwmDuty { channel: usize, duty: u32, }, ConfigureServo { pin: u8, config: ServoConfig, }, SetServoAngle { pin: u8, angle: f32, }, SetServoSpeed { pin: u8, speed: f32, }, StopServo { pin: u8, }, I2cWrite { address: u8, data: Vec<u8>, }, I2cRead { address: u8, length: u8, }, I2cWriteRead { address: u8, write_data: Vec<u8>, read_length: u8, }, I2cScan, ConfigureUSPIBridge { config: USPIBridgeConfig, }, USPIBridgeCommand { command: Vec<u8>, }, SetDigitalOutputsBulk { pin_states: Vec<(u32, bool)>, }, SetPwmDutiesBulk { channel_duties: Vec<(usize, u32)>, }, ReadAnalogInputsBulk { pins: Vec<u32>, }, CheckPinCapability { pin: u8, capability: String, }, ValidatePinOperation { pin: u8, operation: String, }, ConfigureEncoder { encoder_index: u32, pin_a: u32, pin_b: u32, enabled: bool, sampling_4x: bool, }, ResetDigitalCounter { pin: u32, }, SetPinFunction { pin: u32, pin_function: PinFunction, }, Custom { request_type: u8, param1: u8, param2: u8, param3: u8, param4: u8, }, SetLogLevel(LevelFilter), UpdateModel(DeviceModel),
}
Expand description

Commands that can be sent to device threads

Variants§

§

Start

Start the device thread

§

Pause

Pause the device thread

§

Terminate

Terminate the device thread

§

Restart

Restart the device thread

§

GetStatus

Get the current status of the device thread

§

SetDigitalOutput

Set a digital output pin

Fields

§pin: u32
§value: bool
§

SetAnalogOutput

Set an analog output

Fields

§pin: u32
§value: u32
§

SetPwmDuty

Set PWM duty cycle

Fields

§channel: usize
§duty: u32
§

ConfigureServo

Configure a servo

Fields

§pin: u8
§

SetServoAngle

Set servo angle

Fields

§pin: u8
§angle: f32
§

SetServoSpeed

Set servo speed

Fields

§pin: u8
§speed: f32
§

StopServo

Stop servo

Fields

§pin: u8
§

I2cWrite

I2C write operation

Fields

§address: u8
§data: Vec<u8>
§

I2cRead

I2C read operation

Fields

§address: u8
§length: u8
§

I2cWriteRead

I2C write then read operation

Fields

§address: u8
§write_data: Vec<u8>
§read_length: u8
§

I2cScan

I2C bus scan

§

ConfigureUSPIBridge

Configure uSPIBridge

Fields

§

USPIBridgeCommand

Send uSPIBridge command

Fields

§command: Vec<u8>
§

SetDigitalOutputsBulk

Bulk set digital outputs

Fields

§pin_states: Vec<(u32, bool)>
§

SetPwmDutiesBulk

Bulk set PWM duty cycles

Fields

§channel_duties: Vec<(usize, u32)>
§

ReadAnalogInputsBulk

Bulk read analog inputs

Fields

§pins: Vec<u32>
§

CheckPinCapability

Check pin capability

Fields

§pin: u8
§capability: String
§

ValidatePinOperation

Validate pin operation

Fields

§pin: u8
§operation: String
§

ConfigureEncoder

Configure an encoder

Fields

§encoder_index: u32
§pin_a: u32
§pin_b: u32
§enabled: bool
§sampling_4x: bool
§

ResetDigitalCounter

Reset a digital counter

Fields

§pin: u32
§

SetPinFunction

Set pin function

Fields

§pin: u32
§pin_function: PinFunction
§

Custom

Custom command with raw parameters

Fields

§request_type: u8
§param1: u8
§param2: u8
§param3: u8
§param4: u8
§

SetLogLevel(LevelFilter)

Set log level

§

UpdateModel(DeviceModel)

Update device model

Trait Implementations§

Source§

impl Clone for DeviceCommand

Source§

fn clone(&self) -> DeviceCommand

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for DeviceCommand

Source§

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

Formats the value using the given formatter. Read more

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.