feat(XCamera): 实现异步抓图功能并优化图像处理
fix(nginx): 调整企业微信回调代理路径 feat(gateway): 添加企业微信消息处理功能 docs: 更新项目规划文档和企业微信配置详情 refactor(XCamera): 重构LED检测和图像处理逻辑 test: 添加ONVIF抓图测试功能
This commit is contained in:
5
ESP32/my_usb_project/main/CMakeLists.txt
Normal file
5
ESP32/my_usb_project/main/CMakeLists.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
idf_component_register(SRCS "my_usb_project.c"
|
||||
INCLUDE_DIRS "."
|
||||
PRIV_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/../rust_app")
|
||||
|
||||
target_link_libraries(${COMPONENT_LIB} INTERFACE "-L${CMAKE_CURRENT_LIST_DIR}/../rust_app/target/xtensa-esp32s3-none-elf/debug" "-lrust_app")
|
||||
7
ESP32/my_usb_project/main/Kconfig.projbuild
Normal file
7
ESP32/my_usb_project/main/Kconfig.projbuild
Normal file
@@ -0,0 +1,7 @@
|
||||
menu "USB Device Configuration"
|
||||
|
||||
config USB_DPLUS_PULLUP
|
||||
bool "Enable USB D+ pull-up resistor"
|
||||
default y
|
||||
|
||||
endmenu
|
||||
16
ESP32/my_usb_project/main/idf_component.yml
Normal file
16
ESP32/my_usb_project/main/idf_component.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
## IDF Component Manager Manifest File
|
||||
dependencies:
|
||||
## Required IDF version
|
||||
idf:
|
||||
version: '>=4.1.0'
|
||||
# # Put list of dependencies here
|
||||
# # For components maintained by Espressif:
|
||||
# component: "~1.0.0"
|
||||
# # For 3rd party components:
|
||||
# username/component: ">=1.0.0,<2.0.0"
|
||||
# username2/component2:
|
||||
# version: "~1.0.0"
|
||||
# # For transient dependencies `public` flag can be set.
|
||||
# # `public` flag doesn't have an effect dependencies of the `main` component.
|
||||
# # All dependencies of `main` are public by default.
|
||||
espressif/esp_tinyusb: ">=2.0.0"
|
||||
102
ESP32/my_usb_project/main/my_usb_project.c
Normal file
102
ESP32/my_usb_project/main/my_usb_project.c
Normal file
@@ -0,0 +1,102 @@
|
||||
#include <stdio.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_log.h"
|
||||
#include "tinyusb.h"
|
||||
#include "tusb.h"
|
||||
#include "tusb_config.h"
|
||||
#include "rust_app_wrapper.h"
|
||||
|
||||
static const char *TAG = "USB";
|
||||
|
||||
#define TUSB_DESC_TOTAL_LEN (TUD_CONFIG_DESC_LEN + CFG_TUD_HID * TUD_HID_DESC_LEN)
|
||||
|
||||
#define USB_VID 0x30D8
|
||||
#define USB_PID 0x50A6
|
||||
#define USB_BCD 0x0100
|
||||
|
||||
static tusb_desc_device_t const desc_device =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_device_t),
|
||||
.bDescriptorType = TUSB_DESC_DEVICE,
|
||||
.bcdUSB = USB_BCD,
|
||||
.bDeviceClass = 0x00,
|
||||
.bDeviceSubClass = 0x00,
|
||||
.bDeviceProtocol = 0x00,
|
||||
.bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
|
||||
.idVendor = USB_VID,
|
||||
.idProduct = USB_PID,
|
||||
.bcdDevice = USB_BCD,
|
||||
.iManufacturer = 0x01,
|
||||
.iProduct = 0x02,
|
||||
.iSerialNumber = 0x03,
|
||||
.bNumConfigurations = 0x01
|
||||
};
|
||||
|
||||
uint8_t const desc_hid_report[] =
|
||||
{
|
||||
TUD_HID_REPORT_DESC_KEYBOARD(HID_REPORT_ID(HID_ITF_PROTOCOL_KEYBOARD)),
|
||||
TUD_HID_REPORT_DESC_MOUSE(HID_REPORT_ID(HID_ITF_PROTOCOL_MOUSE))
|
||||
};
|
||||
|
||||
uint8_t const * tud_hid_descriptor_report_cb(uint8_t instance)
|
||||
{
|
||||
(void) instance;
|
||||
return desc_hid_report;
|
||||
}
|
||||
|
||||
static char const *hid_string_descriptor[5] = {
|
||||
(char[]){0x09, 0x04},
|
||||
"JoyD",
|
||||
"Virtual Keyboard Mouse",
|
||||
"123456",
|
||||
"HID Interface",
|
||||
};
|
||||
|
||||
static uint8_t const hid_configuration_descriptor[] = {
|
||||
TUD_CONFIG_DESCRIPTOR(1, 2, 0, TUSB_DESC_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
|
||||
|
||||
TUD_HID_DESCRIPTOR(0, 4, false, sizeof(desc_hid_report), 0x81, 64, 1),
|
||||
TUD_HID_DESCRIPTOR(2, 4, false, sizeof(desc_hid_report), 0x82, 64, 1),
|
||||
};
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
ESP_LOGI(TAG, "USB 初始化");
|
||||
|
||||
const tinyusb_config_t tusb_cfg = {
|
||||
.port = TINYUSB_PORT_FULL_SPEED_0,
|
||||
.phy = {
|
||||
.skip_setup = false,
|
||||
.self_powered = false,
|
||||
.vbus_monitor_io = 0,
|
||||
},
|
||||
.task = {
|
||||
.size = 3500,
|
||||
.priority = 14,
|
||||
.xCoreID = 0,
|
||||
},
|
||||
.descriptor = {
|
||||
.device = (const uint8_t *) &desc_device,
|
||||
.qualifier = NULL,
|
||||
.string = hid_string_descriptor,
|
||||
.string_count = sizeof(hid_string_descriptor) / sizeof(hid_string_descriptor[0]),
|
||||
.full_speed_config = hid_configuration_descriptor,
|
||||
.high_speed_config = NULL,
|
||||
},
|
||||
.event_cb = NULL,
|
||||
.event_arg = NULL,
|
||||
};
|
||||
|
||||
ESP_ERROR_CHECK(tinyusb_driver_install(&tusb_cfg));
|
||||
|
||||
ESP_LOGI(TAG, "✅ USB HID 设备启动成功");
|
||||
|
||||
ESP_LOGI(TAG, "启动 Rust 应用...");
|
||||
rust_app_wrapper_init();
|
||||
|
||||
while (1) {
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
ESP_LOGI(TAG, "USB 设备运行中...");
|
||||
}
|
||||
}
|
||||
33
ESP32/my_usb_project/main/tusb_config.h
Normal file
33
ESP32/my_usb_project/main/tusb_config.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef _TUSB_CONFIG_H_
|
||||
#define _TUSB_CONFIG_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// 配置 USB 设备模式
|
||||
#define CFG_TUD_ENABLED 1
|
||||
|
||||
// 配置 USB 速度
|
||||
#define CFG_TUSB_OS OPT_OS_FREERTOS
|
||||
|
||||
// 配置 USB 缓冲区大小
|
||||
#define CFG_TUD_ENDPOINT0_SIZE 64
|
||||
|
||||
// 配置 HID 键盘
|
||||
#define CFG_TUD_HID 1
|
||||
#define CFG_TUD_HID_EP_BUFSIZE 64
|
||||
|
||||
// 配置 CDC(串口)
|
||||
#define CFG_TUD_CDC 1
|
||||
#define CFG_TUD_CDC_EP_BUFSIZE 64
|
||||
|
||||
// 配置 MSC(U盘)
|
||||
#define CFG_TUD_MSC 1
|
||||
#define CFG_TUD_MSC_EP_BUFSIZE 64
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TUSB_CONFIG_H_ */
|
||||
Reference in New Issue
Block a user