pokeys_thread/
commands.rs1use log::LevelFilter;
2use pokeys_lib::models::DeviceModel;
3use pokeys_lib::{ServoConfig, USPIBridgeConfig};
4
5#[derive(Debug, Clone)]
7pub enum DeviceCommand {
8 Start,
10 Pause,
12 Terminate,
14 Restart,
16 GetStatus,
18 SetDigitalOutput { pin: u32, value: bool },
20 SetAnalogOutput { pin: u32, value: u32 },
22 SetPwmDuty { channel: usize, duty: u32 },
24 ConfigureServo { pin: u8, config: ServoConfig },
26 SetServoAngle { pin: u8, angle: f32 },
28 SetServoSpeed { pin: u8, speed: f32 },
30 StopServo { pin: u8 },
32 I2cWrite { address: u8, data: Vec<u8> },
34 I2cRead { address: u8, length: u8 },
36 I2cWriteRead {
38 address: u8,
39 write_data: Vec<u8>,
40 read_length: u8,
41 },
42 I2cScan,
44 ConfigureUSPIBridge { config: USPIBridgeConfig },
46 USPIBridgeCommand { command: Vec<u8> },
48 SetDigitalOutputsBulk { pin_states: Vec<(u32, bool)> },
50 SetPwmDutiesBulk { channel_duties: Vec<(usize, u32)> },
52 ReadAnalogInputsBulk { pins: Vec<u32> },
54 CheckPinCapability { pin: u8, capability: String },
56 ValidatePinOperation { pin: u8, operation: String },
58 ConfigureEncoder {
60 encoder_index: u32,
61 pin_a: u32,
62 pin_b: u32,
63 enabled: bool,
64 sampling_4x: bool,
65 },
66 ResetDigitalCounter { pin: u32 },
68 SetPinFunction {
70 pin: u32,
71 pin_function: pokeys_lib::PinFunction,
72 },
73 Custom {
75 request_type: u8,
76 param1: u8,
77 param2: u8,
78 param3: u8,
79 param4: u8,
80 },
81 SetLogLevel(LevelFilter),
83 UpdateModel(DeviceModel),
85}