# Haptics 0x01

Haptics data may be sent as either type 1 or type 2. Devices must implement handing of either type accordingly so that it can receive valid haptic information from any host.



:::warning
No acknowledgement is sent to the host for this command

:::

### C Struct Example

```clike
#pragma pack(push, 1) // Ensure byte alignment

typedef struct 
{
    uint8_t type;

    union 
    {
        // Frequency Amplitude pairs
        struct 
        {
            struct
            {
                uint16_t frequency_1;
                uint16_t amplitude_1;
                uint16_t frequency_2;
                uint16_t amplitude_2;
            } left;

            struct
            {
                uint16_t frequency_1;
                uint16_t amplitude_1;
                uint16_t frequency_2;
                uint16_t amplitude_2;
            } right;
            
        } type_1;

        // Basic ERM simulation model
        struct 
        {
            struct 
            {
                uint8_t amplitude;
                bool    brake;
            } left;

            struct 
            {
                uint8_t amplitude;
                bool    brake;
            } right;
            
        } type_2; 
    };
} sinput_haptic_s;

#pragma pack(pop)
```

## Haptics Type 1 - Precise Stereo Haptics

The haptic data is comprised of a frequency/amplitude pair. 

The target driving frequency range is **40hz to 2000Hz.**

| Byte | Data | Type | Value |
|------|------|------|-------|
| 0    | Command | uint8 | 0x01  |
| 1    | Type | uint8 | 0x01  |
| 2-3  | Frequency 1 Left | uint16 |       |
| 4-5  | Amplitude 1 Left | uint16 |       |
| 6-7  | Frequency 2 Left | uint16 |       |
| 8-9  | Amplitude 2 Left | uint16 |       |
| 2-3  | Frequency 1 Right | uint16 |       |
| 4-5  | Amplitude 1 Right | uint16 |       |
| 6-7  | Frequency 2 Right | uint16 |       |
| 8-9  | Amplitude 2 Right | uint16 |       |


## Haptics Type 2 - ERM Stereo Haptics

This is simply an 8 bit amplitude, and a bool brake value

| Byte | Data | Type | Value |
|------|------|------|-------|
| 0    | Command | uint8 | 0x01  |
| 1    | Type | uint8 | 0x02  |
| 2    | Amplitude Left | uint8 |       |
| 3    | Brake Left | bool |       |
| 4    | Amplitude Right | uint8 |       |
| 5    | Brake Right | bool |       |

---

**Documents**

- [SInput HID Protocol - v1.0.0](https://docs.handheldlegend.com/s/sinput/doc/sinput-hid-protocol-v100-jtULIgBMJu)
- [SInput HID Protocol - DEV](https://docs.handheldlegend.com/s/sinput/doc/sinput-hid-protocol-dev-SNSaEw36nc)