greenhouse
source
main.cpp
Go to the documentation of this file.
1
#include "Callback.h"
2
#include "
database.h
"
3
#include "
jukebox_task.h
"
4
#include "mbed.h"
5
#include "mbed_wait_api.h"
6
#include "
storage_task.h
"
7
#include "
ui/ui.h
"
8
#include "
webserver.h
"
9
#include <cstdint>
10
#include <cstdlib>
11
#include "
tasks.h
"
12
13
Thread
thread_main
;
14
Thread
thread_web_server
;
15
Thread
thread_jukebox
;
16
Thread
thread_stats
;
17
Thread
thread_sd
;
18
19
UI::Display
*
display
;
20
21
void
webserver_task
(
WebServer
*webServer) {
22
while
(
true
) {
23
webServer->
tick
();
24
}
25
}
26
27
Tasks::Stats
*
task_stats
;
28
29
void
stats_task
() {
30
task_stats
->
setDisplay
(
display
);
31
task_stats
->
start
();
32
}
33
34
void
jukebox_task
() {
35
Tasks::Jukebox
*jukebox;
36
jukebox->
start
();
37
}
38
39
int
main
(
void
) {
40
display
->
init
();
41
42
thread_stats
.start(
stats_task
);
43
thread_jukebox
.start(
jukebox_task
);
44
45
Database
db
;
46
WebServer
webServer =
WebServer
(&
db
);
47
48
display
->
log
((uint8_t *)
"[webserver]: starting"
);
49
50
int
status = webServer.
start
();
51
if
(status == 0) {
52
display
->
log
((uint8_t *)
"[webserver]: error - No network interface found"
);
53
return
1;
54
}
55
56
display
->
log
((uint8_t *)
"[webserver]: IP: 192.168.1.100"
);
57
58
display
->
log
((uint8_t *)
"[host]: spawning webserver_thread"
);
59
thread_web_server
.start(callback(
webserver_task
, &webServer));
60
61
Tasks::Storage
*storage;
62
storage->
example
(
display
);
63
64
return
0;
65
}
Database
Definition:
database.h:12
Tasks::Jukebox
Definition:
jukebox_task.h:5
Tasks::Jukebox::start
void start()
Definition:
jukebox_task.cpp:15
Tasks::Stats
Definition:
stats_task.h:7
Tasks::Stats::setDisplay
void setDisplay(UI::Display *display)
Definition:
stats_task.cpp:17
Tasks::Stats::start
void start()
Definition:
stats_task.cpp:27
Tasks::Storage
Definition:
storage_task.h:6
Tasks::Storage::example
void example(UI::Display *display)
Definition:
storage_task.cpp:21
UI::Display
Definition:
ui.h:8
UI::Display::log
void log(uint8_t *text)
Definition:
ui.cpp:53
UI::Display::init
void init()
Definition:
ui.cpp:33
WebServer
Definition:
webserver.h:9
WebServer::start
int start()
Definition:
webserver.cpp:28
WebServer::tick
void tick()
Definition:
webserver.cpp:92
database.h
jukebox_task.h
jukebox_task
void jukebox_task()
Definition:
main.cpp:34
thread_main
Thread thread_main
Definition:
main.cpp:13
main
int main(void)
Definition:
main.cpp:39
task_stats
Tasks::Stats * task_stats
Definition:
main.cpp:27
thread_sd
Thread thread_sd
Definition:
main.cpp:17
thread_stats
Thread thread_stats
Definition:
main.cpp:16
thread_web_server
Thread thread_web_server
Definition:
main.cpp:14
stats_task
void stats_task()
Definition:
main.cpp:29
display
UI::Display * display
Definition:
main.cpp:19
webserver_task
void webserver_task(WebServer *webServer)
Definition:
main.cpp:21
thread_jukebox
Thread thread_jukebox
Definition:
main.cpp:15
storage_task.h
tasks.h
ui.h
db
Database * db
Definition:
webserver.cpp:14
webserver.h
Generated on Mon Aug 16 2021 20:30:21 for greenhouse by
1.9.1