28 #ifndef MCU_PERIPH_UDP_H
29 #define MCU_PERIPH_UDP_H
32 #include "mcu_periph/udp_arch.h"
35 #define UDP_RX_BUFFER_SIZE 256
36 #define UDP_TX_BUFFER_SIZE 256
66 #define UDP0_HOST 127.0.0.1
70 #define UDP0_PORT_OUT 4242
74 #define UDP0_PORT_IN 4243
77 #ifndef UDP0_BROADCAST
78 #define UDP0_BROADCAST FALSE
81 #define UDP0Init() udp_periph_init(&udp0, STRINGIFY(UDP0_HOST), UDP0_PORT_OUT, UDP0_PORT_IN, UDP0_BROADCAST)
88 #define UDP1_HOST 127.0.0.1
92 #define UDP1_PORT_OUT 4244
96 #define UDP1_PORT_IN 4245
99 #ifndef UDP1_BROADCAST
100 #define UDP1_BROADCAST FALSE
103 #define UDP1Init() udp_periph_init(&udp1, STRINGIFY(UDP1_HOST), UDP1_PORT_OUT, UDP1_PORT_IN, UDP1_BROADCAST)
110 #define UDP2_HOST 127.0.0.1
113 #ifndef UDP2_PORT_OUT
114 #define UDP2_PORT_OUT 4246
118 #define UDP2_PORT_IN 4247
121 #ifndef UDP2_BROADCAST
122 #define UDP2_BROADCAST FALSE
125 #define UDP2Init() udp_periph_init(&udp2, STRINGIFY(UDP2_HOST), UDP2_PORT_OUT, UDP2_PORT_IN, UDP2_BROADCAST)
bool_t udp_check_free_space(struct udp_periph *p, uint8_t len)
Check if there is enough free space in the transmit buffer.
uint16_t udp_char_available(struct udp_periph *p)
Get number of bytes available in receive buffer.
void udp_send_raw(struct udp_periph *p, uint8_t *buffer, uint16_t size)
Send a packet from another buffer.
uint8_t tx_buf[UDP_TX_BUFFER_SIZE]
Transmit buffer.
void udp_send_message(struct udp_periph *p)
Send a message.
#define UDP_RX_BUFFER_SIZE
void udp_put_byte(struct udp_periph *p, uint8_t data)
Add one data byte to the tx buffer.
uint8_t udp_getch(struct udp_periph *p)
Get the last character from the receive buffer.
void * network
UDP network.
#define UDP_TX_BUFFER_SIZE
void udp_periph_init(struct udp_periph *p, char *host, int port_out, int port_in, bool_t 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_t broadcast)
Initialize the UDP peripheral.
uint8_t rx_buf[UDP_RX_BUFFER_SIZE]
Receive buffer.
struct link_device device
Generic device interface.