RetroArch
Classes | Macros | Typedefs | Functions | Variables
device_ds3.c File Reference
#include "hid_device_driver.h"
Include dependency graph for device_ds3.c:

Classes

struct  ds3_instance
 

Macros

#define DS3_ACTIVATION_REPORT_ID   0xf4
 
#define DS3_RUMBLE_REPORT_ID   0x01
 
#define PACKET_OFFSET   0
 
#define LED_OFFSET   11
 
#define MOTOR1_OFFSET   4
 
#define MOTOR2_OFFSET   6
 

Typedefs

typedef struct ds3_instance ds3_instance_t
 

Functions

static void update_pad_state (ds3_instance_t *instance)
 
static void update_analog_state (ds3_instance_t *instance)
 
static int32_t send_activation_packet (ds3_instance_t *instance)
 
static uint32_t set_protocol (ds3_instance_t *instance, int protocol)
 
static int32_t send_control_packet (ds3_instance_t *instance)
 
static voidds3_init (void *handle)
 
static void ds3_free (void *data)
 
static void ds3_handle_packet (void *data, uint8_t *packet, size_t size)
 
static bool ds3_detect (uint16_t vendor_id, uint16_t product_id)
 
static voidds3_pad_init (void *data, uint32_t slot, hid_driver_t *driver)
 
static void ds3_pad_deinit (void *data)
 
static void ds3_get_buttons (void *data, input_bits_t *state)
 
static void ds3_packet_handler (void *data, uint8_t *packet, uint16_t size)
 
static void ds3_set_rumble (void *data, enum retro_rumble_effect effect, uint16_t strength)
 
static int16_t ds3_get_axis (void *data, unsigned axis)
 
static const char * ds3_get_name (void *data)
 
static bool ds3_button (void *data, uint16_t joykey)
 

Variables

static uint8_t activation_packet []
 
static uint8_t control_packet []
 
static int control_packet_size = sizeof(control_packet)
 
pad_connection_interface_t ds3_pad_connection
 
hid_device_t ds3_hid_device
 

Macro Definition Documentation

◆ DS3_ACTIVATION_REPORT_ID

#define DS3_ACTIVATION_REPORT_ID   0xf4

◆ DS3_RUMBLE_REPORT_ID

#define DS3_RUMBLE_REPORT_ID   0x01

◆ LED_OFFSET

#define LED_OFFSET   11

◆ MOTOR1_OFFSET

#define MOTOR1_OFFSET   4

◆ MOTOR2_OFFSET

#define MOTOR2_OFFSET   6

◆ PACKET_OFFSET

#define PACKET_OFFSET   0

Typedef Documentation

◆ ds3_instance_t

typedef struct ds3_instance ds3_instance_t

Function Documentation

◆ ds3_button()

static bool ds3_button ( void data,
uint16_t  joykey 
)
static

◆ ds3_detect()

static bool ds3_detect ( uint16_t  vendor_id,
uint16_t  product_id 
)
static

◆ ds3_free()

static void ds3_free ( void data)
static
Here is the call graph for this function:

◆ ds3_get_axis()

static int16_t ds3_get_axis ( void data,
unsigned  axis 
)
static
Here is the call graph for this function:

◆ ds3_get_buttons()

static void ds3_get_buttons ( void data,
input_bits_t state 
)
static

◆ ds3_get_name()

static const char* ds3_get_name ( void data)
static

◆ ds3_handle_packet()

static void ds3_handle_packet ( void data,
uint8_t packet,
size_t  size 
)
static

◆ ds3_init()

static void* ds3_init ( void handle)
static
Here is the call graph for this function:

◆ ds3_packet_handler()

static void ds3_packet_handler ( void data,
uint8_t packet,
uint16_t  size 
)
static
Here is the call graph for this function:

◆ ds3_pad_deinit()

static void ds3_pad_deinit ( void data)
static
Here is the call graph for this function:

◆ ds3_pad_init()

static void* ds3_pad_init ( void data,
uint32_t  slot,
hid_driver_t driver 
)
static

pad interface implementation

◆ ds3_set_rumble()

static void ds3_set_rumble ( void data,
enum retro_rumble_effect  effect,
uint16_t  strength 
)
static

◆ send_activation_packet()

static int32_t send_activation_packet ( ds3_instance_t instance)
static
Here is the caller graph for this function:

◆ send_control_packet()

static int32_t send_control_packet ( ds3_instance_t instance)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_protocol()

static uint32_t set_protocol ( ds3_instance_t instance,
int  protocol 
)
static
Here is the caller graph for this function:

◆ update_analog_state()

static void update_analog_state ( ds3_instance_t instance)
static
Here is the caller graph for this function:

◆ update_pad_state()

static void update_pad_state ( ds3_instance_t instance)
static
Here is the caller graph for this function:

Variable Documentation

◆ activation_packet

uint8_t activation_packet[]
static
Initial value:
= {
0x42, 0x0c, 0x00, 0x00
}

◆ control_packet

uint8_t control_packet[]
static
Initial value:
= {
0x52, 0x01,
0x00, 0xff, 0x00, 0xff, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0x27, 0x10, 0x00, 0x32,
0xff, 0x27, 0x10, 0x00, 0x32,
0xff, 0x27, 0x10, 0x00, 0x32,
0xff, 0x27, 0x10, 0x00, 0x32,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00
}

◆ control_packet_size

int control_packet_size = sizeof(control_packet)
static

◆ ds3_hid_device

hid_device_t ds3_hid_device
Initial value:
= {
"Sony DualShock 3"
}
static void * ds3_init(void *handle)
Definition: device_ds3.c:133
static void ds3_handle_packet(void *data, uint8_t *packet, size_t size)
Definition: device_ds3.c:185
static bool ds3_detect(uint16_t vendor_id, uint16_t product_id)
Definition: device_ds3.c:195
static void ds3_free(void *data)
Definition: device_ds3.c:175

◆ ds3_pad_connection

pad_connection_interface_t ds3_pad_connection
Initial value:
= {
}
static int16_t ds3_get_axis(void *data, unsigned axis)
Definition: device_ds3.c:319
static void ds3_set_rumble(void *data, enum retro_rumble_effect effect, uint16_t strength)
Definition: device_ds3.c:314
static void ds3_pad_deinit(void *data)
Definition: device_ds3.c:220
static void ds3_get_buttons(void *data, input_bits_t *state)
Definition: device_ds3.c:228
static void ds3_packet_handler(void *data, uint8_t *packet, uint16_t size)
Definition: device_ds3.c:243
static bool ds3_button(void *data, uint16_t joykey)
Definition: device_ds3.c:338
static void * ds3_pad_init(void *data, uint32_t slot, hid_driver_t *driver)
Definition: device_ds3.c:212
static const char * ds3_get_name(void *data)
Definition: device_ds3.c:332