docs(esp_ringbuf): Corrected example code block

* Closes https://github.com/espressif/esp-idf/issues/13730
This commit is contained in:
Jakob Hasse 2024-05-02 16:10:21 +02:00
parent 9b3ae86417
commit 7d3eeb440b
2 changed files with 6 additions and 6 deletions

View File

@ -97,9 +97,9 @@ The following example demonstrates the usage of :cpp:func:`xRingbufferSendAcquir
//Retrieve space for DMA descriptor and corresponding data buffer //Retrieve space for DMA descriptor and corresponding data buffer
//This has to be done with SendAcquire, or the address may be different when we copy //This has to be done with SendAcquire, or the address may be different when we copy
dma_item_t item; dma_item_t *item;
UBaseType_t res = xRingbufferSendAcquire(buf_handle, UBaseType_t res = xRingbufferSendAcquire(buf_handle,
&item, DMA_ITEM_SIZE(buffer_size), pdMS_TO_TICKS(1000)); (void**) &item, DMA_ITEM_SIZE(buffer_size), pdMS_TO_TICKS(1000));
if (res != pdTRUE) { if (res != pdTRUE) {
printf("Failed to acquire memory for item\n"); printf("Failed to acquire memory for item\n");
} }
@ -108,7 +108,7 @@ The following example demonstrates the usage of :cpp:func:`xRingbufferSendAcquir
.length = buffer_size, .length = buffer_size,
.eof = 0, .eof = 0,
.owner = 1, .owner = 1,
.buf = &item->buf, .buf = item->buf,
}; };
//Actually send to the ring buffer for consumer to use //Actually send to the ring buffer for consumer to use
res = xRingbufferSendComplete(buf_handle, &item); res = xRingbufferSendComplete(buf_handle, &item);

View File

@ -97,9 +97,9 @@ ESP-IDF 环形 buffer 是一个典型的 FIFO buffer支持任意大小的数
//为 DMA 描述符和相应的数据 buffer 检索空间 //为 DMA 描述符和相应的数据 buffer 检索空间
//此步骤必须通过 SendAcquire 完成,否则,复制时地址可能会不同 //此步骤必须通过 SendAcquire 完成,否则,复制时地址可能会不同
dma_item_t item; dma_item_t *item;
UBaseType_t res = xRingbufferSendAcquire(buf_handle, UBaseType_t res = xRingbufferSendAcquire(buf_handle,
&item, DMA_ITEM_SIZE(buffer_size), pdMS_TO_TICKS(1000)); (void**) &item, DMA_ITEM_SIZE(buffer_size), pdMS_TO_TICKS(1000));
if (res != pdTRUE) { if (res != pdTRUE) {
printf("Failed to acquire memory for item\n"); printf("Failed to acquire memory for item\n");
} }
@ -108,7 +108,7 @@ ESP-IDF 环形 buffer 是一个典型的 FIFO buffer支持任意大小的数
.length = buffer_size, .length = buffer_size,
.eof = 0, .eof = 0,
.owner = 1, .owner = 1,
.buf = &item->buf, .buf = item->buf,
}; };
//实际发送到环形 buffer 以供使用 //实际发送到环形 buffer 以供使用
res = xRingbufferSendComplete(buf_handle, &item); res = xRingbufferSendComplete(buf_handle, &item);