-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.c
596 lines (504 loc) · 19.9 KB
/
main.c
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
/* Copyright (c) 2010 - 2018, Nordic Semiconductor ASA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdint.h>
#include <string.h>
/* HAL */
#include "boards.h"
#include "nrf_delay.h"
#include "simple_hal.h"
/* Core */
#include "nrf_mesh.h"
#include "nrf_mesh_events.h"
#include "nrf_mesh_assert.h"
#include "access_config.h"
#include "device_state_manager.h"
#include "flash_manager.h"
#include "mesh_stack.h"
#include "net_state.h"
/* Provisioning and configuration */
#include "provisioner_helper.h"
#include "node_setup.h"
#include "mesh_app_utils.h"
#include "mesh_softdevice_init.h"
/* Models */
#include "config_client.h"
#include "config_server.h"
#include "health_client.h"
#include "simple_on_off_client.h"
/* Logging and RTT */
#include "rtt_input.h"
#include "log.h"
/* Example specific includes */
#include "light_switch_example_common.h"
#include "example_network_config.h"
#include "nrf_mesh_config_examples.h"
#define RTT_INPUT_POLL_PERIOD_MS (100)
#define LED_BLINK_INTERVAL_MS (200)
#define LED_BLINK_CNT_START (2)
#define LED_BLINK_CNT_PROV (4)
#define APP_NETWORK_STATE_ENTRY_HANDLE (0x0001)
#define APP_FLASH_PAGE_COUNT (1)
#define APP_PROVISIONING_LED BSP_LED_0
#define APP_CONFIGURATION_LED BSP_LED_1
/* Required for the provisioner helper module */
static network_dsm_handles_data_volatile_t m_dev_handles;
static network_stats_data_stored_t m_nw_state;
static const uint8_t m_client_node_uuid[NRF_MESH_UUID_SIZE] = CLIENT_NODE_UUID;
static const uint8_t m_server_uuid_filter[SERVER_NODE_UUID_PREFIX_SIZE] = SERVER_NODE_UUID_PREFIX;
static prov_helper_uuid_filter_t m_exp_uuid;
static bool m_node_prov_setup_started;
/* Forward declarations */
static void app_health_event_cb(const health_client_t * p_client, const health_client_evt_t * p_event);
static void app_config_successful_cb(void);
static void app_config_failed_cb(void);
static void app_mesh_core_event_cb (const nrf_mesh_evt_t * p_evt);
static void app_start(void);
static nrf_mesh_evt_handler_t m_mesh_core_event_handler = { .evt_cb = app_mesh_core_event_cb };
/*****************************************************************************/
/**** Flash handling ****/
#if PERSISTENT_STORAGE
static flash_manager_t m_flash_manager;
static void app_flash_manager_add(void);
static void flash_write_complete(const flash_manager_t * p_manager, const fm_entry_t * p_entry, fm_result_t result)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Flash write complete\n");
/* If we get an AREA_FULL then our calculations for flash space required are buggy. */
NRF_MESH_ASSERT(result != FM_RESULT_ERROR_AREA_FULL);
/* We do not invalidate in this module, so a NOT_FOUND should not be received. */
NRF_MESH_ASSERT(result != FM_RESULT_ERROR_NOT_FOUND);
if (result == FM_RESULT_ERROR_FLASH_MALFUNCTION)
{
ERROR_CHECK(NRF_ERROR_NO_MEM);
}
}
static void flash_invalidate_complete(const flash_manager_t * p_manager, fm_handle_t handle, fm_result_t result)
{
/* This application does not expect invalidate complete calls. */
ERROR_CHECK(NRF_ERROR_INTERNAL);
}
typedef void (*flash_op_func_t) (void);
static void flash_manager_mem_available(void * p_args)
{
((flash_op_func_t) p_args)(); /*lint !e611 Suspicious cast */
}
static void flash_remove_complete(const flash_manager_t * p_manager)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Flash remove complete\n");
}
static void app_flash_manager_add(void)
{
static fm_mem_listener_t flash_add_mem_available_struct = {
.callback = flash_manager_mem_available,
.p_args = app_flash_manager_add
};
flash_manager_config_t manager_config;
manager_config.write_complete_cb = flash_write_complete;
manager_config.invalidate_complete_cb = flash_invalidate_complete;
manager_config.remove_complete_cb = flash_remove_complete;
manager_config.min_available_space = WORD_SIZE;
manager_config.p_area = (const flash_manager_page_t *) (((const uint8_t *) dsm_flash_area_get()) - (ACCESS_FLASH_PAGE_COUNT * PAGE_SIZE * 2));
manager_config.page_count = APP_FLASH_PAGE_COUNT;
uint32_t status = flash_manager_add(&m_flash_manager, &manager_config);
if (NRF_SUCCESS != status)
{
flash_manager_mem_listener_register(&flash_add_mem_available_struct);
__LOG(LOG_SRC_APP, LOG_LEVEL_ERROR, "Unable to add flash manager for app data\n");
}
}
static bool load_app_data(void)
{
flash_manager_wait();
const fm_entry_t * p_entry = flash_manager_entry_get(&m_flash_manager, APP_NETWORK_STATE_ENTRY_HANDLE);
if (p_entry == NULL)
{
memset(&m_nw_state, 0x00, sizeof(m_nw_state));
return false;
}
memcpy(&m_nw_state, p_entry->data, sizeof(m_nw_state));
return true;
}
static uint32_t store_app_data(void)
{
fm_entry_t * p_entry = flash_manager_entry_alloc(&m_flash_manager, APP_NETWORK_STATE_ENTRY_HANDLE, sizeof(m_nw_state));
static fm_mem_listener_t flash_add_mem_available_struct = {
.callback = flash_manager_mem_available,
.p_args = store_app_data
};
if (p_entry == NULL)
{
flash_manager_mem_listener_register(&flash_add_mem_available_struct);
}
else
{
network_stats_data_stored_t * p_nw_state = (network_stats_data_stored_t *) p_entry->data;
memcpy(p_nw_state, &m_nw_state, sizeof(m_nw_state));
flash_manager_entry_commit(p_entry);
}
return NRF_SUCCESS;
}
static void clear_app_data(void)
{
memset(&m_nw_state, 0x00, sizeof(m_nw_state));
if (flash_manager_remove(&m_flash_manager) != NRF_SUCCESS)
{
/* Register the listener and wait for some memory to be freed up before we retry. */
static fm_mem_listener_t mem_listener = {.callback = flash_manager_mem_available,
.p_args = clear_app_data};
flash_manager_mem_listener_register(&mem_listener);
}
}
#else
static void clear_app_data(void)
{
return;
}
bool load_app_data(void)
{
return false;
}
static uint32_t store_app_data(void)
{
return NRF_SUCCESS;
}
#endif
static void app_data_store_cb(void)
{
ERROR_CHECK(store_app_data());
}
/*****************************************************************************/
/**** Configuration process related callbacks ****/
static void app_config_successful_cb(void)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Configuration of device %u successful\n", m_nw_state.configured_devices);
hal_led_pin_set(APP_CONFIGURATION_LED, 0);
m_nw_state.configured_devices++;
access_flash_config_store();
ERROR_CHECK(store_app_data());
if (m_nw_state.configured_devices < SERVER_NODE_COUNT)
{
m_exp_uuid.p_uuid = m_server_uuid_filter;
m_exp_uuid.length = SERVER_NODE_UUID_PREFIX_SIZE;
prov_helper_provision_next_device(PROVISIONER_RETRY_COUNT, m_nw_state.next_device_address, &m_exp_uuid);
prov_helper_scan_start();
hal_led_pin_set(APP_PROVISIONING_LED, 1);
}
else
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "All servers provisioned\n");
hal_led_blink_ms(LEDS_MASK, LED_BLINK_INTERVAL_MS, LED_BLINK_CNT_PROV);
}
}
static void app_config_failed_cb(void)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Configuration of device %u failed. Press Button 1 to retry.\n", m_nw_state.configured_devices);
m_node_prov_setup_started = false;
hal_led_pin_set(APP_CONFIGURATION_LED, 0);
}
static void app_prov_success_cb(void)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Provisioning successful\n");
hal_led_pin_set(APP_PROVISIONING_LED, 0);
hal_led_pin_set(APP_CONFIGURATION_LED, 1);
}
static void app_prov_failed_cb(void)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Provisioning failed. Press Button 1 to retry.\n");
m_node_prov_setup_started = false;
hal_led_pin_set(APP_PROVISIONING_LED, 0);
}
/*****************************************************************************/
/**** Model related callbacks ****/
static void app_health_event_cb(const health_client_t * p_client, const health_client_evt_t * p_event)
{
switch (p_event->type)
{
case HEALTH_CLIENT_EVT_TYPE_CURRENT_STATUS_RECEIVED:
__LOG(LOG_SRC_APP,
LOG_LEVEL_INFO,
"Node 0x%04x alive with %u active fault(s), RSSI: %d\n",
p_event->p_meta_data->src.value,
p_event->data.fault_status.fault_array_length,
((p_event->p_meta_data->p_core_metadata->source == NRF_MESH_RX_SOURCE_SCANNER)
? p_event->p_meta_data->p_core_metadata->params.scanner.rssi
: 0));
break;
default:
break;
}
}
static void app_config_server_event_cb(const config_server_evt_t * p_evt)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "config_server Event %d.\n", p_evt->type);
if (p_evt->type == CONFIG_SERVER_EVT_NODE_RESET)
{
/* This should never return */
hal_device_reset(0);
}
}
static void app_config_client_event_cb(config_client_event_type_t event_type, const config_client_event_t * p_event, uint16_t length)
{
/* USER_NOTE: Do additional processing of config client events here if required */
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Config client event\n");
/* Pass events to the node setup helper module for further processing */
node_setup_config_client_event_process(event_type, p_event, length);
}
/** Check if all devices have been provisioned. If not, provision remaining devices.
* Check if all devices have been configured. If not, start configuring them.
*/
static void check_network_state(void)
{
if (!m_node_prov_setup_started)
{
/* If previously provisioned device is not configured, start node setup procedure. */
if (m_nw_state.configured_devices < m_nw_state.provisioned_devices)
{
/* Execute configuration */
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Waiting for provisioned node to be configured ...\n");
node_setup_start(m_nw_state.last_device_address, PROVISIONER_RETRY_COUNT,
m_nw_state.appkey, APPKEY_INDEX);
hal_led_pin_set(APP_CONFIGURATION_LED, 1);
}
else if (m_nw_state.provisioned_devices == 0)
{
/* Start provisioning - First provision the client with known UUID */
m_exp_uuid.p_uuid = m_client_node_uuid;
m_exp_uuid.length = NRF_MESH_UUID_SIZE;
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Waiting for Client node to be provisioned ...\n");
prov_helper_provision_next_device(PROVISIONER_RETRY_COUNT, m_nw_state.next_device_address, &m_exp_uuid);
prov_helper_scan_start();
hal_led_pin_set(APP_PROVISIONING_LED, 1);
}
else if (m_nw_state.provisioned_devices < SERVER_NODE_COUNT)
{
/* Start provisioning - rest of the devices */
m_exp_uuid.p_uuid = m_server_uuid_filter;
m_exp_uuid.length = SERVER_NODE_UUID_PREFIX_SIZE;
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Waiting for Server node to be provisioned ...\n");
prov_helper_provision_next_device(PROVISIONER_RETRY_COUNT, m_nw_state.next_device_address, &m_exp_uuid);
prov_helper_scan_start();
hal_led_pin_set(APP_PROVISIONING_LED, 1);
}
m_node_prov_setup_started = true;
}
else
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Waiting for previous procedure to finish ...\n");
}
}
static void app_mesh_core_event_cb (const nrf_mesh_evt_t * p_evt)
{
/* USER_NOTE: User can insert mesh core event proceesing here */
switch(p_evt->type)
{
/* Start user application specific functions only when flash is stable */
case NRF_MESH_EVT_FLASH_STABLE:
__LOG(LOG_SRC_APP, LOG_LEVEL_DBG1, "Mesh evt: FLASH_STABLE \n");
#if (PERSISTENT_STORAGE)
{
static bool s_app_started;
if (!s_app_started)
{
/* Flash operation initiated during initialization has been completed */
app_start();
s_app_started = true;
}
}
#endif
break;
default:
__LOG(LOG_SRC_APP, LOG_LEVEL_DBG1, "Unhandled Mesh Event: %d \n", p_evt->type);
break;
}
}
/* Binds the local models correctly with the desired keys */
void app_default_models_bind_setup(void)
{
/* Bind health client to App key, and configure publication key */
ERROR_CHECK(access_model_application_bind(m_dev_handles.m_health_client_instance.model_handle, m_dev_handles.m_appkey_handle));
ERROR_CHECK(access_model_publish_application_set(m_dev_handles.m_health_client_instance.model_handle, m_dev_handles.m_appkey_handle));
/* Bind self-config server to the self device key */
ERROR_CHECK(config_server_bind(m_dev_handles.m_self_devkey_handle));
}
static bool app_flash_config_load(void)
{
bool app_load = false;
#if PERSISTENT_STORAGE
app_flash_manager_add();
app_load = load_app_data();
#endif
if (!app_load)
{
m_nw_state.provisioned_devices = 0;
m_nw_state.configured_devices = 0;
m_nw_state.next_device_address = UNPROV_START_ADDRESS;
ERROR_CHECK(store_app_data());
}
else
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Restored: App data\n");
}
return app_load;
}
static void button_event_handler(uint32_t button_number)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Button %u pressed\n", button_number + 1);
switch (button_number)
{
case 0:
{
/* Check if all devices have been provisioned or not */
check_network_state();
break;
}
/* Initiate node reset */
case 3:
{
/* Clear all the states to reset the node. */
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- Node reset -----\n");
clear_app_data();
mesh_stack_config_clear();
hal_led_blink_ms(1 << BSP_LED_3, LED_BLINK_INTERVAL_MS, LED_BLINK_CNT_PROV);
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- Press reset button or power cycle the device -----\n");
break;
}
default:
break;
}
}
static void app_rtt_input_handler(int key)
{
if (key >= '0' && key <= '4')
{
uint32_t button_number = key - '0';
button_event_handler(button_number);
}
}
void models_init_cb(void)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Initializing and adding models\n");
m_dev_handles.m_netkey_handle = DSM_HANDLE_INVALID;
m_dev_handles.m_appkey_handle = DSM_HANDLE_INVALID;
m_dev_handles.m_self_devkey_handle = DSM_HANDLE_INVALID;
/* This app requires following models :
* config client : To be able to configure other devices
* health client : To be able to interact with other health servers */
ERROR_CHECK(config_client_init(app_config_client_event_cb));
ERROR_CHECK(health_client_init(&m_dev_handles.m_health_client_instance, 0, app_health_event_cb));
}
static void mesh_init(void)
{
bool device_provisioned;
mesh_stack_init_params_t init_params =
{
.core.irq_priority = NRF_MESH_IRQ_PRIORITY_LOWEST,
.core.lfclksrc = DEV_BOARD_LF_CLK_CFG,
.models.models_init_cb = models_init_cb,
.models.config_server_cb = app_config_server_event_cb
};
ERROR_CHECK(mesh_stack_init(&init_params, &device_provisioned));
nrf_mesh_evt_handler_add(&m_mesh_core_event_handler);
/* Load application configuration, if available */
m_dev_handles.flash_load_success = app_flash_config_load();
/* Initialize the provisioner */
mesh_provisioner_init_params_t m_prov_helper_init_info =
{
.p_dev_data = &m_dev_handles,
.p_nw_data = &m_nw_state,
.netkey_idx = NETKEY_INDEX,
.p_data_store_cb = app_data_store_cb,
.p_prov_success_cb = app_prov_success_cb,
.p_prov_failed_cb = app_prov_failed_cb
};
prov_helper_init(&m_prov_helper_init_info);
if (!device_provisioned)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Setup defaults: Adding keys, addresses, and bindings \n");
prov_helper_provision_self();
app_default_models_bind_setup();
access_flash_config_store();
app_data_store_cb();
}
else
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Restored: Handles \n");
prov_helper_device_handles_load();
}
node_setup_cb_set(app_config_successful_cb, app_config_failed_cb);
}
static void initialize(void)
{
__LOG_INIT(LOG_SRC_APP | LOG_SRC_ACCESS, LOG_LEVEL_INFO, LOG_CALLBACK_DEFAULT);
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- BLE Mesh Light Switch Provisioner Demo -----\n");
hal_leds_init();
#if BUTTON_BOARD
ERROR_CHECK(hal_buttons_init(button_event_handler));
#endif
/* Mesh Init */
nrf_clock_lf_cfg_t lfc_cfg = DEV_BOARD_LF_CLK_CFG;
ERROR_CHECK(mesh_softdevice_init(lfc_cfg));
mesh_init();
}
static void app_start(void)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Starting application ...\n");
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Provisoned Nodes: %d, Configured Nodes: %d Last Address: %d Next Address: 0x%04x\n",
m_nw_state.provisioned_devices, m_nw_state.configured_devices, m_nw_state.last_device_address, m_nw_state.next_device_address);
__LOG_XB(LOG_SRC_APP, LOG_LEVEL_INFO, "Dev key ", m_nw_state.self_devkey, NRF_MESH_KEY_SIZE);
__LOG_XB(LOG_SRC_APP, LOG_LEVEL_INFO, "Net key ", m_nw_state.netkey, NRF_MESH_KEY_SIZE);
__LOG_XB(LOG_SRC_APP, LOG_LEVEL_INFO, "App key ", m_nw_state.appkey, NRF_MESH_KEY_SIZE);
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Press Button 1 to start provisioning and configuration process. \n");
}
static void start(void)
{
rtt_input_enable(app_rtt_input_handler, RTT_INPUT_POLL_PERIOD_MS);
ERROR_CHECK(nrf_mesh_enable());
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "<start> \n");
#if (!PERSISTENT_STORAGE)
app_start();
#endif
hal_led_mask_set(LEDS_MASK, LED_MASK_STATE_OFF);
hal_led_blink_ms(LEDS_MASK, LED_BLINK_INTERVAL_MS, LED_BLINK_CNT_START);
}
int main(void)
{
initialize();
execution_start(start);
for (;;)
{
(void)sd_app_evt_wait();
}
}