NPR70/NPR_14/source/Virt_Chan.cpp
Vlastimil Slinták 16140fd383 Initial commit with the original FW
This FW for the New Packet Radio project was taken from the Hackaday
project https://hackaday.io/project/164092-npr-new-packet-radio

The source code is original without any modifications, ver. 2020_06_29.
2025-03-11 23:20:01 +01:00

26 lines
647 B
C++

#include "Virt_Chan.h"
#include "mbed.h"
int RTP_gateway (W5500_chip* W5500) {
static unsigned char RX_data[1600];
static unsigned char IP_addr_1[6]={10,151,0,20};
static unsigned char eth_peer[8]={0x00,0x13,0x3b,0x73,0x12,0xae};
int RX_size=0;
int size_UDP;
int answer=0;
RX_size = W5500_read_received_size(W5500, 2);
if (RX_size > 0) {
answer = 1;
size_UDP = W5500_read_UDP_pckt(W5500, 2, RX_data);
W5500_write_short(W5500, 0x0006, 0x09, eth_peer, 6);
W5500_write_short(W5500, 0x000C, 0x09, IP_addr_1, 4);
W5500_write_TX_buffer(W5500, 2, RX_data+8, size_UDP-8, 1);
}
return answer;
}