Microchip® Advanced Software Framework

udi_hid_gpd.c File Reference

USB Device Human Interface Device (HID) gamepad interface.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include "conf_usb.h"
#include "usb_protocol.h"
#include "udd.h"
#include "udc.h"
#include "udi_hid.h"
#include "udi_hid_gpd.h"
#include <string.h>

Functions

bool udi_hid_gpd_buttons (bool b_state, uint8_t key_id)
 Send events key pressed or released. More...
 
void udi_hid_gpd_disable (void)
 
bool udi_hid_gpd_enable (void)
 
uint8_t udi_hid_gpd_getsetting (void)
 
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_setup (void)
 
bool udi_hid_gpd_throttle_move (int8_t pos)
 Move the throttle. More...
 
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...
 

Variables

UDC_DESC_STORAGE udi_api_t udi_api_hid_gpd
 
UDC_DESC_STORAGE
udi_hid_gpd_report_desc_t 
udi_hid_gpd_report_desc
 

Internal defines and variables to manage HID gamepad

#define UDI_HID_GPD_REPORT_SIZE   4
 
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]