Skip to content

Commit 6efbcd7

Browse files
authored
Merge branch 'espressif:esp-idf-v5.1-libs' into esp-idf-v5.1-libs
2 parents 4d30c65 + 9aeed61 commit 6efbcd7

File tree

25 files changed

+97
-76
lines changed

25 files changed

+97
-76
lines changed

.github/workflows/hil.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,12 @@ jobs:
6666
Test:
6767
needs: [gen_chunks, Build]
6868
name: ${{matrix.chip}}-Test#${{matrix.chunks}}
69-
runs-on:
70-
- ESP32
71-
- ESP32-S2
72-
- ESP32-S3
73-
- ESP32-C3
74-
- ESP32-C6
75-
- ESP32-H2
76-
7769
strategy:
7870
fail-fast: false
7971
matrix:
8072
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
8173
chunks: ${{fromJson(needs.gen_chunks.outputs.chunks)}}
74+
runs-on: [arduino, "${{matrix.chip}}"]
8275
container:
8376
image: python:3.10.1-bullseye
8477
options: --privileged

cores/esp32/HWCDC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
ESP_EVENT_DEFINE_BASE(ARDUINO_HW_CDC_EVENTS);
3333

3434
static RingbufHandle_t tx_ring_buf = NULL;
35-
static xQueueHandle rx_queue = NULL;
35+
static QueueHandle_t rx_queue = NULL;
3636
static uint8_t rx_data_buf[64] = {0};
3737
static intr_handle_t intr_handle = NULL;
3838
static volatile bool initial_empty = false;
39-
static xSemaphoreHandle tx_lock = NULL;
39+
static SemaphoreHandle_t tx_lock = NULL;
4040

4141
// workaround for when USB CDC is not connected
4242
static uint32_t tx_timeout_ms = 0;

cores/esp32/HardwareSerial.cpp

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void serialEvent(void) {}
7979
#define TX1 19
8080
#elif CONFIG_IDF_TARGET_ESP32S3
8181
#define TX1 16
82-
#elif CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2
82+
#elif CONFIG_IDF_TARGET_ESP32C6
8383
#define TX1 4
8484
#elif CONFIG_IDF_TARGET_ESP32H2
8585
#define TX1 1
@@ -95,7 +95,7 @@ void serialEvent1(void) {}
9595
#if CONFIG_IDF_TARGET_ESP32
9696
#define RX2 16
9797
#elif CONFIG_IDF_TARGET_ESP32S3
98-
#define RX2 19
98+
#define RX2 19
9999
#endif
100100
#endif
101101

@@ -144,16 +144,16 @@ void serialEventRun(void)
144144
#define HSERIAL_MUTEX_LOCK() do {} while (xSemaphoreTake(_lock, portMAX_DELAY) != pdPASS)
145145
#define HSERIAL_MUTEX_UNLOCK() xSemaphoreGive(_lock)
146146
#else
147-
#define HSERIAL_MUTEX_LOCK()
148-
#define HSERIAL_MUTEX_UNLOCK()
147+
#define HSERIAL_MUTEX_LOCK()
148+
#define HSERIAL_MUTEX_UNLOCK()
149149
#endif
150150

151-
HardwareSerial::HardwareSerial(int uart_nr) :
152-
_uart_nr(uart_nr),
151+
HardwareSerial::HardwareSerial(int uart_nr) :
152+
_uart_nr(uart_nr),
153153
_uart(NULL),
154154
_rxBufferSize(256),
155-
_txBufferSize(0),
156-
_onReceiveCB(NULL),
155+
_txBufferSize(0),
156+
_onReceiveCB(NULL),
157157
_onReceiveErrorCB(NULL),
158158
_onReceiveTimeout(false),
159159
_rxTimeout(2),
@@ -202,10 +202,10 @@ void HardwareSerial::_destroyEventTask(void)
202202
}
203203
}
204204

