28 #ifndef MCU_PERIPH_PIPE_H
29 #define MCU_PERIPH_PIPE_H
32 #include "mcu_periph/pipe_arch.h"
33 #include "pprzlink/pprzlink_device.h"
62 #if defined(USE_PIPE0_WRITER) || defined(USE_PIPE0_READER)
65 #ifndef USE_PIPE0_WRITER
66 #define USE_PIPE0_WRITER NULL
69 #ifndef USE_PIPE0_READER
70 #define USE_PIPE0_READER NULL
73 #define PIPE0Init() pipe_periph_init(&pipe0, STRINGIFY(USE_PIPE0_READER), STRINGIFY(USE_PIPE0_WRITER))
76 #if defined(USE_PIPE1_WRITER) || defined(USE_PIPE1_READER)
79 #ifndef USE_PIPE1_WRITER
80 #define USE_PIPE1_WRITER NULL
83 #ifndef USE_PIPE1_READER
84 #define USE_PIPE1_READER NULL
87 #define PIPE1Init() pipe_periph_init(&pipe1, STRINGIFY(USE_PIPE1_READER), STRINGIFY(USE_PIPE1_WRITER))
90 #if defined(USE_PIPE2_WRITER) || defined(USE_PIPE2_READER)
93 #ifndef USE_PIPE2_WRITER
94 #define USE_PIPE2_WRITER NULL
97 #ifndef USE_PIPE2_READER
98 #define USE_PIPE2_READER NULL
101 #define PIPE2Init() pipe_periph_init(&pipe2, STRINGIFY(USE_PIPE2_READER), STRINGIFY(USE_PIPE2_WRITER))
#define PIPE_TX_BUFFER_SIZE
#define PIPE_RX_BUFFER_SIZE
void pipe_receive(struct pipe_periph *p)
Read bytes from PIPE.
uint8_t tx_buf[PIPE_TX_BUFFER_SIZE]
Transmit buffer.
int fd_read
PIPE file descriptor.
uint8_t rx_buf[PIPE_RX_BUFFER_SIZE]
Receive buffer.
void pipe_periph_init(struct pipe_periph *p, char *name, char *write_name)
Initialize the PIPE peripheral.
void pipe_arch_init(void)
void pipe_put_byte(struct pipe_periph *p, long fd, uint8_t data)
Add one data byte to the tx buffer.
struct link_device device
Generic device interface.
int pipe_char_available(struct pipe_periph *p)
Get number of bytes available in receive buffer.
uint8_t pipe_getch(struct pipe_periph *p)
Get the last character from the receive buffer.
void pipe_arch_periph_init(struct pipe_periph *p, char *read_name, char *write_name)
Initialize the PIPE peripheral.
void pipe_send_message(struct pipe_periph *p, long fd)
Send a message.
int pipe_check_free_space(struct pipe_periph *p, long *fd, uint16_t len)
Check if there is enough free space in the transmit buffer.
void pipe_put_buffer(struct pipe_periph *p, long fd, const uint8_t *data, uint16_t len)
void pipe_send_raw(struct pipe_periph *p, long fd, uint8_t *buffer, uint16_t size)
Send a packet from another buffer.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.