Receive a TWAI message This function receives a message from the RX queue. The flags field of the message structure will indicate the type of message received. This function will block if there are no messages in the RX queue @warning The flags field of the received message should be checked to determine if the received message contains any data bytes.
- ESP_OK: Message successfully received from RX queue - ESP_ERR_TIMEOUT: Timed out waiting for message - ESP_ERR_INVALID_ARG: Arguments are invalid - ESP_ERR_INVALID_STATE: TWAI driver is not installed
Related Functions
Found 5 other functions taking a twai_message_t
argument:
Transmit a TWAI message This function queues a TWAI message for transmission. Transmission will start immediately if no other messages are queued for transmission. If the TX queue is full, this function will block until more space becomes available or until it times out. If the TX queue is disabled (TX queue length = 0 in configuration), this function will return immediately if another message is undergoing transmission. This function can only be called when the TWAI driver is in the running state and cannot be called under Listen Only Mode.
Format a TWAI Frame This function takes a TWAI message structure (containing ID, DLC, data, and flags) and formats it to match the layout of the TX frame buffer.
Parse a TWAI Frame This function takes a TWAI frame (in the format of the RX frame buffer) and parses it to a TWAI message (containing ID, DLC, data and flags).
Examples
twai_receive() is referenced by 4 libraries and example projects: