Microchip® Advanced Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Implementation of UDI HID gamepad

Class internal implementation.

Functions

bool udi_hid_gpd_buttons (bool b_state, uint8_t key_id)
 Send events key pressed or released. More...
 
bool udi_hid_gpd_moveX (int8_t pos)
 Move the x axe. More...
 
bool udi_hid_gpd_moveY (int8_t pos)
 Move the y axe. More...
 
bool udi_hid_gpd_throttle_move (int8_t pos)
 Move the throttle. More...
 

Variables

UDC_DESC_STORAGE
udi_hid_gpd_report_desc_t 
udi_hid_gpd_report_desc
 

Internal defines and variables to manage HID gamepad

static uint8_t udi_hid_gpd_rate
 
static uint8_t udi_hid_gpd_protocol
 
static uint8_t udi_hid_gpd_report_set
 
static bool udi_hid_gpd_b_report_valid
 
static uint8_t udi_hid_gpd_report [UDI_HID_GPD_REPORT_SIZE]
 
static bool udi_hid_gpd_b_report_trans_ongoing
 
static COMPILER_WORD_ALIGNED
uint8_t 
udi_hid_gpd_report_trans [UDI_HID_GPD_REPORT_SIZE]
 
#define UDI_HID_GPD_REPORT_SIZE   4
 

Internal routines

static bool udi_hid_gpd_setreport (void)
 Changes gamepad report states (like LEDs) More...
 
static bool udi_hid_gpd_send_report (void)
 Send the report. More...
 
static void udi_hid_gpd_report_sent (udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep)
 Callback called when the report is sent. More...
 
static void udi_hid_gpd_setreport_valid (void)
 Callback called to update report from USB host udi_hid_gpd_report_set is updated before callback execution. More...
 

#define UDI_HID_GPD_REPORT_SIZE   4

bool udi_hid_gpd_buttons ( bool  b_state,
uint8_t  key_id 
)

Send events key pressed or released.

Parameters
key_idID of key
b_stateKey Pressed or released
Returns
1 if function was successfully done, otherwise 0.

References cpu_irq_restore(), cpu_irq_save(), udi_hid_gpd_b_report_valid, udi_hid_gpd_report, and udi_hid_gpd_send_report().

Referenced by zid_report_data_indication().

bool udi_hid_gpd_moveX ( int8_t  pos)

Move the x axe.

Parameters
posSigned value to move
Returns
1 if function was successfully done, otherwise 0.

References cpu_irq_restore(), cpu_irq_save(), pos, udi_hid_gpd_b_report_valid, udi_hid_gpd_report, and udi_hid_gpd_send_report().

Referenced by zid_report_data_indication().

bool udi_hid_gpd_moveY ( int8_t  pos)

Move the y axe.

Parameters
posSigned value to move
Returns
1 if function was successfully done, otherwise 0.

References cpu_irq_restore(), cpu_irq_save(), pos, udi_hid_gpd_b_report_valid, udi_hid_gpd_report, and udi_hid_gpd_send_report().

Referenced by zid_report_data_indication().

static void udi_hid_gpd_report_sent ( udd_ep_status_t  status,
iram_size_t  nb_sent,
udd_ep_id_t  ep 
)
static

Callback called when the report is sent.

Parameters
statusUDD_EP_TRANSFER_OK, if transfer is completed
statusUDD_EP_TRANSFER_ABORT, if transfer is aborted
nb_sentnumber of data transfered
Returns
1 if function was successfully done, otherwise 0.

References udi_hid_gpd_b_report_trans_ongoing, udi_hid_gpd_b_report_valid, udi_hid_gpd_send_report(), and UNUSED.

Referenced by udi_hid_gpd_send_report().

static void udi_hid_gpd_setreport_valid ( void  )
static

Callback called to update report from USB host udi_hid_gpd_report_set is updated before callback execution.

References udi_hid_gpd_report_set.

Referenced by udi_hid_gpd_setreport().

bool udi_hid_gpd_throttle_move ( int8_t  pos)

Move the throttle.

Parameters
posSigned value to move
Returns
1 if function was successfully done, otherwise 0.

References cpu_irq_restore(), cpu_irq_save(), pos, udi_hid_gpd_b_report_valid, udi_hid_gpd_report, and udi_hid_gpd_send_report().

Referenced by zid_report_data_indication().

bool udi_hid_gpd_b_report_trans_ongoing
static
uint8_t udi_hid_gpd_protocol
static
uint8_t udi_hid_gpd_rate
static

Referenced by udi_hid_gpd_setup().

uint8_t udi_hid_gpd_report_set
static
COMPILER_WORD_ALIGNED uint8_t udi_hid_gpd_report_trans[UDI_HID_GPD_REPORT_SIZE]
static

Referenced by udi_hid_gpd_send_report().