Skip to content

Commit 5b46b36

Browse files
committed
Merge branch 'fix/build_with_tinyusb_0_17_0' into 'master'
fix(build): fix build with tinyusb v0.17.0 See merge request ae_group/esp-iot-solution!1168
2 parents 07b007d + 3d0bdc7 commit 5b46b36

File tree

19 files changed

+68
-93
lines changed

19 files changed

+68
-93
lines changed

.gitlab/ci/build.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -563,14 +563,11 @@ build_example_motor_foc_knob:
563563
variables:
564564
EXAMPLE_DIR: examples/motor/foc_knob_example
565565

566-
build_example_motor_servo:
566+
build_example_motor_servo_control:
567567
extends:
568568
- .build_examples_template
569-
- .rules:build:example_motor_servo
570-
parallel:
571-
matrix:
572-
- IMAGE: espressif/idf:release-v4.4
573-
- IMAGE: espressif/idf:release-v5.2
569+
- .rules:build:example_motor_servo_control
570+
- .build_idf_active_release_version
574571
variables:
575572
EXAMPLE_DIR: components/motor/servo/examples/servo_control
576573

.gitlab/ci/rules.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,8 @@
486486
.patterns-example_motor_foc_knob: &patterns-example_motor_foc_knob
487487
- "examples/motor/foc_knob_example/**/*"
488488

489-
.patterns-example_motor_servo: &patterns-example_motor_servo
490-
- "components/motor/servo/examples/servo_control/**/*"
489+
.patterns-example_motor_servo_control: &patterns-example_motor_servo_control
490+
- "examples/motor/servo_control/**/*"
491491

492492
.patterns-example_ota_simple_ota_example: &patterns-example_ota_simple_ota_example
493493
- "examples/ota/simple_ota_example/**/*"
@@ -1076,7 +1076,7 @@
10761076
- <<: *if-dev-push
10771077
changes: *patterns-example_motor_foc_knob
10781078

1079-
.rules:build:example_motor_servo:
1079+
.rules:build:example_motor_servo_control:
10801080
rules:
10811081
- <<: *if-protected
10821082
- <<: *if-label-build
@@ -1086,7 +1086,7 @@
10861086
- <<: *if-dev-push
10871087
changes: *patterns-components_motor_servo
10881088
- <<: *if-dev-push
1089-
changes: *patterns-example_motor_servo
1089+
changes: *patterns-example_motor_servo_control
10901090

