support esp32p4
This commit is contained in:
parent
8ef30202e5
commit
7f7ac74899
8 changed files with 21 additions and 31 deletions
2
.github/workflows/githubci.yml
vendored
2
.github/workflows/githubci.yml
vendored
|
|
@ -50,6 +50,7 @@ jobs:
|
|||
# ESP32 ci use dev json
|
||||
- 'feather_esp32s2'
|
||||
- 'feather_esp32s3'
|
||||
- 'esp32p4'
|
||||
# nRF52
|
||||
- 'cpb'
|
||||
- 'nrf52840'
|
||||
|
|
@ -69,6 +70,7 @@ jobs:
|
|||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: adafruit/ci-arduino
|
||||
ref: add-esp32p4
|
||||
path: ci
|
||||
|
||||
- name: pre-install
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ Following core has TinyUSB as either the primary usb stack or selectable via men
|
|||
- [adafruit/Adafruit_nRF52_Arduino](https://github.com/adafruit/Adafruit_nRF52_Arduino)
|
||||
- [adafruit/ArduinoCore-samd](https://github.com/adafruit/ArduinoCore-samd)
|
||||
- [earlephilhower/arduino-pico](https://github.com/earlephilhower/arduino-pico)
|
||||
- [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32) additional Tools menu is needed
|
||||
- [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32) Host mode using MAX3421E controller should work with all chips. Device mode only support S2/S3/P4 and additional Tools menu are needed
|
||||
- `USB Mode=USB-OTG (TinyUSB)` for S3 and P4
|
||||
- `USB CDC On Boot=Enabled`, `USB Firmware MSC On Boot=Disabled`, `USB DFU On Boot=Disabled`
|
||||
- [openwch/arduino_core_ch32](https://github.com/openwch/arduino_core_ch32)
|
||||
|
|
|
|||
|
|
@ -44,8 +44,6 @@ void setup() {
|
|||
|
||||
Serial.begin(115200);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
|
||||
usb_midi.setStringDescriptor("TinyUSB MIDI");
|
||||
|
||||
// Initialize MIDI, and listen to all MIDI channels
|
||||
|
|
|
|||
|
|
@ -38,8 +38,6 @@
|
|||
#define TINYUSB_API_VERSION 0
|
||||
#endif
|
||||
|
||||
#define BULK_PACKET_SIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
|
||||
|
||||
// SerialTinyUSB can be macro expanding to "Serial" on supported cores
|
||||
Adafruit_USBD_CDC SerialTinyUSB;
|
||||
|
||||
|
|
@ -71,8 +69,10 @@ uint16_t Adafruit_USBD_CDC::getInterfaceDescriptor(uint8_t itfnum_deprecated,
|
|||
uint8_t _strid = 0;
|
||||
#endif
|
||||
|
||||
uint8_t const desc[] = {TUD_CDC_DESCRIPTOR(itfnum, _strid, ep_notif, 8,
|
||||
ep_out, ep_in, BULK_PACKET_SIZE)};
|
||||
uint16_t const mps =
|
||||
(TUD_OPT_HIGH_SPEED ? 512 : 64); // TODO actual link speed
|
||||
uint8_t const desc[] = {
|
||||
TUD_CDC_DESCRIPTOR(itfnum, _strid, ep_notif, 8, ep_out, ep_in, mps)};
|
||||
|
||||
uint16_t const len = sizeof(desc);
|
||||
|
||||
|
|
|
|||
|
|
@ -161,18 +161,6 @@ void Adafruit_USBD_Device::task(void) {
|
|||
#endif
|
||||
}
|
||||
|
||||
bool Adafruit_USBD_Device::mounted(void) { return tud_mounted(); }
|
||||
|
||||
bool Adafruit_USBD_Device::suspended(void) { return tud_suspended(); }
|
||||
|
||||
bool Adafruit_USBD_Device::ready(void) { return tud_ready(); }
|
||||
|
||||
bool Adafruit_USBD_Device::remoteWakeup(void) { return tud_remote_wakeup(); }
|
||||
|
||||
bool Adafruit_USBD_Device::detach(void) { return tud_disconnect(); }
|
||||
|
||||
bool Adafruit_USBD_Device::attach(void) { return tud_connect(); }
|
||||
|
||||
void Adafruit_USBD_Device::clearConfiguration(void) {
|
||||
tusb_desc_device_t const desc_dev = {.bLength = sizeof(tusb_desc_device_t),
|
||||
.bDescriptorType = TUSB_DESC_DEVICE,
|
||||
|
|
@ -257,8 +245,10 @@ bool Adafruit_USBD_Device::begin(uint8_t rhport) {
|
|||
// follow USBCDC cdc descriptor
|
||||
uint8_t itfnum = allocInterface(2);
|
||||
uint8_t strid = addStringDescriptor("TinyUSB Serial");
|
||||
uint16_t const mps =
|
||||
(TUD_OPT_HIGH_SPEED ? 512 : 64); // TODO actual link speed
|
||||
uint8_t const desc_cdc[TUD_CDC_DESC_LEN] = {
|
||||
TUD_CDC_DESCRIPTOR(itfnum, strid, 0x85, 64, 0x03, 0x84, 64)};
|
||||
TUD_CDC_DESCRIPTOR(itfnum, strid, 0x85, 64, 0x03, 0x84, mps)};
|
||||
|
||||
memcpy(_desc_cfg + _desc_cfg_len, desc_cdc, sizeof(desc_cdc));
|
||||
_desc_cfg_len += sizeof(desc_cdc);
|
||||
|
|
|
|||
|
|
@ -119,14 +119,15 @@ public:
|
|||
void task(void);
|
||||
|
||||
// physical disable/enable pull-up
|
||||
bool detach(void);
|
||||
bool attach(void);
|
||||
bool detach(void) { return tud_disconnect(); }
|
||||
bool attach(void) { return tud_connect(); }
|
||||
|
||||
//------------- status -------------//
|
||||
bool mounted(void);
|
||||
bool suspended(void);
|
||||
bool ready(void);
|
||||
bool remoteWakeup(void);
|
||||
bool mounted(void) { return tud_mounted(); }
|
||||
bool suspended(void) { return tud_suspended(); }
|
||||
bool ready(void) { return tud_ready(); }
|
||||
bool remoteWakeup(void) { return tud_remote_wakeup(); }
|
||||
tusb_speed_t getSpeed(void) { return tud_speed_get(); }
|
||||
|
||||
private:
|
||||
uint16_t const *descriptor_string_cb(uint8_t index, uint16_t langid);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@
|
|||
|
||||
#include "Adafruit_USBD_MSC.h"
|
||||
|
||||
#define BULK_PACKET_SIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
|
||||
|
||||
static Adafruit_USBD_MSC *_msc_dev = NULL;
|
||||
|
||||
Adafruit_USBD_MSC::Adafruit_USBD_MSC(void) {
|
||||
|
|
@ -51,8 +49,10 @@ uint16_t Adafruit_USBD_MSC::getInterfaceDescriptor(uint8_t itfnum_deprecated,
|
|||
uint8_t const ep_in = TinyUSBDevice.allocEndpoint(TUSB_DIR_IN);
|
||||
uint8_t const ep_out = TinyUSBDevice.allocEndpoint(TUSB_DIR_OUT);
|
||||
|
||||
uint16_t const mps =
|
||||
(TUD_OPT_HIGH_SPEED ? 512 : 64); // TODO actual link speed
|
||||
uint8_t const desc[] = {
|
||||
TUD_MSC_DESCRIPTOR(itfnum, _strid, ep_out, ep_in, BULK_PACKET_SIZE)};
|
||||
TUD_MSC_DESCRIPTOR(itfnum, _strid, ep_out, ep_in, mps)};
|
||||
uint16_t const len = sizeof(desc);
|
||||
|
||||
if (bufsize < len) {
|
||||
|
|
|
|||
|
|
@ -68,10 +68,8 @@ extern "C" {
|
|||
|
||||
#if CONFIG_IDF_TARGET_ESP32P4
|
||||
#define CFG_TUD_MAX_SPEED OPT_MODE_HIGH_SPEED
|
||||
#define CFG_TUH_MAX_SPEED OPT_MODE_HIGH_SPEED
|
||||
#else
|
||||
#define CFG_TUD_MAX_SPEED OPT_MODE_FULL_SPEED
|
||||
#define CFG_TUH_MAX_SPEED OPT_MODE_FULL_SPEED
|
||||
#endif
|
||||
|
||||
#ifndef CFG_TUSB_OS
|
||||
|
|
@ -141,6 +139,7 @@ extern "C" {
|
|||
// Enable host stack with MAX3421E (host shield)
|
||||
#define CFG_TUH_ENABLED 1
|
||||
#define CFG_TUH_MAX3421 1
|
||||
#define CFG_TUH_MAX_SPEED OPT_MODE_FULL_SPEED
|
||||
|
||||
#ifndef CFG_TUH_MAX3421_ENDPOINT_TOTAL
|
||||
#define CFG_TUH_MAX3421_ENDPOINT_TOTAL (8 + 4 * (CFG_TUH_DEVICE_MAX - 1))
|
||||
|
|
|
|||
Loading…
Reference in a new issue