forked from espressif/arduino-esp32
Pull latest IDF and enable TinyUSB
This commit is contained in:
@ -0,0 +1,71 @@
|
||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string.h>
|
||||
#include "usb_descriptors.h"
|
||||
|
||||
|
||||
/* A combination of interfaces must have a unique product id, since PC will save device driver after the first plug.
|
||||
* Same VID/PID with different interface e.g MSC (first), then CDC (later) will possibly cause system error on PC.
|
||||
*
|
||||
* Auto ProductID layout's Bitmap:
|
||||
* [MSB] HID | MSC | CDC [LSB]
|
||||
*/
|
||||
#define EPNUM_MSC 0x03
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
//------------- HID Report Descriptor -------------//
|
||||
#if CFG_TUD_HID
|
||||
enum {
|
||||
REPORT_ID_KEYBOARD = 1,
|
||||
REPORT_ID_MOUSE
|
||||
};
|
||||
#endif
|
||||
|
||||
//------------- Configuration Descriptor -------------//
|
||||
enum {
|
||||
# if CFG_TUD_CDC
|
||||
ITF_NUM_CDC = 0,
|
||||
ITF_NUM_CDC_DATA,
|
||||
# endif
|
||||
|
||||
# if CFG_TUD_MSC
|
||||
ITF_NUM_MSC,
|
||||
# endif
|
||||
|
||||
# if CFG_TUD_HID
|
||||
ITF_NUM_HID,
|
||||
# endif
|
||||
|
||||
ITF_NUM_TOTAL
|
||||
};
|
||||
|
||||
enum {
|
||||
CONFIG_TOTAL_LEN = TUD_CONFIG_DESC_LEN + CFG_TUD_CDC * TUD_CDC_DESC_LEN + CFG_TUD_MSC * TUD_MSC_DESC_LEN +
|
||||
CFG_TUD_HID * TUD_HID_DESC_LEN
|
||||
};
|
||||
|
||||
bool tusb_desc_set;
|
||||
void tusb_set_descriptor(tusb_desc_device_t *desc, char **str_desc);
|
||||
tusb_desc_device_t *tusb_get_active_desc(void);
|
||||
char **tusb_get_active_str_desc(void);
|
||||
void tusb_clear_descriptor(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -0,0 +1,30 @@
|
||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tusb.h"
|
||||
|
||||
#define _PID_MAP(itf, n) ((CFG_TUD_##itf) << (n))
|
||||
|
||||
#define USB_ESPRESSIF_VID 0x303A
|
||||
|
||||
#define USB_STRING_DESCRIPTOR_ARRAY_SIZE 7
|
||||
typedef char *tusb_desc_strarray_device_t[USB_STRING_DESCRIPTOR_ARRAY_SIZE];
|
||||
|
||||
tusb_desc_device_t descriptor_tinyusb;
|
||||
tusb_desc_strarray_device_t descriptor_str_tinyusb;
|
||||
|
||||
tusb_desc_device_t descriptor_kconfig;
|
||||
tusb_desc_strarray_device_t descriptor_str_kconfig;
|
Reference in New Issue
Block a user