-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboot.c
132 lines (106 loc) · 2.85 KB
/
boot.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
#include <stdio.h>
#include "contiki.h"
#include "mc1322x.h"
#include "commands.h"
#include "uart2_handler.h"
//#include "uarts_test.h"
#include "collect_my.h"
#include "mesh_my.h"
#include "rudolph1_my.h"
#include "settings_read.h"
#include "ble.h"
#include "lcd.h"
#include "rot_enc.h"
#include "menu.h"
#include "serial-shell.h"
#include "dev/serial-line.h"
#include "io-pins.h"
#include "buzzer.h"
PROCESS(boot_process, "Boot Process");
AUTOSTART_PROCESSES(&boot_process);
PROCESS_THREAD(boot_process, ev, data)
{
PROCESS_BEGIN();
printf("Stuff to be done during boot:\n\r");
// system initialization
printf("configure io pins...");
ioPins_configurePin(BLE_RST_PIN, USEGPIO, OUTPUT, NOPULLUP, HYSTERESIS_OFF);
ioPins_configurePin(LCD_BACKLIGHT_PIN, USEGPIO, OUTPUT, NOPULLUP, HYSTERESIS_OFF);
ioPins_setValue(BLE_RST_PIN, 0); // dont boot ble yet
ioPins_setValue(LCD_BACKLIGHT_PIN, 0); // lcd backlight off
printf("[OK]\n\r");
printf("initialize uart2...");
uart2_handler_init();
printf("[OK]\n\r");
printf("initialize serial line...");
serial_line_init();
printf("[OK]\n\r");
printf("initialize serial shell...");
set_shell_default_output(UART1);
serial_shell_init();
printf("[OK]\n\r");
printf("initialize file shell...");
shell_file_init();
printf("[OK]\n\r");
printf("register own shell commands...");
commands_init();
printf("[OK]\n\r");
/*
printf("initialize rotary encoder...");
rot_enc_init();
printf("[OK]\n\r");
printf("initialize menu...");
menu_init();
printf("[OK]\n\r");
*/
/*
printf("initialize uSD card...");
uSDcard_init();
printf("[OK]\n\r");
printf("initialize uarts test...");
uarts_test_init();
printf("[OK]\n\r");
*/
//printf("initialize rime collect...");
//collect_init();
//printf("[OK]\n\r");
// initialize network protocols
printf("initialize rime mesh...");
mesh_init();
printf("[OK]\n\r");
/*
printf("initialize rudolph1...");
rudolph1_init();
printf("[OK]\n\r");
*/
/*
printf("load settings from sd card...\n\r");
load_settings();
printf("[OK]\n\r");
*/
set_shell_default_output(UART1);
printf("Default shell output is UART1\n\r");
//uart1_set_input(serial_line_input_byte);
uart1_set_input(NULL);
uart2_serial_input_init();
rimeaddr_t my_addr;
my_addr.u8[0] = 6;
my_addr.u8[1] = 6;
rimeaddr_set_node_addr(&my_addr);
uart2_log_init();
ioPins_setValue(8, 1); // ble reset high
ble_init();
ringtone_init();
static char *boot_song = "2.txt";
process_post(&ringtone_process, ringtone_play_event, boot_song);
//lcd_init();
printf("initialize uSD card...");
uSDcard_init();
printf("[OK]\n\r");
// for amman
//process_start(&uart1_shell_disable_process, NULL);
//process_start(&rimeaddr_change_process, "10");
// TODO: register itself in the hub (gateway)
printf("Boot succesfull.\n\r");
PROCESS_END();
}