Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
uart_pipe.h File Reference

Pipe UART driver header file. More...

#include <stdlib.h>

Go to the source code of this file.

Typedefs

typedef uint8_t *(* uart_pipe_recv_cb) (uint8_t *buf, size_t *off)
 Received data callback.
 

Functions

void uart_pipe_register (uint8_t *buf, size_t len, uart_pipe_recv_cb cb)
 Register UART application.
 
int uart_pipe_send (const uint8_t *data, int len)
 Send data over UART.
 

Detailed Description

Pipe UART driver header file.

A pipe UART driver that allows applications to handle all aspects of received protocol data.

Typedef Documentation

◆ uart_pipe_recv_cb

typedef uint8_t *(* uart_pipe_recv_cb) (uint8_t *buf, size_t *off)

Received data callback.

This function is called when new data is received on UART. The off parameter can be used to alter offset at which received data is stored. Typically, when the complete data is received and a new buffer is provided off should be set to 0.

Parameters
bufBuffer with received data.
offData offset on next received and accumulated data length.
Returns
Buffer to be used on next receive.

Function Documentation

◆ uart_pipe_register()

void uart_pipe_register ( uint8_t buf,
size_t  len,
uart_pipe_recv_cb  cb 
)

Register UART application.

This function is used to register new UART application.

Parameters
bufInitial buffer for received data.
lenSize of buffer.
cbCallback to be called on data reception.

◆ uart_pipe_send()

int uart_pipe_send ( const uint8_t data,
int  len 
)

Send data over UART.

This function is used to send data over UART.

Parameters
dataBuffer with data to be send.
lenSize of data.
Returns
0 on success or negative error