205-
void HardwareSerial::onReceiveError(OnReceiveErrorCb function)
205+
void HardwareSerial::onReceiveError(OnReceiveErrorCb function)
206206
{
207207
HSERIAL_MUTEX_LOCK();
208-
// function may be NULL to cancel onReceive() from its respective task
208+
// function may be NULL to cancel onReceive() from its respective task
209209
_onReceiveErrorCB = function;
210210
// this can be called after Serial.begin(), therefore it shall create the event task
211211
if (function != NULL && _uart != NULL && _eventTask == NULL) {
@@ -217,7 +217,7 @@ void HardwareSerial::onReceiveError(OnReceiveErrorCb function)
217217
void HardwareSerial::onReceive(OnReceiveCb function, bool onlyOnTimeout)
218218
{
219219
HSERIAL_MUTEX_LOCK();
220-
// function may be NULL to cancel onReceive() from its respective task
220+
// function may be NULL to cancel onReceive() from its respective task
221221
_onReceiveCB = function;
222222

223223
// setting the callback to NULL will just disable it
@@ -265,14 +265,14 @@ bool HardwareSerial::setRxFIFOFull(uint8_t fifoBytes)
265265
bool HardwareSerial::setRxTimeout(uint8_t symbols_timeout)
266266
{
267267
HSERIAL_MUTEX_LOCK();
268-
268+
269269
// Zero disables timeout, thus, onReceive callback will only be called when RX FIFO reaches 120 bytes
270-
// Any non-zero value will activate onReceive callback based on UART baudrate with about 11 bits per symbol
271-
_rxTimeout = symbols_timeout;
272-
if (!symbols_timeout) _onReceiveTimeout = false; // only when RX timeout is disabled, we also must disable this flag
270+
// Any non-zero value will activate onReceive callback based on UART baudrate with about 11 bits per symbol
271+
_rxTimeout = symbols_timeout;
272+
if (!symbols_timeout) _onReceiveTimeout = false; // only when RX timeout is disabled, we also must disable this flag
273273

274274
bool retCode = uartSetRxTimeout(_uart, _rxTimeout); // Set new timeout
275-
275+
276276
HSERIAL_MUTEX_UNLOCK();
277277
return retCode;
278278
}
@@ -281,7 +281,7 @@ void HardwareSerial::eventQueueReset()
281281
{
282282
QueueHandle_t uartEventQueue = NULL;
283283
if (_uart == NULL) {
284-
return;
284+
return;
285285
}
286286
uartGetEventQueue(_uart, &uartEventQueue);
287287
if (uartEventQueue != NULL) {
@@ -298,12 +298,12 @@ void HardwareSerial::_uartEventTask(void *args)
298298
if (uartEventQueue != NULL) {
299299
for(;;) {
300300
//Waiting for UART event.
301-
if(xQueueReceive(uartEventQueue, (void * )&event, (portTickType)portMAX_DELAY)) {
301+
if(xQueueReceive(uartEventQueue, (void * )&event, (TickType_t)portMAX_DELAY)) {
302302
hardwareSerial_error_t currentErr = UART_NO_ERROR;
303303
switch(event.type) {
304304
case UART_DATA:
305-
if(uart->_onReceiveCB && uart->available() > 0 &&
306-
((uart->_onReceiveTimeout && event.timeout_flag) || !uart->_onReceiveTimeout) )
305+
if(uart->_onReceiveCB && uart->available() > 0 &&
306+
((uart->_onReceiveTimeout && event.timeout_flag) || !uart->_onReceiveTimeout) )
307307
uart->_onReceiveCB();
308308
break;
309309
case UART_FIFO_OVF:
@@ -410,18 +410,18 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
410410
}
411411
}
412412
// create a task to deal with Serial Events when, for example, calling begin() twice to change the baudrate,
413-
// or when setting the callback before calling begin()
413+
// or when setting the callback before calling begin()
414414
if (_uart != NULL && (_onReceiveCB != NULL || _onReceiveErrorCB != NULL) && _eventTask == NULL) {
415415
_createEventTask(this);
416416
}
417417

418418
// Set UART RX timeout
419419
uartSetRxTimeout(_uart, _rxTimeout);
420420

421-
// Set UART FIFO Full depending on the baud rate.
421+
// Set UART FIFO Full depending on the baud rate.
422422
// Lower baud rates will force to emulate byte-by-byte reading
423423
// Higher baud rates will keep IDF default of 120 bytes for FIFO FULL Interrupt
424-
// It can also be changed by the application at any time
424+
// It can also be changed by the application at any time
425425
if (!_rxFIFOFull) { // it has not being changed before calling begin()
426426
// set a default FIFO Full value for the IDF driver
427427
uint8_t fifoFull = 1;
@@ -437,23 +437,23 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
437437

438438
void HardwareSerial::updateBaudRate(unsigned long baud)
439439
{
440-
uartSetBaudRate(_uart, baud);
440+
uartSetBaudRate(_uart, baud);
441441
}
442442

443443
void HardwareSerial::end(bool fullyTerminate)
444444
{
445-
// default Serial.end() will completely disable HardwareSerial,
445+
// default Serial.end() will completely disable HardwareSerial,
446446
// including any tasks or debug message channel (log_x()) - but not for IDF log messages!
447447
if(fullyTerminate) {
448448
_onReceiveCB = NULL;
449449
_onReceiveErrorCB = NULL;
450450
if (uartGetDebug() == _uart_nr) {
451451
uartSetDebug(0);
452452
}
453-
_rxFIFOFull = 0;
453+
_rxFIFOFull = 0;
454454
uartEnd(_uart); // fully detach all pins and delete the UART driver
455455
} else {
456-
// do not invalidate callbacks, detach pins, invalidate DBG output
456+
// do not invalidate callbacks, detach pins, invalidate DBG output
457457
uart_driver_delete(_uart_nr);
458458
}
459459
_uart = 0;
@@ -540,7 +540,7 @@ size_t HardwareSerial::write(const uint8_t *buffer, size_t size)
540540
uint32_t HardwareSerial::baudRate()
541541

542542
{
543-
return uartGetBaudRate(_uart);
543+
return uartGetBaudRate(_uart);
544544
}
545545
HardwareSerial::operator bool() const
546546
{

cores/esp32/USBCDC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ size_t USBCDC::setRxBufferSize(size_t rx_queue_len){
123123
uxQueueSpacesAvailable(rx_queue) + uxQueueMessagesWaiting(rx_queue) : 0;
124124

125125
if (rx_queue_len != currentQueueSize) {
126-
xQueueHandle new_rx_queue = NULL;
126+
QueueHandle_t new_rx_queue = NULL;
127127
if (rx_queue_len) {
128128
new_rx_queue = xQueueCreate(rx_queue_len, sizeof(uint8_t));
129129
if(!new_rx_queue){

cores/esp32/USBCDC.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ class USBCDC: public Stream
135135
bool rts;
136136
bool connected;
137137
bool reboot_enable;
138-
xQueueHandle rx_queue;
139-
xSemaphoreHandle tx_lock;
138+
QueueHandle_t rx_queue;
139+
SemaphoreHandle_t tx_lock;
140140
uint32_t tx_timeout_ms;
141141

142142
};

cores/esp32/esp32-hal-cpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ typedef struct apb_change_cb_s {
6060

6161

6262
static apb_change_t * apb_change_callbacks = NULL;
63-
static xSemaphoreHandle apb_change_lock = NULL;
63+
static SemaphoreHandle_t apb_change_lock = NULL;
6464

6565
static void initApbChangeCallback(){
6666
static volatile bool initialized = false;

cores/esp32/esp32-hal-i2c-slave.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,16 @@ typedef struct i2c_slave_struct_t {
7676
void * arg;
7777
intr_handle_t intr_handle;
7878
TaskHandle_t task_handle;
79-
xQueueHandle event_queue;
79+
QueueHandle_t event_queue;
8080
#if I2C_SLAVE_USE_RX_QUEUE
81-
xQueueHandle rx_queue;
81+
QueueHandle_t rx_queue;
8282
#else
8383
RingbufHandle_t rx_ring_buf;
8484
#endif
85-
xQueueHandle tx_queue;
85+
QueueHandle_t tx_queue;
8686
uint32_t rx_data_count;
8787
#if !CONFIG_DISABLE_HAL_LOCKS
88-
xSemaphoreHandle lock;
88+
SemaphoreHandle_t lock;
8989
#endif
9090
} i2c_slave_struct_t;
9191

@@ -431,7 +431,7 @@ size_t i2cSlaveWrite(uint8_t num, const uint8_t *buf, uint32_t len, uint32_t tim
431431
to_queue = len;
432432
}
433433
for (size_t i = 0; i < to_queue; i++) {
434-
if (xQueueSend(i2c->tx_queue, &buf[i], timeout_ms / portTICK_RATE_MS) != pdTRUE) {
434+
if (xQueueSend(i2c->tx_queue, &buf[i], timeout_ms / portTICK_PERIOD_MS) != pdTRUE) {
435435
xQueueReset(i2c->tx_queue);
436436
to_queue = 0;
437437
break;

cores/esp32/esp32-hal-i2c.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ esp_err_t i2cWrite(uint8_t i2c_num, uint16_t address, const uint8_t* buff, size_
184184
}
185185

186186
//short implementation does not support zero size writes (example when scanning) PR in IDF?
187-
//ret = i2c_master_write_to_device((i2c_port_t)i2c_num, address, buff, size, timeOutMillis / portTICK_RATE_MS);
187+
//ret = i2c_master_write_to_device((i2c_port_t)i2c_num, address, buff, size, timeOutMillis / portTICK_PERIOD_MS);
188188

189189
ret = ESP_OK;
190190
uint8_t cmd_buff[I2C_LINK_RECOMMENDED_SIZE(1)] = { 0 };
@@ -207,7 +207,7 @@ esp_err_t i2cWrite(uint8_t i2c_num, uint16_t address, const uint8_t* buff, size_
207207
if (ret != ESP_OK) {
208208
goto end;
209209
}
210-
ret = i2c_master_cmd_begin((i2c_port_t)i2c_num, cmd, timeOutMillis / portTICK_RATE_MS);
210+
ret = i2c_master_cmd_begin((i2c_port_t)i2c_num, cmd, timeOutMillis / portTICK_PERIOD_MS);
211211

212212
end:
213213
if(cmd != NULL){
@@ -235,7 +235,7 @@ esp_err_t i2cRead(uint8_t i2c_num, uint16_t address, uint8_t* buff, size_t size,
235235
if(!bus[i2c_num].initialized){
236236
log_e("bus is not initialized");
237237
} else {
238-
ret = i2c_master_read_from_device((i2c_port_t)i2c_num, address, buff, size, timeOutMillis / portTICK_RATE_MS);
238+
ret = i2c_master_read_from_device((i2c_port_t)i2c_num, address, buff, size, timeOutMillis / portTICK_PERIOD_MS);
239239
if(ret == ESP_OK){
240240
*readCount = size;
241241
} else {
@@ -264,7 +264,7 @@ esp_err_t i2cWriteReadNonStop(uint8_t i2c_num, uint16_t address, const uint8_t*
264264
if(!bus[i2c_num].initialized){
265265
log_e("bus is not initialized");
266266
} else {
267-
ret = i2c_master_write_read_device((i2c_port_t)i2c_num, address, wbuff, wsize, rbuff, rsize, timeOutMillis / portTICK_RATE_MS);
267+
ret = i2c_master_write_read_device((i2c_port_t)i2c_num, address, wbuff, wsize, rbuff, rsize, timeOutMillis / portTICK_PERIOD_MS);
268268
if(ret == ESP_OK){
269269
*readCount = rsize;
270270
} else {

cores/esp32/esp32-hal-rmt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct rmt_obj_s {
6060
size_t *num_symbols_read; // Pointer to the number of RMT symbol read by IDF RMT RX Done
6161

6262
#if !CONFIG_DISABLE_HAL_LOCKS
63-
xSemaphoreHandle g_rmt_objlocks; // Channel Semaphore Lock
63+
SemaphoreHandle_t g_rmt_objlocks; // Channel Semaphore Lock
6464
#endif /* CONFIG_DISABLE_HAL_LOCKS */
6565
};
6666

@@ -69,7 +69,7 @@ typedef struct rmt_obj_s *rmt_bus_handle_t;
6969
/**
7070
Internal variables used in RMT API
7171
*/
72-
static xSemaphoreHandle g_rmt_block_lock = NULL;
72+
static SemaphoreHandle_t g_rmt_block_lock = NULL;
7373

7474
/**
7575
Internal method (private) declarations

cores/esp32/esp32-hal-spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
struct spi_struct_t {
6060
spi_dev_t * dev;
6161
#if !CONFIG_DISABLE_HAL_LOCKS
62-
xSemaphoreHandle lock;
62+
SemaphoreHandle_t lock;
6363
#endif
6464
uint8_t num;
6565
int8_t sck;

cores/esp32/esp32-hal-tinyusb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ static void hw_cdc_reset_handler(void *arg) {
406406
usb_serial_jtag_ll_clr_intsts_mask(usbjtag_intr_status);
407407

408408
if (usbjtag_intr_status & USB_SERIAL_JTAG_INTR_BUS_RESET) {
409-
xSemaphoreGiveFromISR((xSemaphoreHandle)arg, &xTaskWoken);
409+
xSemaphoreGiveFromISR((SemaphoreHandle_t)arg, &xTaskWoken);
410410
}
411411

412412
if (xTaskWoken == pdTRUE) {
@@ -441,7 +441,7 @@ static void usb_switch_to_cdc_jtag(){
441441
usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_LL_INTR_MASK);
442442
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_BUS_RESET);
443443
intr_handle_t intr_handle = NULL;
444-
xSemaphoreHandle reset_sem = xSemaphoreCreateBinary();
444+
SemaphoreHandle_t reset_sem = xSemaphoreCreateBinary();
445445
if(reset_sem){
446446
if(esp_intr_alloc(ETS_USB_SERIAL_JTAG_INTR_SOURCE, 0, hw_cdc_reset_handler, reset_sem, &intr_handle) != ESP_OK){
447447
vSemaphoreDelete(reset_sem);

cores/esp32/esp32-hal-uart.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static int s_uart_debug_nr = 0;
3838
struct uart_struct_t {
3939

4040
#if !CONFIG_DISABLE_HAL_LOCKS
41-
xSemaphoreHandle lock;
41+
SemaphoreHandle_t lock;
4242
#endif
4343

4444
uint8_t num;
@@ -459,7 +459,7 @@ uint8_t uartRead(uart_t* uart)
459459
c = uart->peek_byte;
460460
} else {
461461

462-
int len = uart_read_bytes(uart->num, &c, 1, 20 / portTICK_RATE_MS);
462+
int len = uart_read_bytes(uart->num, &c, 1, 20 / portTICK_PERIOD_MS);
463463
if (len <= 0) { // includes negative return from IDF in case of error
464464
c = 0;
465465
}
@@ -481,7 +481,7 @@ uint8_t uartPeek(uart_t* uart)
481481
if (uart->has_peek) {
482482
c = uart->peek_byte;
483483
} else {
484-
int len = uart_read_bytes(uart->num, &c, 1, 20 / portTICK_RATE_MS);
484+
int len = uart_read_bytes(uart->num, &c, 1, 20 / portTICK_PERIOD_MS);
485485
if (len <= 0) { // includes negative return from IDF in case of error
486486
c = 0;
487487
} else {

libraries/AsyncUDP/src/AsyncUDP.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ typedef struct {
145145
struct netif * netif;
146146
} lwip_event_packet_t;
147147

148-
static xQueueHandle _udp_queue;
148+
static QueueHandle_t _udp_queue;
149149
static volatile TaskHandle_t _udp_task_handle = NULL;
150150

151151
static void _udp_task(void *pvParameters){

libraries/AsyncUDP/src/AsyncUDP.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class AsyncUDP : public Print
104104
{
105105
protected:
106106
udp_pcb *_pcb;
107-
//xSemaphoreHandle _lock;
107+
//SemaphoreHandle_t _lock;
108108
bool _connected;
109109
esp_err_t _lastErr;
110110
AuPacketHandlerFunction _handler;

libraries/BluetoothSerial/src/BluetoothSerial.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ const char * _spp_server_name = "ESP32SPP";
4747
#define SPP_CONGESTED_TIMEOUT 1000
4848

4949
static uint32_t _spp_client = 0;
50-
static xQueueHandle _spp_rx_queue = NULL;
51-
static xQueueHandle _spp_tx_queue = NULL;
50+
static QueueHandle_t _spp_rx_queue = NULL;
51+
static QueueHandle_t _spp_tx_queue = NULL;
5252
static SemaphoreHandle_t _spp_tx_done = NULL;
5353
static TaskHandle_t _spp_task_handle = NULL;
5454
static EventGroupHandle_t _spp_event_group = NULL;

0 commit comments

Comments
 (0)