Flipper/Applications/Official/DEV_FW/source/xMasterX/flipper-bp/tcode.h

63 lines
1.3 KiB
C
Raw Normal View History

2023-01-26 07:52:38 +00:00
#pragma once
#include <furi.h>
typedef enum {
Device,
Magnitude,
MagnitudeTimeInterval,
MagnitudeSpeed,
Unknown,
} TCodeCommandType;
typedef enum {
DeviceIdentification,
TCodeVersion,
ListAxesAndUserRangePreferences,
Stop,
} DeviceCommand;
typedef enum {
Linear,
Rotate,
Vibrate,
Auxiliary,
} TCodeCommandMotionType;
typedef struct {
TCodeCommandMotionType motion_type;
uint8_t channel_id;
float magnitude;
} TCodeMagnitudeCommand;
typedef struct {
TCodeCommandMotionType motion_type;
uint8_t channel_id;
float magnitude;
uint16_t time_interval_milliseconds;
} TCodeMagnitudeTimeIntervalCommand;
typedef struct {
TCodeCommandMotionType motion_type;
uint8_t channel_id;
float magnitude;
uint16_t speed_per_hundred_milliseconds;
} TCodeMagnitudeSpeedCommand;
typedef struct {
TCodeCommandType command_type;
union {
DeviceCommand device_command;
TCodeMagnitudeCommand magnitude_command;
TCodeMagnitudeTimeIntervalCommand magnitude_time_interval_command;
TCodeMagnitudeSpeedCommand magnitude_speed_command;
} data;
} TCodeCommand;
typedef struct {
uint16_t size;
TCodeCommand *commands;
} TCodeCommandArray;
TCodeCommandArray tcode_decode(uint8_t *buffer, uint16_t size);