28 #ifndef MCU_PERIPH_UDP_H
29 #define MCU_PERIPH_UDP_H
32 #include "mcu_periph/udp_arch.h"
33 #include "pprzlink/pprzlink_device.h"
35 #define UDP_RX_BUFFER_SIZE 256
36 #define UDP_TX_BUFFER_SIZE 256
67 #define UDP0_HOST 127.0.0.1
71 #define UDP0_PORT_OUT 4242
75 #define UDP0_PORT_IN 4243
78 #ifndef UDP0_BROADCAST
79 #define UDP0_BROADCAST FALSE
82 #define UDP0Init() udp_periph_init(&udp0, STRINGIFY(UDP0_HOST), UDP0_PORT_OUT, UDP0_PORT_IN, UDP0_BROADCAST)
89 #define UDP1_HOST 127.0.0.1
93 #define UDP1_PORT_OUT 4244
97 #define UDP1_PORT_IN 4245
100 #ifndef UDP1_BROADCAST
101 #define UDP1_BROADCAST FALSE
104 #define UDP1Init() udp_periph_init(&udp1, STRINGIFY(UDP1_HOST), UDP1_PORT_OUT, UDP1_PORT_IN, UDP1_BROADCAST)
111 #define UDP2_HOST 127.0.0.1
114 #ifndef UDP2_PORT_OUT
115 #define UDP2_PORT_OUT 4246
119 #define UDP2_PORT_IN 4247
122 #ifndef UDP2_BROADCAST
123 #define UDP2_BROADCAST FALSE
126 #define UDP2Init() udp_periph_init(&udp2, STRINGIFY(UDP2_HOST), UDP2_PORT_OUT, UDP2_PORT_IN, UDP2_BROADCAST)
uint8_t tx_buf[UDP_TX_BUFFER_SIZE]
Transmit buffer.
void udp_periph_init(struct udp_periph *p, char *host, int port_out, int port_in, bool broadcast)
Initialize the UDP peripheral.
void udp_receive(struct udp_periph *p)
Read bytes from UDP.
void udp_arch_periph_init(struct udp_periph *p, char *host, int port_out, int port_in, bool broadcast)
Initialize the UDP peripheral.
struct link_device device
Generic device interface.
int udp_check_free_space(struct udp_periph *p, long *fd, uint16_t len)
Check if there is enough free space in the transmit buffer.
void udp_send_raw(struct udp_periph *p, long fd, uint8_t *buffer, uint16_t size)
Send a packet from another buffer.
uint8_t rx_buf[UDP_RX_BUFFER_SIZE]
Receive buffer.
uint8_t udp_getch(struct udp_periph *p)
Get the last character from the receive buffer.
void udp_put_byte(struct udp_periph *p, long fd, uint8_t data)
Add one data byte to the tx buffer.
#define UDP_TX_BUFFER_SIZE
void udp_put_buffer(struct udp_periph *p, long fd, const uint8_t *data, uint16_t len)
int udp_char_available(struct udp_periph *p)
Get number of bytes available in receive buffer.
#define UDP_RX_BUFFER_SIZE
void udp_send_message(struct udp_periph *p, long fd)
Send a message.
void * network
UDP network.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.