mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
adding support for esp32 for use with max3421e host
This commit is contained in:
parent
fc91e15488
commit
2e995d7cf4
@ -49,7 +49,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Espressif IDF requires "freertos/" prefix in include path
|
// Espressif IDF requires "freertos/" prefix in include path
|
||||||
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if TUP_MCU_ESPRESSIF
|
||||||
#define CFG_TUSB_OS_INC_PATH freertos/
|
#define CFG_TUSB_OS_INC_PATH freertos/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "bsp/board_api.h"
|
#include "bsp/board_api.h"
|
||||||
#include "tusb.h"
|
#include "tusb.h"
|
||||||
|
|
||||||
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if TUP_MCU_ESPRESSIF
|
||||||
// ESP-IDF need "freertos/" prefix in include path.
|
// ESP-IDF need "freertos/" prefix in include path.
|
||||||
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
|
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
@ -111,14 +111,14 @@ int main(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
||||||
#if !TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if !TUP_MCU_ESPRESSIF
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if TUP_MCU_ESPRESSIF
|
||||||
void app_main(void) {
|
void app_main(void) {
|
||||||
main();
|
main();
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Espressif IDF requires "freertos/" prefix in include path
|
// Espressif IDF requires "freertos/" prefix in include path
|
||||||
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if TUP_MCU_ESPRESSIF
|
||||||
#define CFG_TUSB_OS_INC_PATH freertos/
|
#define CFG_TUSB_OS_INC_PATH freertos/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include "tusb.h"
|
#include "tusb.h"
|
||||||
#include "usb_descriptors.h"
|
#include "usb_descriptors.h"
|
||||||
|
|
||||||
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if TUP_MCU_ESPRESSIF
|
||||||
// ESP-IDF need "freertos/" prefix in include path.
|
// ESP-IDF need "freertos/" prefix in include path.
|
||||||
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
|
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
@ -113,14 +113,14 @@ int main(void)
|
|||||||
xTimerStart(blinky_tm, 0);
|
xTimerStart(blinky_tm, 0);
|
||||||
|
|
||||||
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
||||||
#if !TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if !TUP_MCU_ESPRESSIF
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if TUP_MCU_ESPRESSIF
|
||||||
void app_main(void)
|
void app_main(void)
|
||||||
{
|
{
|
||||||
main();
|
main();
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Espressif IDF requires "freertos/" prefix in include path
|
// Espressif IDF requires "freertos/" prefix in include path
|
||||||
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if TUP_MCU_ESPRESSIF
|
||||||
#define CFG_TUSB_OS_INC_PATH freertos/
|
#define CFG_TUSB_OS_INC_PATH freertos/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ void led_blinking_task(void* param) {
|
|||||||
#define BLINKY_STACK_SIZE configMINIMAL_STACK_SIZE
|
#define BLINKY_STACK_SIZE configMINIMAL_STACK_SIZE
|
||||||
#define VIDEO_STACK_SIZE (configMINIMAL_STACK_SIZE*4)
|
#define VIDEO_STACK_SIZE (configMINIMAL_STACK_SIZE*4)
|
||||||
|
|
||||||
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if TUP_MCU_ESPRESSIF
|
||||||
#define USBD_STACK_SIZE 4096
|
#define USBD_STACK_SIZE 4096
|
||||||
int main(void);
|
int main(void);
|
||||||
void app_main(void) {
|
void app_main(void) {
|
||||||
@ -344,7 +344,7 @@ void freertos_init_task(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
||||||
#if !TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if !TUP_MCU_ESPRESSIF
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Espressif IDF requires "freertos/" prefix in include path
|
// Espressif IDF requires "freertos/" prefix in include path
|
||||||
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if TUP_MCU_ESPRESSIF
|
||||||
#define CFG_TUSB_OS_INC_PATH freertos/
|
#define CFG_TUSB_OS_INC_PATH freertos/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ void led_blinking_task(void* param) {
|
|||||||
#define BLINKY_STACK_SIZE configMINIMAL_STACK_SIZE
|
#define BLINKY_STACK_SIZE configMINIMAL_STACK_SIZE
|
||||||
#define VIDEO_STACK_SIZE (configMINIMAL_STACK_SIZE*4)
|
#define VIDEO_STACK_SIZE (configMINIMAL_STACK_SIZE*4)
|
||||||
|
|
||||||
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if TUP_MCU_ESPRESSIF
|
||||||
#define USBD_STACK_SIZE 4096
|
#define USBD_STACK_SIZE 4096
|
||||||
int main(void);
|
int main(void);
|
||||||
void app_main(void) {
|
void app_main(void) {
|
||||||
@ -352,7 +352,7 @@ void freertos_init_task(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
||||||
#if !TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if !TUP_MCU_ESPRESSIF
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Espressif IDF requires "freertos/" prefix in include path
|
// Espressif IDF requires "freertos/" prefix in include path
|
||||||
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if TUP_MCU_ESPRESSIF
|
||||||
#define CFG_TUSB_OS_INC_PATH freertos/
|
#define CFG_TUSB_OS_INC_PATH freertos/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "tusb.h"
|
#include "tusb.h"
|
||||||
#include "bsp/board_api.h"
|
#include "bsp/board_api.h"
|
||||||
|
|
||||||
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if TUP_MCU_ESPRESSIF
|
||||||
// ESP-IDF need "freertos/" prefix in include path.
|
// ESP-IDF need "freertos/" prefix in include path.
|
||||||
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
|
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "bsp/board_api.h"
|
#include "bsp/board_api.h"
|
||||||
#include "tusb.h"
|
#include "tusb.h"
|
||||||
|
|
||||||
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if TUP_MCU_ESPRESSIF
|
||||||
// ESP-IDF need "freertos/" prefix in include path.
|
// ESP-IDF need "freertos/" prefix in include path.
|
||||||
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
|
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
@ -107,14 +107,14 @@ int main(void) {
|
|||||||
xTimerStart(blinky_tm, 0);
|
xTimerStart(blinky_tm, 0);
|
||||||
|
|
||||||
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
||||||
#if !TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if !TUP_MCU_ESPRESSIF
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if TUP_MCU_ESPRESSIF
|
||||||
void app_main(void) {
|
void app_main(void) {
|
||||||
main();
|
main();
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Espressif IDF requires "freertos/" prefix in include path
|
// Espressif IDF requires "freertos/" prefix in include path
|
||||||
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if TUP_MCU_ESPRESSIF
|
||||||
#define CFG_TUSB_OS_INC_PATH freertos/
|
#define CFG_TUSB_OS_INC_PATH freertos/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ extern "C" {
|
|||||||
#include "tusb.h"
|
#include "tusb.h"
|
||||||
|
|
||||||
#if CFG_TUSB_OS == OPT_OS_FREERTOS
|
#if CFG_TUSB_OS == OPT_OS_FREERTOS
|
||||||
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
#if TUP_MCU_ESPRESSIF
|
||||||
// ESP-IDF need "freertos/" prefix in include path.
|
// ESP-IDF need "freertos/" prefix in include path.
|
||||||
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
|
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
# Apply board specific content here
|
||||||
|
set(IDF_TARGET "esp32")
|
53
hw/bsp/espressif/boards/adafruit_feather_esp32_v2/board.h
Normal file
53
hw/bsp/espressif/boards/adafruit_feather_esp32_v2/board.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020, Ha Thach (tinyusb.org)
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* This file is part of the TinyUSB stack.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BOARD_H_
|
||||||
|
#define BOARD_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define NEOPIXEL_PIN 0
|
||||||
|
#define NEOPIXEL_POWER_PIN 2
|
||||||
|
#define NEOPIXEL_POWER_STATE 1
|
||||||
|
|
||||||
|
#define BUTTON_PIN 38
|
||||||
|
#define BUTTON_STATE_ACTIVE 0
|
||||||
|
|
||||||
|
// SPI for USB host shield
|
||||||
|
#define MAX3421_SPI_HOST SPI3_HOST
|
||||||
|
#define MAX3421_SCK_PIN 5
|
||||||
|
#define MAX3421_MOSI_PIN 19
|
||||||
|
#define MAX3421_MISO_PIN 21
|
||||||
|
#define MAX3421_CS_PIN 33
|
||||||
|
#define MAX3421_INTR_PIN 15
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* BOARD_H_ */
|
@ -30,8 +30,12 @@
|
|||||||
#include "esp_rom_gpio.h"
|
#include "esp_rom_gpio.h"
|
||||||
#include "esp_mac.h"
|
#include "esp_mac.h"
|
||||||
#include "hal/gpio_ll.h"
|
#include "hal/gpio_ll.h"
|
||||||
|
|
||||||
|
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
||||||
#include "hal/usb_hal.h"
|
#include "hal/usb_hal.h"
|
||||||
#include "soc/usb_periph.h"
|
#include "soc/usb_periph.h"
|
||||||
|
static void configure_pins(usb_hal_context_t* usb);
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
#include "driver/uart.h"
|
#include "driver/uart.h"
|
||||||
@ -56,7 +60,6 @@ static led_strip_handle_t led_strip;
|
|||||||
static void max3421_init(void);
|
static void max3421_init(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void configure_pins(usb_hal_context_t* usb);
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// Implementation
|
// Implementation
|
||||||
@ -100,7 +103,6 @@ void board_init(void) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ESP_ERROR_CHECK(led_strip_new_rmt_device(&strip_config, &rmt_config, &led_strip));
|
ESP_ERROR_CHECK(led_strip_new_rmt_device(&strip_config, &rmt_config, &led_strip));
|
||||||
|
|
||||||
led_strip_clear(led_strip); // off
|
led_strip_clear(led_strip); // off
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -109,6 +111,7 @@ void board_init(void) {
|
|||||||
gpio_set_direction(BUTTON_PIN, GPIO_MODE_INPUT);
|
gpio_set_direction(BUTTON_PIN, GPIO_MODE_INPUT);
|
||||||
gpio_set_pull_mode(BUTTON_PIN, BUTTON_STATE_ACTIVE ? GPIO_PULLDOWN_ONLY : GPIO_PULLUP_ONLY);
|
gpio_set_pull_mode(BUTTON_PIN, BUTTON_STATE_ACTIVE ? GPIO_PULLDOWN_ONLY : GPIO_PULLUP_ONLY);
|
||||||
|
|
||||||
|
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
||||||
// USB Controller Hal init
|
// USB Controller Hal init
|
||||||
periph_module_reset(PERIPH_USB_MODULE);
|
periph_module_reset(PERIPH_USB_MODULE);
|
||||||
periph_module_enable(PERIPH_USB_MODULE);
|
periph_module_enable(PERIPH_USB_MODULE);
|
||||||
@ -118,12 +121,14 @@ void board_init(void) {
|
|||||||
};
|
};
|
||||||
usb_hal_init(&hal);
|
usb_hal_init(&hal);
|
||||||
configure_pins(&hal);
|
configure_pins(&hal);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CFG_TUH_ENABLED && CFG_TUH_MAX3421
|
#if CFG_TUH_ENABLED && CFG_TUH_MAX3421
|
||||||
max3421_init();
|
max3421_init();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
||||||
static void configure_pins(usb_hal_context_t* usb) {
|
static void configure_pins(usb_hal_context_t* usb) {
|
||||||
/* usb_periph_iopins currently configures USB_OTG as USB Device.
|
/* usb_periph_iopins currently configures USB_OTG as USB Device.
|
||||||
* Introduce additional parameters in usb_hal_context_t when adding support
|
* Introduce additional parameters in usb_hal_context_t when adding support
|
||||||
@ -153,6 +158,7 @@ static void configure_pins(usb_hal_context_t* usb) {
|
|||||||
gpio_set_drive_capability(USBPHY_DP_NUM, GPIO_DRIVE_CAP_3);
|
gpio_set_drive_capability(USBPHY_DP_NUM, GPIO_DRIVE_CAP_3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// Board porting API
|
// Board porting API
|
||||||
@ -208,15 +214,12 @@ SemaphoreHandle_t max3421_intr_sem;
|
|||||||
|
|
||||||
static void IRAM_ATTR max3421_isr_handler(void* arg) {
|
static void IRAM_ATTR max3421_isr_handler(void* arg) {
|
||||||
(void) arg; // arg is gpio num
|
(void) arg; // arg is gpio num
|
||||||
gpio_set_level(13, 1);
|
|
||||||
|
|
||||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||||
xSemaphoreGiveFromISR(max3421_intr_sem, &xHigherPriorityTaskWoken);
|
xSemaphoreGiveFromISR(max3421_intr_sem, &xHigherPriorityTaskWoken);
|
||||||
if (xHigherPriorityTaskWoken) {
|
if (xHigherPriorityTaskWoken) {
|
||||||
portYIELD_FROM_ISR();
|
portYIELD_FROM_ISR();
|
||||||
}
|
}
|
||||||
|
|
||||||
gpio_set_level(13, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void max3421_intr_task(void* param) {
|
static void max3421_intr_task(void* param) {
|
||||||
@ -250,16 +253,12 @@ static void max3421_init(void) {
|
|||||||
|
|
||||||
spi_device_interface_config_t max3421_cfg = {
|
spi_device_interface_config_t max3421_cfg = {
|
||||||
.mode = 0,
|
.mode = 0,
|
||||||
.clock_speed_hz = 26000000,
|
.clock_speed_hz = 20000000, // S2/S3 can work with 26 Mhz, but esp32 seems only work up to 20 Mhz
|
||||||
.spics_io_num = -1, // manual control CS
|
.spics_io_num = -1, // manual control CS
|
||||||
.queue_size = 1
|
.queue_size = 1
|
||||||
};
|
};
|
||||||
ESP_ERROR_CHECK(spi_bus_add_device(MAX3421_SPI_HOST, &max3421_cfg, &max3421_spi));
|
ESP_ERROR_CHECK(spi_bus_add_device(MAX3421_SPI_HOST, &max3421_cfg, &max3421_spi));
|
||||||
|
|
||||||
// debug
|
|
||||||
gpio_set_direction(13, GPIO_MODE_OUTPUT);
|
|
||||||
gpio_set_level(13, 0);
|
|
||||||
|
|
||||||
// Interrupt pin
|
// Interrupt pin
|
||||||
max3421_intr_sem = xSemaphoreCreateBinary();
|
max3421_intr_sem = xSemaphoreCreateBinary();
|
||||||
xTaskCreate(max3421_intr_task, "max3421 intr", 2048, NULL, configMAX_PRIORITIES - 2, NULL);
|
xTaskCreate(max3421_intr_task, "max3421 intr", 2048, NULL, configMAX_PRIORITIES - 2, NULL);
|
||||||
|
@ -5,17 +5,7 @@ set(includes_public)
|
|||||||
set(compile_options)
|
set(compile_options)
|
||||||
set(tusb_src "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src")
|
set(tusb_src "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src")
|
||||||
|
|
||||||
if(target STREQUAL "esp32s3")
|
string(TOUPPER OPT_MCU_${target} tusb_mcu)
|
||||||
set(tusb_mcu "OPT_MCU_ESP32S3")
|
|
||||||
elseif(target STREQUAL "esp32s2")
|
|
||||||
set(tusb_mcu "OPT_MCU_ESP32S2")
|
|
||||||
else()
|
|
||||||
# CONFIG_TINYUSB dependency has been guaranteed by Kconfig logic,
|
|
||||||
# So it's not possible that cmake goes here
|
|
||||||
message(FATAL_ERROR "TinyUSB is not support on ${target}.")
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND compile_definitions
|
list(APPEND compile_definitions
|
||||||
CFG_TUSB_MCU=${tusb_mcu}
|
CFG_TUSB_MCU=${tusb_mcu}
|
||||||
CFG_TUSB_OS=OPT_OS_FREERTOS
|
CFG_TUSB_OS=OPT_OS_FREERTOS
|
||||||
|
@ -3,11 +3,7 @@ cmake_minimum_required(VERSION 3.5)
|
|||||||
# Apply board specific content i.e IDF_TARGET must be set before project.cmake is included
|
# Apply board specific content i.e IDF_TARGET must be set before project.cmake is included
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake")
|
include("${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake")
|
||||||
|
|
||||||
if(IDF_TARGET STREQUAL "esp32s2")
|
string(TOUPPER ${IDF_TARGET} FAMILY_MCUS)
|
||||||
set(FAMILY_MCUS ESP32S2)
|
|
||||||
elseif(IDF_TARGET STREQUAL "esp32s3")
|
|
||||||
set(FAMILY_MCUS ESP32S3)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add example src and bsp directories
|
# Add example src and bsp directories
|
||||||
set(EXTRA_COMPONENT_DIRS "src" "${CMAKE_CURRENT_LIST_DIR}/boards" "${CMAKE_CURRENT_LIST_DIR}/components")
|
set(EXTRA_COMPONENT_DIRS "src" "${CMAKE_CURRENT_LIST_DIR}/boards" "${CMAKE_CURRENT_LIST_DIR}/components")
|
||||||
|
@ -329,6 +329,9 @@
|
|||||||
#define TUP_USBIP_DWC2
|
#define TUP_USBIP_DWC2
|
||||||
#define TUP_DCD_ENDPOINT_MAX 6
|
#define TUP_DCD_ENDPOINT_MAX 6
|
||||||
|
|
||||||
|
#elif TU_CHECK_MCU(OPT_MCU_ESP32) && (CFG_TUD_ENABLED || !(defined(CFG_TUH_MAX3421) && CFG_TUH_MAX3421))
|
||||||
|
#error "MCUs are only supported with CFG_TUH_MAX3421 enabled"
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// Dialog
|
// Dialog
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
@ -426,7 +429,7 @@
|
|||||||
#define TUP_MCU_MULTIPLE_CORE 0
|
#define TUP_MCU_MULTIPLE_CORE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TUP_DCD_ENDPOINT_MAX
|
#if CFG_TUD_ENABLED && !defined(TUP_DCD_ENDPOINT_MAX)
|
||||||
#warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8"
|
#warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8"
|
||||||
#define TUP_DCD_ENDPOINT_MAX 8
|
#define TUP_DCD_ENDPOINT_MAX 8
|
||||||
#endif
|
#endif
|
||||||
|
@ -484,8 +484,8 @@ bool hcd_init(uint8_t rhport) {
|
|||||||
|
|
||||||
// v1 is 0x01, v2 is 0x12, v3 is 0x13
|
// v1 is 0x01, v2 is 0x12, v3 is 0x13
|
||||||
uint8_t const revision = reg_read(rhport, REVISION_ADDR, false);
|
uint8_t const revision = reg_read(rhport, REVISION_ADDR, false);
|
||||||
TU_ASSERT(revision == 0x01 || revision == 0x12 || revision == 0x13, false);
|
|
||||||
TU_LOG2_HEX(revision);
|
TU_LOG2_HEX(revision);
|
||||||
|
TU_ASSERT(revision == 0x01 || revision == 0x12 || revision == 0x13, false);
|
||||||
|
|
||||||
// reset
|
// reset
|
||||||
reg_write(rhport, USBCTL_ADDR, USBCTL_CHIPRES, false);
|
reg_write(rhport, USBCTL_ADDR, USBCTL_CHIPRES, false);
|
||||||
|
@ -119,6 +119,8 @@
|
|||||||
// Espressif
|
// Espressif
|
||||||
#define OPT_MCU_ESP32S2 900 ///< Espressif ESP32-S2
|
#define OPT_MCU_ESP32S2 900 ///< Espressif ESP32-S2
|
||||||
#define OPT_MCU_ESP32S3 901 ///< Espressif ESP32-S3
|
#define OPT_MCU_ESP32S3 901 ///< Espressif ESP32-S3
|
||||||
|
#define OPT_MCU_ESP32 902 ///< Espressif ESP32 (for host max3421e)
|
||||||
|
#define TUP_MCU_ESPRESSIF (CFG_TUSB_MCU >= 900 && CFG_TUSB_MCU < 1000) // check if Espressif MCU
|
||||||
|
|
||||||
// Dialog
|
// Dialog
|
||||||
#define OPT_MCU_DA1469X 1000 ///< Dialog Semiconductor DA1469x
|
#define OPT_MCU_DA1469X 1000 ///< Dialog Semiconductor DA1469x
|
||||||
|
Loading…
x
Reference in New Issue
Block a user