summaryrefslogtreecommitdiffstats
path: root/polycom_xmit/msg.c
blob: f990a4157dc0675e843df545830160edb63cbfce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "project.h"

static struct espconn udp;


void ICACHE_FLASH_ATTR
msg_send (int red, int green, uint32_t v)
{
  char buf[32];
  size_t len;

  len = os_sprintf (buf, "%d,%d,%x\r\n", red,green,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);
}