Initial project setup

This commit is contained in:
2025-12-13 11:59:11 +02:00
commit 3218e6039f
2176 changed files with 355321 additions and 0 deletions

View File

@@ -0,0 +1,82 @@
/*
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "freertos/timers.h"
#include "tusb.h"
#include "tinyusb_types.h"
/* CDC classification
********************************************************************* */
typedef enum {
TINYUSB_CDC_DATA = 0x00,
} cdc_data_sublcass_type_t; // CDC120 specification
/* Note:other classification is represented in the file components\tinyusb\tinyusb\src\class\cdc\cdc.h */
/*********************************************************************** CDC classification*/
/* Structs
********************************************************************* */
typedef struct {
tinyusb_usbdev_t usb_dev; /*!< USB device to set up */
tusb_class_code_t cdc_class; /*!< CDC device class : Communications or Data device */
union {
cdc_comm_sublcass_type_t comm_subclass; /*!< Communications device subclasses: ACM, ECM, etc. */
cdc_data_sublcass_type_t data_subclass; /*!< Data device has only one subclass.*/
} cdc_subclass; /*!< CDC device subclass according to Class Definitions for Communications Devices the CDC v.1.20 */
} tinyusb_config_cdc_t; /*!< Main configuration structure of a CDC device */
typedef struct {
tinyusb_usbdev_t usb_dev; /*!< USB device used for the instance */
tusb_class_code_t type;
union {
cdc_comm_sublcass_type_t comm_subclass; /*!< Communications device subclasses: ACM, ECM, etc. */
cdc_data_sublcass_type_t data_subclass; /*!< Data device has only one subclass.*/
} cdc_subclass; /*!< CDC device subclass according to Class Definitions for Communications Devices the CDC v.1.20 */
void *subclass_obj; /*!< Dynamically allocated subclass specific object */
} esp_tusb_cdc_t;
/*********************************************************************** Structs*/
/* Functions
********************************************************************* */
/**
* @brief Initializing CDC basic object
* @param itf - number of a CDC object
* @param cfg - CDC configuration structure
*
* @return esp_err_t ESP_OK or ESP_FAIL
*/
esp_err_t tinyusb_cdc_init(int itf, const tinyusb_config_cdc_t *cfg);
/**
* @brief De-initializing CDC. Clean its objects
* @param itf - number of a CDC object
* @return esp_err_t ESP_OK, ESP_ERR_INVALID_ARG, ESP_ERR_INVALID_STATE
*
*/
esp_err_t tinyusb_cdc_deinit(int itf);
/**
* @brief Return interface of a CDC device
*
* @param itf_num
* @return esp_tusb_cdc_t* pointer to the interface or (NULL) on error
*/
esp_tusb_cdc_t *tinyusb_cdc_get_intf(int itf_num);
/*********************************************************************** Functions*/
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,47 @@
/*
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "tinyusb.h"
#ifdef __cplusplus
extern "C" {
#endif
#define USB_STRING_DESCRIPTOR_ARRAY_SIZE 8 // Max 8 string descriptors for a device. LANGID, Manufacturer, Product, Serial number + 4 user defined
/**
* @brief Parse tinyusb configuration and prepare the device configuration pointer list to configure tinyusb driver
*
* @attention All descriptors passed to this function must exist for the duration of USB device lifetime
*
* @param[in] config tinyusb stack specific configuration
* @retval ESP_ERR_INVALID_ARG Default configuration descriptor is provided only for CDC, MSC and NCM classes
* @retval ESP_ERR_NO_MEM Memory allocation error
* @retval ESP_OK Descriptors configured without error
*/
esp_err_t tinyusb_set_descriptors(const tinyusb_config_t *config);
/**
* @brief Set specific string descriptor
*
* @attention The descriptor passed to this function must exist for the duration of USB device lifetime
*
* @param[in] str UTF-8 string
* @param[in] str_idx String descriptor index
*/
void tinyusb_set_str_descriptor(const char *str, int str_idx);
/**
* @brief Free memory allocated during tinyusb_set_descriptors
*
*/
void tinyusb_free_descriptors(void);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,62 @@
/*
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "tusb.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Device descriptor generated from Kconfig
*
* This descriptor is used by default.
* The user can provide their own device descriptor via tinyusb_driver_install() call
*/
extern const tusb_desc_device_t descriptor_dev_default;
#if (TUD_OPT_HIGH_SPEED)
/**
* @brief Qualifier Device descriptor generated from Kconfig
*
* This descriptor is used by default.
* The user can provide their own descriptor via tinyusb_driver_install() call
*/
extern const tusb_desc_device_qualifier_t descriptor_qualifier_default;
#endif // TUD_OPT_HIGH_SPEED
/**
* @brief Array of string descriptors generated from Kconfig
*
* This descriptor is used by default.
* The user can provide their own descriptor via tinyusb_driver_install() call
*/
extern const char *descriptor_str_default[];
/**
* @brief FullSpeed configuration descriptor generated from Kconfig
* This descriptor is used by default.
* The user can provide their own FullSpeed configuration descriptor via tinyusb_driver_install() call
*/
extern const uint8_t descriptor_fs_cfg_default[];
#if (TUD_OPT_HIGH_SPEED)
/**
* @brief HighSpeed Configuration descriptor generated from Kconfig
*
* This descriptor is used by default.
* The user can provide their own HighSpeed configuration descriptor via tinyusb_driver_install() call
*/
extern const uint8_t descriptor_hs_cfg_default[];
#endif // TUD_OPT_HIGH_SPEED
uint8_t tusb_get_mac_string_id(void);
#ifdef __cplusplus
}
#endif