From 16debdbce7a5d92167207c17f18406c6905eb9b5 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 21 Jul 2015 09:38:46 +0100 Subject: udp --- polycom_xmit/msg.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 polycom_xmit/msg.c (limited to 'polycom_xmit/msg.c') diff --git a/polycom_xmit/msg.c b/polycom_xmit/msg.c new file mode 100644 index 0000000..92931e4 --- /dev/null +++ b/polycom_xmit/msg.c @@ -0,0 +1,33 @@ +#include "project.h" + +static struct espconn udp; + + +void ICACHE_FLASH_ATTR +msg_send (uint32_t v) +{ + char buf[32]; + size_t len; + + len = os_sprintf (buf, "%x\r\n", v); + + udp.proto.udp->remote_port = 29153; + + udp.proto.udp->remote_ip[0] = 255; + udp.proto.udp->remote_ip[1] = 255; + udp.proto.udp->remote_ip[2] = 255; + udp.proto.udp->remote_ip[3] = 255; + + espconn_sent (&udp, buf, len); +} + + + +void ICACHE_FLASH_ATTR +msg_init (void) +{ + udp.type = ESPCONN_UDP; + udp.proto.udp = (esp_udp *) os_zalloc (sizeof (esp_udp)); + udp.proto.udp->local_port = 29153; + espconn_create (&udp); +} -- cgit v1.2.3