-
Notifications
You must be signed in to change notification settings - Fork 90
/
app.c
90 lines (72 loc) · 1.98 KB
/
app.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
/* * OSS-7 - An opensource implementation of the DASH7 Alliance Protocol for ultra
* lowpower wireless sensor communication
*
* Copyright 2015 University of Antwerp
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* \author maarten.weyn@uantwerpen.be
*/
#include <stdio.h>
#include <stdlib.h>
#include "hwuart.h"
#include "hwleds.h"
#include "hwsystem.h"
#include "hwlcd.h"
#include "scheduler.h"
#include "timer.h"
#include "log.h"
#include "debug.h"
#include "d7ap_fs.h"
#include "fifo.h"
#include "version.h"
#include "compress.h"
#include "platform_defs.h"
#include "d7ap.h"
#include "alp_layer.h"
#include "dae.h"
#include "modem_interface.h"
#include "platform.h"
#if PLATFORM_NUM_LEDS > 0
#include "hwleds.h"
void led_blink_off()
{
led_off(0);
}
void led_blink()
{
led_on(0);
timer_post_task_delay(&led_blink_off, TIMER_TICKS_PER_SEC * 0.2);
}
#endif
static void on_unsolicited_response_received(alp_interface_status_t* result, uint8_t *alp_command, uint8_t alp_command_size)
{
#if PLATFORM_NUM_LEDS > 0
led_blink();
#endif
}
static alp_init_args_t alp_init_args;
void bootstrap()
{
d7ap_init();
d7ap_fs_write_dll_conf_active_access_class(0x01); // set to first AC, which is continuous FG scan
alp_init_args.alp_received_unsolicited_data_cb = &on_unsolicited_response_received;
alp_layer_init(&alp_init_args, true);
#ifdef HAS_LCD
lcd_write_string("GW %s", _GIT_SHA1);
#endif
#if PLATFORM_NUM_LEDS > 0
sched_register_task(&led_blink_off);
#endif
}