10911091
.rules:build:example_ota_simple_ota_example:
10921092
rules:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ The registered components in ESP-IoT-Solution are listed below:
117117
| [ntc_driver](https://components.espressif.com/components/espressif/ntc_driver) | [![Component Registry](https://components.espressif.com/components/espressif/ntc_driver/badge.svg)](https://components.espressif.com/components/espressif/ntc_driver) |
118118
| [openai](https://components.espressif.com/components/espressif/openai) | [![Component Registry](https://components.espressif.com/components/espressif/openai/badge.svg)](https://components.espressif.com/components/espressif/openai) |
119119
| [pwm_audio](https://components.espressif.com/components/espressif/pwm_audio) | [![Component Registry](https://components.espressif.com/components/espressif/pwm_audio/badge.svg)](https://components.espressif.com/components/espressif/pwm_audio) |
120+
| [servo](https://components.espressif.com/components/espressif/servo) | [![Component Registry](https://components.espressif.com/components/espressif/servo/badge.svg)](https://components.espressif.com/components/espressif/servo) |
120121
| [sht3x](https://components.espressif.com/components/espressif/sht3x) | [![Component Registry](https://components.espressif.com/components/espressif/sht3x/badge.svg)](https://components.espressif.com/components/espressif/sht3x) |
121122
| [spi_bus](https://components.espressif.com/components/espressif/spi_bus) | [![Component Registry](https://components.espressif.com/components/espressif/spi_bus/badge.svg)](https://components.espressif.com/components/espressif/spi_bus) |
122123
| [touch_proximity_sensor](https://components.espressif.com/components/espressif/touch_proximity_sensor) | [![Component Registry](https://components.espressif.com/components/espressif/touch_proximity_sensor/badge.svg)](https://components.espressif.com/components/espressif/touch_proximity_sensor) |

README_CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ ESP-IoT-Solution 中注册的组件如下:
117117
| [ntc_driver](https://components.espressif.com/components/espressif/ntc_driver) | [![Component Registry](https://components.espressif.com/components/espressif/ntc_driver/badge.svg)](https://components.espressif.com/components/espressif/ntc_driver) |
118118
| [openai](https://components.espressif.com/components/espressif/openai) | [![Component Registry](https://components.espressif.com/components/espressif/openai/badge.svg)](https://components.espressif.com/components/espressif/openai) |
119119
| [pwm_audio](https://components.espressif.com/components/espressif/pwm_audio) | [![Component Registry](https://components.espressif.com/components/espressif/pwm_audio/badge.svg)](https://components.espressif.com/components/espressif/pwm_audio) |
120+
| [servo](https://components.espressif.com/components/espressif/servo) | [![Component Registry](https://components.espressif.com/components/espressif/servo/badge.svg)](https://components.espressif.com/components/espressif/servo) |
120121
| [sht3x](https://components.espressif.com/components/espressif/sht3x) | [![Component Registry](https://components.espressif.com/components/espressif/sht3x/badge.svg)](https://components.espressif.com/components/espressif/sht3x) |
121122
| [spi_bus](https://components.espressif.com/components/espressif/spi_bus) | [![Component Registry](https://components.espressif.com/components/espressif/spi_bus/badge.svg)](https://components.espressif.com/components/espressif/spi_bus) |
122123
| [touch_proximity_sensor](https://components.espressif.com/components/espressif/touch_proximity_sensor) | [![Component Registry](https://components.espressif.com/components/espressif/touch_proximity_sensor/badge.svg)](https://components.espressif.com/components/espressif/touch_proximity_sensor) |

components/motor/servo/examples/servo_control/main/idf_component.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

components/motor/servo/idf_component.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ documentation: https://docs.espressif.com/projects/esp-iot-solution/en/latest/mo
77
dependencies:
88
idf:
99
version: '>=4.4'
10+
examples:
11+
- path: ../../../examples/motor/servo_control

components/usb/usb_device_uvc/idf_component.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ issues: https://github.com/espressif/esp-iot-solution/issues
1313
dependencies:
1414
idf: ">=5.0"
1515
espressif/tinyusb:
16-
version: ">=0.15.0~10"
16+
# Pinned to version 0.15.0~10 until https://github.com/espressif/tinyusb/pull/36 is merged.
17+
version: "0.15.0~10"
1718
cmake_utilities: "*"
1819
examples:
1920
- path: ../../../examples/usb/device/usb_webcam

docs/en/usb/usb_host/usb_host_iot_usbh_cdc.rst

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
USB Host CDC
1+
USB Host CDC
22
=====================
33

44
:link_to_translation:`zh_CN:[中文]`
@@ -8,41 +8,52 @@ The ``iot_usbh_cdc`` component implements a simple version of the USB host CDC d
88
User Guide
99
---------------
1010

11-
1. Using ``usbh_cdc_driver_install`` to configure, user can simply configure the bulk endpoint address and the size of the internal ringbuffer, user can also configure the hot plug related callback function ``conn_callback`` ``disconn_callback``.
11+
1. Use ``usbh_cdc_driver_install`` to configure the USB CDC driver. Users can set up the driver and initialize the USB Host Driver protocol stack internally by setting the ``skip_init_usb_host_driver`` option.
1212

1313
.. code:: c
1414
15-
/* install usbh cdc driver with bulk endpoint configs and size of internal ringbuffer */
16-
static usbh_cdc_config_t config = {
17-
/* use default endpoint descriptor with user address */
18-
.bulk_in_ep_addr = EXAMPLE_BULK_IN_EP_ADDR,
19-
.bulk_out_ep_addr = EXAMPLE_BULK_OUT_EP_ADDR,
20-
.rx_buffer_size = IN_RINGBUF_SIZE,
21-
.tx_buffer_size = OUT_RINGBUF_SIZE,
22-
.conn_callback = usb_connect_callback,
23-
.disconn_callback = usb_disconnect_callback,
15+
/* Install the USB CDC driver and initialize the USB Host Driver protocol stack internally */
16+
usbh_cdc_driver_config_t config = {
17+
.driver_task_stack_size = 1024 * 4,
18+
.driver_task_priority = 5,
19+
.xCoreID = 0,
20+
.skip_init_usb_host_driver = false,
21+
.new_dev_cb = cdc_new_dev_cb,
2422
};
25-
/* if user want to use multiple interfaces, can configure like this */
26-
#if (EXAMPLE_BULK_ITF_NUM > 1)
27-
config.itf_num = 2;
28-
config.bulk_in_ep_addrs[1] = EXAMPLE_BULK_IN1_EP_ADDR;
29-
config.bulk_out_ep_addrs[1] = EXAMPLE_BULK_OUT1_EP_ADDR;
30-
config.rx_buffer_sizes[1] = IN_RINGBUF_SIZE;
31-
config.tx_buffer_sizes[1] = OUT_RINGBUF_SIZE;
32-
#endif
3323
34-
/* install USB host CDC driver */
35-
usbh_cdc_driver_install(&config);
24+
2. Use ``usbh_cdc_create`` to configure the interface number (``itf_num``) and the size of the internal ring buffer. Additionally, users can configure hot-plug callbacks such as ``connect``, ``disconnect``, and ``recv_data``:
25+
26+
.. code:: c
27+
28+
/* Install the USB Host CDC driver and configure bulk endpoint addresses and internal ring buffer size */
29+
usbh_cdc_device_config_t dev_config = {
30+
.vid = 0,
31+
.pid = 0,
32+
.itf_num = 1,
33+
/* Set to 0 to use default values */
34+
.rx_buffer_size = 0,
35+
.tx_buffer_size = 0,
36+
.cbs = {
37+
.connect = cdc_connect_cb,
38+
.disconnect = cdc_disconnect_cb,
39+
.user_data = NULL
40+
},
41+
};
3642
37-
/* Waiting for USB device connected */
38-
usbh_cdc_wait_connect(portMAX_DELAY);
43+
usbh_cdc_handle_t handle = NULL;
44+
usbh_cdc_create(&dev_config, &handle);
45+
/* If multiple interfaces are required, configure them like this */
46+
#if (EXAMPLE_BULK_ITF_NUM > 1)
47+
config.itf_num = 3;
48+
usbh_cdc_handle_t handle2 = NULL;
49+
usbh_cdc_create(&dev_config, &handle2);
50+
#endif
3951
40-
2. After the driver initialization, the internal state machine will automatically handle the hot plug of the USB.
41-
3. ``usbh_cdc_wait_connect`` can be used to block task until USB CDC Device is connected or timeout.
42-
4. After successfully connected, the host will automatically receive USB data from CDC device to the internal ``ringbuffer``, user can poll ``usbh_cdc_get_buffered_data_len`` to read buffered data size or register a receive callback to get notified when data is ready. Then ``usbh_cdc_read_bytes`` can be used to read buffered data out.
43-
5. ``usbh_cdc_write_bytes`` can be used to send data to USB Device. The data is first written to the internal transmit ``ringbuffer``,then will be sent out during USB bus free.
44-
6. ``usbh_cdc_driver_delete`` can uninstall the USB driver completely to release all resources.
45-
7. If config multiple CDC interfaces, each interface contains an IN and OUT endpoint. Users can communicate with the specified interfaces using ``usbh_cdc_itf_read_bytes`` and ``usbh_cdc_itf_write_bytes``.
52+
3. After the driver is initialized, the internal state machine will automatically handle USB hot-plug events.
53+
4. Once successfully connected, the host will automatically receive USB data from the CDC device into an internal ``ringbuffer``. Users can poll the buffer size using ``usbh_cdc_get_rx_buffer_size`` or register a callback to get notified when data is ready. Data can then be read using ``usbh_cdc_read_bytes``.
54+
5. ``usbh_cdc_write_bytes`` can be used to send data to the USB device. The data is first written to an internal transmission ``ringbuffer`` and then sent over the USB bus when it is idle.
55+
6. ``usbh_cdc_delete`` can be used to delete the USB CDC device and release the associated ring buffer and other resources.
56+
7. ``usbh_cdc_driver_uninstall`` can completely uninstall the USB driver and release all resources.
4657

4758
Examples
4859
-------------------------------

examples/.build-rules.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ examples/motor/foc_knob_example:
219219
enable:
220220
- if: IDF_TARGET in ["esp32","esp32s3"]
221221

222+
examples/motor/servo_control:
223+
enable:
224+
- if: INCLUDE_DEFAULT == 1
225+
222226
examples/ota/simple_ota_example:
223227
enable:
224228
- if: IDF_TARGET in ["esp32c2","esp32c3","esp32"] and (IDF_VERSION_MAJOR == 5 and IDF_VERSION_MINOR == 0)

examples/keyboard/hid_device/usb_descriptors.h

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -94,45 +94,6 @@ enum {
9494
HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ) ,\
9595
HID_COLLECTION_END \
9696

97-
#define HID_USAGE_PAGE_LIGHTING_AND_ILLUMINATION 0x59
98-
99-
/// HID Usage Table - Lighting And Illumination Page (0x59)
100-
enum {
101-
HID_USAGE_LIGHTING_LAMP_ARRAY = 0x01,
102-
HID_USAGE_LIGHTING_LAMP_ARRAY_ATTRIBUTES_REPORT = 0x02,
103-
HID_USAGE_LIGHTING_LAMP_COUNT = 0x03,
104-
HID_USAGE_LIGHTING_BOUNDING_BOX_WIDTH_IN_MICROMETERS = 0x04,
105-
HID_USAGE_LIGHTING_BOUNDING_BOX_HEIGHT_IN_MICROMETERS = 0x05,
106-
HID_USAGE_LIGHTING_BOUNDING_BOX_DEPTH_IN_MICROMETERS = 0x06,
107-
HID_USAGE_LIGHTING_LAMP_ARRAY_KIND = 0x07,
108-
HID_USAGE_LIGHTING_MIN_UPDATE_INTERVAL_IN_MICROSECONDS = 0x08,
109-
HID_USAGE_LIGHTING_LAMP_ATTRIBUTES_REQUEST_REPORT = 0x20,
110-
HID_USAGE_LIGHTING_LAMP_ID = 0x21,
111-
HID_USAGE_LIGHTING_LAMP_ATTRIBUTES_RESPONSE_REPORT = 0x22,
112-
HID_USAGE_LIGHTING_POSITION_X_IN_MICROMETERS = 0x23,
113-
HID_USAGE_LIGHTING_POSITION_Y_IN_MICROMETERS = 0x24,
114-
HID_USAGE_LIGHTING_POSITION_Z_IN_MICROMETERS = 0x25,
115-
HID_USAGE_LIGHTING_LAMP_PURPOSES = 0x26,
116-
HID_USAGE_LIGHTING_UPDATE_LATENCY_IN_MICROSECONDS = 0x27,
117-
HID_USAGE_LIGHTING_RED_LEVEL_COUNT = 0x28,
118-
HID_USAGE_LIGHTING_GREEN_LEVEL_COUNT = 0x29,
119-
HID_USAGE_LIGHTING_BLUE_LEVEL_COUNT = 0x2A,
120-
HID_USAGE_LIGHTING_INTENSITY_LEVEL_COUNT = 0x2B,
121-
HID_USAGE_LIGHTING_IS_PROGRAMMABLE = 0x2C,
122-
HID_USAGE_LIGHTING_INPUT_BINDING = 0x2D,
123-
HID_USAGE_LIGHTING_LAMP_MULTI_UPDATE_REPORT = 0x50,
124-
HID_USAGE_LIGHTING_RED_UPDATE_CHANNEL = 0x51,
125-
HID_USAGE_LIGHTING_GREEN_UPDATE_CHANNEL = 0x52,
126-
HID_USAGE_LIGHTING_BLUE_UPDATE_CHANNEL = 0x53,
127-
HID_USAGE_LIGHTING_INTENSITY_UPDATE_CHANNEL = 0x54,
128-
HID_USAGE_LIGHTING_LAMP_UPDATE_FLAGS = 0x55,
129-
HID_USAGE_LIGHTING_LAMP_RANGE_UPDATE_REPORT = 0x60,
130-
HID_USAGE_LIGHTING_LAMP_ID_START = 0x61,
131-
HID_USAGE_LIGHTING_LAMP_ID_END = 0x62,
132-
HID_USAGE_LIGHTING_LAMP_ARRAY_CONTROL_REPORT = 0x70,
133-
HID_USAGE_LIGHTING_AUTONOMOUS_MODE = 0x71,
134-
};
135-
13697
// HID Lighting and Illumination Report Descriptor Template
13798
// - 1st parameter is report id (required)
13899
// Creates 6 report ids for lighting HID usages in the following order:

0 commit comments

Comments
 (0)