Function esp_idf_sys::sdio_slave_recv_packet
source · pub unsafe extern "C" fn sdio_slave_recv_packet(
handle_ret: *mut sdio_slave_buf_handle_t,
wait: TickType_t,
) -> esp_err_t
Expand description
Get buffer of received data if exist with packet information. The driver returns the ownership of the buffer to the app.
When you see return value is ESP_ERR_NOT_FINISHED
, you should call this API iteratively until the return value is ESP_OK
.
All the continuous buffers returned with ESP_ERR_NOT_FINISHED
, together with the last buffer returned with ESP_OK
, belong to one packet from the host.
You can call simpler sdio_slave_recv
instead, if the host never send data longer than the Receiving buffer size,
or you don’t care about the packet boundary (e.g. the data is only a byte stream).
@param handle_ret Handle of the buffer holding received data. Use this handle in sdio_slave_recv_load_buf()
to receive in the same buffer again.
@param wait Time to wait before data received.
@note Call sdio_slave_load_buf
with the handle to re-load the buffer onto the link list, and receive with the same buffer again.
The address and length of the buffer got here is the same as got from sdio_slave_get_buffer
.
@return - ESP_ERR_INVALID_ARG if handle_ret is NULL - ESP_ERR_TIMEOUT if timeout before receiving new data - ESP_ERR_NOT_FINISHED if returned buffer is not the end of a packet from the host, should call this API again until the end of a packet - ESP_OK if success