-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhello.c
More file actions
executable file
·42 lines (34 loc) · 851 Bytes
/
hello.c
File metadata and controls
executable file
·42 lines (34 loc) · 851 Bytes
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
34
35
36
37
38
39
40
41
42
#include "hello.h"
#include "udp_connection.h"
#include "ets_sys.h"
#include "osapi.h"
#include "os_type.h"
#include "ip_addr.h"
#include "user_interface.h"
#include "espconn.h"
#include "packet.h"
#include "protocol.h"
#include "network.h"
#include "espmissingincludes.h"
#define PERIOD 500
static struct qsy_packet hello_packet;
static os_timer_t timer;
static void timer_cb(void *arg);
void ICACHE_FLASH_ATTR hello_start(void)
{
udp_connection_init();
packet_init(&hello_packet);
packet_set_type(&hello_packet, hello);
os_timer_disarm(&timer);
os_timer_setfn(&timer, (os_timer_func_t *) timer_cb, NULL);
os_timer_arm(&timer, PERIOD, true);
}
void ICACHE_FLASH_ATTR hello_stop(void)
{
udp_connection_stop();
os_timer_disarm(&timer);
}
static void timer_cb(void *arg)
{
udp_connection_send_message(&hello_packet, QSY_PACKET_SIZE);
}