greenhouse
Functions | Variables
main.cpp File Reference
#include "Callback.h"
#include "database.h"
#include "jukebox_task.h"
#include "mbed.h"
#include "mbed_wait_api.h"
#include "storage_task.h"
#include "ui/ui.h"
#include "webserver.h"
#include <cstdint>
#include <cstdlib>
#include "tasks.h"
Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

void webserver_task (WebServer *webServer)
 
void stats_task ()
 
void jukebox_task ()
 
int main (void)
 

Variables

Thread thread_main
 
Thread thread_web_server
 
Thread thread_jukebox
 
Thread thread_stats
 
Thread thread_sd
 
UI::Displaydisplay
 
Tasks::Statstask_stats
 

Function Documentation

◆ jukebox_task()

void jukebox_task ( )

Definition at line 34 of file main.cpp.

34  {
35  Tasks::Jukebox *jukebox;
36  jukebox->start();
37 }

References Tasks::Jukebox::start().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( void  )

Definition at line 39 of file main.cpp.

39  {
40  display->init();
41 
42  thread_stats.start(stats_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 }
void example(UI::Display *display)
void log(uint8_t *text)
Definition: ui.cpp:53
void init()
Definition: ui.cpp:33
int start()
Definition: webserver.cpp:28
void jukebox_task()
Definition: main.cpp:34
Thread thread_stats
Definition: main.cpp:16
Thread thread_web_server
Definition: main.cpp:14
void stats_task()
Definition: main.cpp:29
UI::Display * display
Definition: main.cpp:19
void webserver_task(WebServer *webServer)
Definition: main.cpp:21
Thread thread_jukebox
Definition: main.cpp:15
Database * db
Definition: webserver.cpp:14

References db, display, Tasks::Storage::example(), UI::Display::init(), jukebox_task(), UI::Display::log(), WebServer::start(), stats_task(), thread_jukebox, thread_stats, thread_web_server, and webserver_task().

Here is the call graph for this function:

◆ stats_task()

void stats_task ( )

Definition at line 29 of file main.cpp.

29  {
31  task_stats->start();
32 }
void setDisplay(UI::Display *display)
Definition: stats_task.cpp:17
void start()
Definition: stats_task.cpp:27
Tasks::Stats * task_stats
Definition: main.cpp:27

References display, Tasks::Stats::setDisplay(), Tasks::Stats::start(), and task_stats.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ webserver_task()

void webserver_task ( WebServer webServer)

Definition at line 21 of file main.cpp.

21  {
22  while (true) {
23  webServer->tick();
24  }
25 }
void tick()
Definition: webserver.cpp:92

References WebServer::tick().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ display

UI::Display* display

Definition at line 19 of file main.cpp.

Referenced by Tasks::Storage::example(), main(), Tasks::Stats::setDisplay(), and stats_task().

◆ task_stats

Tasks::Stats* task_stats

Definition at line 27 of file main.cpp.

Referenced by stats_task().

◆ thread_jukebox

Thread thread_jukebox

Definition at line 15 of file main.cpp.

Referenced by main().

◆ thread_main

Thread thread_main

Definition at line 13 of file main.cpp.

◆ thread_sd

Thread thread_sd

Definition at line 17 of file main.cpp.

◆ thread_stats

Thread thread_stats

Definition at line 16 of file main.cpp.

Referenced by main().

◆ thread_web_server

Thread thread_web_server

Definition at line 14 of file main.cpp.

Referenced by main().