Skip to content
This repository was archived by the owner on Apr 24, 2019. It is now read-only.

Commit 1d1e02e

Browse files
Yogesh PandeYogesh Pande
Yogesh Pande
authored and
Yogesh Pande
committed
Adding MESH flag for event loop.
Event loop is currently initialized in Mesh API so while using Mesh API, example application doesn't need to initialize the event loop for mbed Client.
1 parent 9916bca commit 1d1e02e

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

main.cpp

+15-6
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818
#include <sstream>
1919
#include <vector>
2020
#include "mbed-trace/mbed_trace.h"
21-
#include "eventOS_scheduler.h"
22-
#include "eventOS_event.h"
23-
#include "nsdynmemLIB.h"
24-
#include "platform/arm_hal_timer.h"
25-
#include "ns_event_loop.h"
2621

2722
#include "security.h"
2823

@@ -54,9 +49,19 @@ LoWPANNDInterface mesh;
5449
ThreadInterface mesh;
5550
#endif
5651

52+
#ifndef MESH
53+
#include "eventOS_scheduler.h"
54+
#include "eventOS_event.h"
55+
#include "nsdynmemLIB.h"
56+
#include "platform/arm_hal_timer.h"
57+
#include "ns_event_loop.h"
58+
5759
#define HEAP_SIZE 32500
5860
static uint8_t app_stack_heap[HEAP_SIZE + 1];
5961

62+
#endif
63+
64+
6065
Serial output(USBTX, USBRX);
6166

6267
// These are example resource values for the Device Object
@@ -254,12 +259,14 @@ int main() {
254259
mbed_trace_init();
255260
mbed_trace_print_function_set(trace_printer);
256261

262+
#ifndef MESH
257263
ns_dyn_mem_init(app_stack_heap, HEAP_SIZE,
258264
NULL, 0);
259265
platform_timer_enable();
260266
eventOS_scheduler_init();
261267
ns_event_loop_thread_create();
262268
ns_event_loop_thread_start();
269+
#endif
263270

264271
NetworkStack *network_stack = 0;
265272
#if defined WIFI
@@ -325,7 +332,9 @@ int main() {
325332
while (true) {
326333
updates.wait(25000);
327334
if(registered) {
328-
mbed_client.test_update_register();
335+
if(!clicked) {
336+
mbed_client.test_update_register();
337+
}
329338
}else {
330339
break;
331340
}

0 commit comments

Comments
 (0)