mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-12 10:16:30 +02:00
IDF master 3e370c4296
* Fix build compilation due to changes in the HW_TIMER's structs * Fix compilation warnings and errors with USB * Update USBCDC.cpp * Update CMakeLists.txt * Update HWCDC.cpp
This commit is contained in:
@ -126,6 +126,21 @@ typedef enum {
|
||||
ESP_HID_COD_MIN_MAX
|
||||
} esp_hid_cod_min_t;
|
||||
|
||||
/* HID transaction Types */
|
||||
typedef enum {
|
||||
ESP_HID_TRANS_HANDSHAKE = 0,
|
||||
ESP_HID_TRANS_CONTROL = 1,
|
||||
ESP_HID_TRANS_GET_REPORT = 4,
|
||||
ESP_HID_TRANS_SET_REPORT = 5,
|
||||
ESP_HID_TRANS_GET_PROTOCOL = 6,
|
||||
ESP_HID_TRANS_SET_PROTOCOL = 7,
|
||||
ESP_HID_TRANS_GET_IDLE = 8,
|
||||
ESP_HID_TRANS_SET_IDLE = 9,
|
||||
ESP_HID_TRANS_DATA = 10,
|
||||
ESP_HID_TRANS_DATAC = 11,
|
||||
ESP_HID_TRANS_MAX
|
||||
} esp_hid_trans_type_t;
|
||||
|
||||
/**
|
||||
* @brief HID report item structure
|
||||
*/
|
||||
|
@ -53,11 +53,28 @@ typedef struct esp_hidd_dev_s esp_hidd_dev_t;
|
||||
* @brief HIDD callback parameters union
|
||||
*/
|
||||
typedef union {
|
||||
/**
|
||||
* @brief ESP_HIDD_START_EVENT
|
||||
* @note Used only for Classic Bluetooth.
|
||||
*/
|
||||
struct {
|
||||
esp_err_t status; /*!< HID device operation status */
|
||||
} start; /*!< HID callback param of ESP_HIDD_START_EVENT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HIDD_STOP_EVENT
|
||||
* @note Used only for Classic Bluetooth.
|
||||
*/
|
||||
struct {
|
||||
esp_err_t status; /*!< HID device operation status */
|
||||
} stop; /*!< HID callback param of ESP_HIDD_STOP_EVENT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HIDD_CONNECT_EVENT
|
||||
*/
|
||||
struct {
|
||||
esp_hidd_dev_t *dev; /*!< HID device structure */
|
||||
esp_err_t status; /*!< HID device operation status, used only for Classic Bluetooth */
|
||||
} connect; /*!< HID callback param of ESP_HIDD_CONNECT_EVENT */
|
||||
|
||||
/**
|
||||
@ -66,6 +83,7 @@ typedef union {
|
||||
struct {
|
||||
esp_hidd_dev_t *dev; /*!< HID device structure */
|
||||
int reason; /*!< Indicate the reason of disconnection */
|
||||
esp_err_t status; /*!< HID device operation status, used only for Classic Bluetooth */
|
||||
} disconnect; /*!< HID callback param of ESP_HIDD_DISCONNECT_EVENT */
|
||||
|
||||
/**
|
||||
@ -90,6 +108,8 @@ typedef union {
|
||||
uint16_t length; /*!< data length */
|
||||
uint8_t *data; /*!< The pointer to the data */
|
||||
uint8_t map_index; /*!< HID config report map index */
|
||||
uint8_t trans_type; /*!< HID device feature transaction type, used only for Classic Bluetooth */
|
||||
uint8_t report_type; /*!< HID device feature report type, used only for Classic Bluetooth */
|
||||
} feature; /*!< HID callback param of ESP_HIDD_FEATURE_EVENT */
|
||||
|
||||
/**
|
||||
|
@ -42,6 +42,8 @@ typedef enum {
|
||||
ESP_HIDH_INPUT_EVENT, /*!< Received HID device INPUT report */
|
||||
ESP_HIDH_FEATURE_EVENT, /*!< Received HID device FEATURE report */
|
||||
ESP_HIDH_CLOSE_EVENT, /*!< HID device closed */
|
||||
ESP_HIDH_START_EVENT, /*!< HID host stack started, used only for Classic Bluetooth */
|
||||
ESP_HIDH_STOP_EVENT, /*!< HID host stack stopped, used only for Classic Bluetooth */
|
||||
ESP_HIDH_MAX_EVENT, /*!< HID events end marker */
|
||||
} esp_hidh_event_t;
|
||||
|
||||
@ -49,11 +51,28 @@ typedef enum {
|
||||
* @brief HIDH callback parameters union
|
||||
*/
|
||||
typedef union {
|
||||
/**
|
||||
* @brief ESP_HIDH_START_EVENT
|
||||
* @note Used only for Classic Bluetooth.
|
||||
*/
|
||||
struct {
|
||||
esp_err_t status; /*!< HID host operation status */
|
||||
} start; /*!< HID callback param of ESP_HIDH_START_EVENT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HIDH_STOP_EVENT
|
||||
* @note Used only for Classic Bluetooth.
|
||||
*/
|
||||
struct {
|
||||
esp_err_t status; /*!< HID host operation status */
|
||||
} stop; /*!< HID callback param of ESP_HIDH_STOP_EVENT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HIDH_OPEN_EVENT
|
||||
*/
|
||||
struct {
|
||||
esp_hidh_dev_t *dev; /*!< HID Remote bluetooth device */
|
||||
esp_err_t status; /*!< HID host operation status, used only for Classic Bluetooth */
|
||||
} open; /*!< HID callback param of ESP_HIDH_OPEN_EVENT */
|
||||
|
||||
/**
|
||||
@ -62,6 +81,7 @@ typedef union {
|
||||
struct {
|
||||
esp_hidh_dev_t *dev; /*!< HID Remote bluetooth device. */
|
||||
int reason; /*!< Reason why the connection was closed. BLE Only */
|
||||
esp_err_t status; /*!< HID host operation status, used only for Classic Bluetooth */
|
||||
} close; /*!< HID callback param of ESP_HIDH_CLOSE_EVENT */
|
||||
|
||||
/**
|
||||
@ -70,6 +90,7 @@ typedef union {
|
||||
struct {
|
||||
esp_hidh_dev_t *dev; /*!< HID Remote bluetooth device */
|
||||
uint8_t level; /*!< Battery Level (0-100%) */
|
||||
esp_err_t status; /*!< HID host operation status */
|
||||
} battery; /*!< HID callback param of ESP_HIDH_BATTERY_EVENT */
|
||||
|
||||
/**
|
||||
@ -80,7 +101,7 @@ typedef union {
|
||||
esp_hid_usage_t usage; /*!< HID report usage */
|
||||
uint16_t report_id; /*!< HID report index */
|
||||
uint16_t length; /*!< HID data length */
|
||||
uint8_t *data; /*!< The pointer to the HID data */
|
||||
uint8_t *data; /*!< The pointer to the HID data */
|
||||
uint8_t map_index; /*!< HID report map index */
|
||||
} input; /*!< HID callback param of ESP_HIDH_INPUT_EVENT */
|
||||
|
||||
@ -92,8 +113,10 @@ typedef union {
|
||||
esp_hid_usage_t usage; /*!< HID report usage */
|
||||
uint16_t report_id; /*!< HID report index */
|
||||
uint16_t length; /*!< HID data length */
|
||||
uint8_t *data; /*!< The pointer to the HID data */
|
||||
uint8_t *data; /*!< The pointer to the HID data */
|
||||
uint8_t map_index; /*!< HID report map index */
|
||||
esp_err_t status; /*!< HID host operation status, used only for Classic Bluetooth */
|
||||
esp_hid_trans_type_t trans_type; /*!< HID host feature transaction type, used only for Classic Bluetooth */
|
||||
} feature; /*!< HID callback param of ESP_HIDH_FEATURE_EVENT */
|
||||
|
||||
} esp_hidh_event_data_t;
|
||||
@ -101,6 +124,7 @@ typedef union {
|
||||
typedef struct {
|
||||
esp_event_handler_t callback;
|
||||
uint16_t event_stack_size;
|
||||
void *callback_arg;
|
||||
} esp_hidh_config_t;
|
||||
|
||||
/**
|
||||
@ -136,6 +160,14 @@ esp_err_t esp_hidh_dev_close(esp_hidh_dev_t *dev);
|
||||
*/
|
||||
esp_err_t esp_hidh_dev_free(esp_hidh_dev_t *dev);
|
||||
|
||||
/**
|
||||
* @brief Check if the device still exists.
|
||||
* @param dev : pointer to the device
|
||||
*
|
||||
* @return: true if exists
|
||||
*/
|
||||
bool esp_hidh_dev_exists(esp_hidh_dev_t *dev);
|
||||
|
||||
/**
|
||||
* @brief Send an OUTPUT report to the device
|
||||
* @param dev : pointer to the device
|
||||
@ -173,6 +205,79 @@ esp_err_t esp_hidh_dev_feature_set(esp_hidh_dev_t *dev, size_t map_index, size_t
|
||||
*/
|
||||
esp_err_t esp_hidh_dev_feature_get(esp_hidh_dev_t *dev, size_t map_index, size_t report_id, size_t max_len, uint8_t *data, size_t *length);
|
||||
|
||||
/**
|
||||
* @brief Set_Report command.
|
||||
* @note For now, this function used only for Classic Bluetooth.
|
||||
*
|
||||
* @param dev : pointer to the device
|
||||
* @param map_index : index of the device report map
|
||||
* @param report_id : id of the HID FEATURE report
|
||||
* @param report_type : report type, defines in `esp_hid_common.h`
|
||||
* @param data : pointer to the data to send
|
||||
* @param length : length of the data to send
|
||||
*
|
||||
* @return: ESP_OK on success
|
||||
*/
|
||||
esp_err_t esp_hidh_dev_set_report(esp_hidh_dev_t *dev, size_t map_index, size_t report_id, int report_type,
|
||||
uint8_t *data, size_t length);
|
||||
|
||||
/**
|
||||
* @brief Get_Report command.
|
||||
* @note For now, this function used only for Classic Bluetooth.
|
||||
*
|
||||
* @param dev : pointer to the device
|
||||
* @param map_index : index of the device report map
|
||||
* @param report_id : id of the HID FEATURE report
|
||||
* @param report_type : report type, defines in `esp_hid_common.h`
|
||||
* @param max_len : size of the buffer that will hold the data
|
||||
*
|
||||
* @return: ESP_OK on success
|
||||
*/
|
||||
esp_err_t esp_hidh_dev_get_report(esp_hidh_dev_t *dev, size_t map_index, size_t report_id, int report_type,
|
||||
size_t max_len);
|
||||
|
||||
/**
|
||||
* @brief Get_Idle Command.
|
||||
* @note For now, this function used only for Classic Bluetooth.
|
||||
*
|
||||
* @param dev : pointer to the device
|
||||
*
|
||||
* @return: ESP_OK on success
|
||||
*/
|
||||
esp_err_t esp_hidh_dev_get_idle(esp_hidh_dev_t *dev);
|
||||
|
||||
/**
|
||||
* @brief Set_Idle Command.
|
||||
* @note For now, this function used only for Classic Bluetooth.
|
||||
*
|
||||
* @param dev : pointer to the device
|
||||
* @param idle_time : idle_time
|
||||
*
|
||||
* @return: ESP_OK on success
|
||||
*/
|
||||
esp_err_t esp_hidh_dev_set_idle(esp_hidh_dev_t *dev, uint8_t idle_time);
|
||||
|
||||
/**
|
||||
* @brief Get_Protocol Command.
|
||||
* @note For now, this function used only for Classic Bluetooth.
|
||||
*
|
||||
* @param dev : pointer to the device
|
||||
*
|
||||
* @return: ESP_OK on success
|
||||
*/
|
||||
esp_err_t esp_hidh_dev_get_protocol(esp_hidh_dev_t *dev);
|
||||
|
||||
/**
|
||||
* @brief Set_Protocol Command.
|
||||
* @note For now, this function used only for Classic Bluetooth.
|
||||
*
|
||||
* @param dev : pointer to the device
|
||||
* @param protocol_mode : protocol_mode
|
||||
*
|
||||
* @return: ESP_OK on success
|
||||
*/
|
||||
esp_err_t esp_hidh_dev_set_protocol(esp_hidh_dev_t *dev, uint8_t protocol_mode);
|
||||
|
||||
/**
|
||||
* @brief Dump the properties of HID Device to UART
|
||||
* @param dev : pointer to the HID Device
|
||||
|
Reference in New Issue
Block a user