14#define FFB_ID_OFFSET 0x00
18#define HID_USAGE_X 0x30
19#define HID_USAGE_Y 0x31
20#define HID_USAGE_Z 0x32
21#define HID_USAGE_RX 0x33
22#define HID_USAGE_RY 0x34
23#define HID_USAGE_RZ 0x35
24#define HID_USAGE_SL0 0x36
25#define HID_USAGE_SL1 0x37
26#define HID_USAGE_WHL 0x38
27#define HID_USAGE_POV 0x39
30#define HID_USAGE_CONST 0x26
31#define HID_USAGE_RAMP 0x27
32#define HID_USAGE_SQUR 0x30
33#define HID_USAGE_SINE 0x31
34#define HID_USAGE_TRNG 0x32
35#define HID_USAGE_STUP 0x33
36#define HID_USAGE_STDN 0x34
37#define HID_USAGE_SPRNG 0x40
38#define HID_USAGE_DMPR 0x41
39#define HID_USAGE_INRT 0x42
40#define HID_USAGE_FRIC 0x43
44#define HID_ID_STATE 0x02
46#define HID_ID_EFFREP 0x01
47#define HID_ID_ENVREP 0x02
48#define HID_ID_CONDREP 0x03
49#define HID_ID_PRIDREP 0x04
50#define HID_ID_CONSTREP 0x05
51#define HID_ID_RAMPREP 0x06
52#define HID_ID_CSTMREP 0x07
53#define HID_ID_SMPLREP 0x08
54#define HID_ID_EFOPREP 0x0A
55#define HID_ID_BLKFRREP 0x0B
56#define HID_ID_CTRLREP 0x0C
57#define HID_ID_GAINREP 0x0D
58#define HID_ID_SETCREP 0x0E
60#define HID_ID_NEWEFREP 0x11
61#define HID_ID_BLKLDREP 0x12
62#define HID_ID_POOLREP 0x13
65#define HID_ID_CUSTOMCMD 0xAF
66#define HID_ID_HIDCMD 0xA1
67#define HID_ID_STRCMD 0xAC
72#define FFB_EFFECT_NONE 0x00
73#define FFB_EFFECT_CONSTANT 0x01
74#define FFB_EFFECT_RAMP 0x02
75#define FFB_EFFECT_SQUARE 0x03
76#define FFB_EFFECT_SINE 0x04
77#define FFB_EFFECT_TRIANGLE 0x05
78#define FFB_EFFECT_SAWTOOTHUP 0x06
79#define FFB_EFFECT_SAWTOOTHDOWN 0x07
80#define FFB_EFFECT_SPRING 0x08
81#define FFB_EFFECT_DAMPER 0x09
82#define FFB_EFFECT_INERTIA 0x0A
83#define FFB_EFFECT_FRICTION 0x0B
84#define FFB_EFFECT_CUSTOM 0x0C
86#define HID_ACTUATOR_POWER 0x08
87#define HID_SAFETY_SWITCH 0x04
88#define HID_ENABLE_ACTUATORS 0x02
89#define HID_EFFECT_PAUSE 0x01
90#define HID_ENABLE_ACTUATORS_MASK 0xFD
91#define HID_EFFECT_PLAYING 0x10
93#define HID_DIRECTION_ENABLE 0x04
94#define FFB_EFFECT_DURATION_INFINITE 0xffff
104 uint64_t buttons = 0;
142 report->Slider = val;
151 const uint8_t reportId = HID_ID_STATE+FFB_ID_OFFSET;
153 uint8_t status = (HID_ACTUATOR_POWER) | (HID_ENABLE_ACTUATORS);
161 uint8_t reportId = 1;
162 uint8_t effectBlockIndex = 0;
163 uint8_t effectType = 0;
164 uint16_t duration = 0;
165 uint16_t triggerRepeatInterval = 0;
166 uint16_t samplePeriod = 0;
167 uint16_t startDelay = 0;
169 uint8_t triggerButton = 0;
170 uint8_t enableAxis = 0;
171 uint16_t directionX = 0;
172 uint16_t directionY = 0;
184 uint8_t effectBlockIndex;
206 uint8_t effectBlockIndex;
214 uint16_t ramPoolSize = MAX_EFFECTS;
215 uint8_t maxSimultaneousEffects = MAX_EFFECTS;
216 uint8_t memoryManagement = 1;
223 uint8_t effectBlockIndex;
233 uint8_t effectBlockIndex;
243 uint8_t effectBlockIndex;
250 int16_t cpOffset = 0;
251 int16_t positiveCoefficient = 0;
252 int16_t negativeCoefficient = 0;
253 uint16_t positiveSaturation = 0;
254 uint16_t negativeSaturation = 0;
255 uint16_t deadBand = 0;
258 return (positiveCoefficient != 0 && positiveSaturation != 0) || (negativeCoefficient != 0 && negativeSaturation != 0);
265 uint8_t effectBlockIndex;
274 uint8_t type = FFB_EFFECT_NONE;
277 int16_t magnitude = 0;
278 int16_t startLevel = 0;
279 int16_t endLevel = 0;
280 float axisMagnitudes[MAX_AXIS] = {0};
285 uint32_t duration = FFB_EFFECT_DURATION_INFINITE;
286 uint16_t attackLevel = 0, fadeLevel = 0;
287 uint32_t attackTime = 0, fadeTime = 0;
289 std::unique_ptr<Biquad> filter[MAX_AXIS] = {
nullptr };
290 uint16_t startDelay = 0;
291 uint32_t startTime = 0;
292 uint16_t samplePeriod = 0;
293 bool useEnvelope =
false;
294 bool useSingleCondition =
true;
303 uint8_t effectBlockIndex;
void setHidReportAxis(reportHID_t *report, uint8_t idx, int16_t val)
struct __attribute__((__packed__)) reportHID_t
int16_t positiveCoefficient
uint8_t parameterBlockOffset
uint16_t negativeSaturation
uint16_t ramPoolAvailable
int16_t negativeCoefficient
uint16_t positiveSaturation