forked from tloimu/adapt-ffb-joy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ffb-pro.h
75 lines (63 loc) · 2.75 KB
/
ffb-pro.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef _FFB_PRO_
#define _FFB_PRO_
#include <stdint.h>
#include "ffb.h"
// ----------------------------------
// Microsoft Sidewinder Force Feedback Pro FFB structures
typedef struct
{
uint8_t command; // always 0x23 -- start counting checksum from here
uint8_t waveForm; // 2=sine, 5=Square, 6=RampUp, 7=RampDown, 8=Triange, 0x12=Constant
uint8_t unknown1; // ? always 0x7F
uint16_t duration; // unit=2ms
uint16_t unknown2; // ? always 0x0000
uint16_t direction;
uint8_t unknown3[5]; // ? always 7f 64 00 10 4e
uint8_t attackLevel;
uint16_t attackTime;
uint8_t magnitude;
uint16_t fadeTime;
uint8_t fadeLevel;
uint8_t waveLength; // 0x6F..0x01 => 1/Hz
uint8_t unknown5; // ? always 0x00
uint16_t param1; // Varies by effect type; Constant: positive=7f 00, negative=01 01, Other effects: 01 01
uint16_t param2; // Varies by effect type; Constant: 00 00, Other effects 01 01
} FFP_MIDI_Effect_Basic;
typedef struct
{
uint8_t command; // always 0x23 -- start counting checksum from here
uint8_t waveForm; // 0xd=Spring, 0x0e=Damper, 0xf=Inertia
uint8_t unknown1; // ? always 0x7F
uint16_t duration; // unit=2ms
uint16_t unknown2; // ? always 0x0000
uint16_t coeffAxis0;
uint16_t coeffAxis1;
uint16_t offsetAxis0;
uint16_t offsetAxis1;
} FFP_MIDI_Effect_Spring_Inertia_Damper;
typedef struct
{
uint8_t command; // always 0x23 -- start counting checksum from here
uint8_t waveForm; // 0x10=Friction
uint8_t unknown1; // ? always 0x7F
uint16_t duration; // unit=2ms
uint16_t unknown2; // ? always 0x0000
uint16_t coeffAxis0;
uint16_t coeffAxis1;
} FFP_MIDI_Effect_Friction;
void FfbproEnableInterrupts(void);
const uint8_t* FfbproGetSysExHeader(uint8_t* hdr_len);
void FfbproSetAutoCenter(uint8_t enable);
void FfbproStartEffect(uint8_t id);
void FfbproStopEffect(uint8_t id);
void FfbproFreeEffect(uint8_t id);
void FfbproModifyDuration(uint8_t effectId, uint16_t duration);
void FfbproSetEnvelope(USB_FFBReport_SetEnvelope_Output_Data_t* data, volatile TEffectState* effect);
void FfbproSetCondition(USB_FFBReport_SetCondition_Output_Data_t* data, volatile TEffectState* effect);
void FfbproSetPeriodic(USB_FFBReport_SetPeriodic_Output_Data_t* data, volatile TEffectState* effect);
void FfbproSetConstantForce(USB_FFBReport_SetConstantForce_Output_Data_t* data, volatile TEffectState* effect);
void FfbproSetRampForce(USB_FFBReport_SetRampForce_Output_Data_t* data, volatile TEffectState* effect);
int FfbproSetEffect(USB_FFBReport_SetEffect_Output_Data_t *data, volatile TEffectState* effect);
void FfbproCreateNewEffect(USB_FFBReport_CreateNewEffect_Feature_Data_t* inData, volatile TEffectState* effect);
uint8_t FfbproUsbToMidiEffectType(uint8_t usb_effect_type);
#endif // _FFB_PRO_