cueOS  2.4
cueOS - Universal Show Control OS for ARM
cueos.c
1
6#include "stm32f4xx_hal.h"
7#include "cmsis_os.h"
8#include "net.h"
9#include "leds_driver.h"
10#include "osc_server.h"
11#include "web_application.h"
12#include "rest_api.h"
13#include "DMX512_engine.h"
14#include "device.h"
15#include "cueos_config.h"
16#include "cueos.h"
17#include "keys_driver.h"
18
19
20osThreadId_t cueos_thread_id = NULL;
21
22static void test(void){
23 osDelay(250);
24 osc_packet_send(1,2,3,256);
25}
26
27
28//TODO: node type configuration here is quite a bit confusing. Clean this whole file.
29static void _cueos_thread(void *arg){
30
31 fs_init();
36 //keys_init();
37
38#if cueOS_CONFIG_NODETYPE == cueOS_NODETYPE_MASTER
39 Q_server_init();
40 webapp_static_start();
41#elif cueOS_CONFIG_NODETYPE == cueOS_NODETYPE_SLAVE_DMX
44#elif cueOS_CONFIG_NODETYPE == cueOS_NODETYPE_SLAVE_PYRO
45 Q_client_init();
46 pyro_engine_init();
47#elif cueOS_CONFIG_NODETYPE == cueOS_NODETYPE_SLAVE_MEDIA
48 Q_client_init();
49 media_engine_init();
50#endif
51
53
54 for(;;){
55 osDelay(500);
56 }
57
58}
59
71//TODO: implement global error handler
72//TODO: I'm not happy with this file design, please look into clarifying all this mess
73void cueos_start(void){
74
75 device_init();
76
77 osThreadAttr_t attr = {.stack_size = 4096,.priority = (osPriority_t) osPriorityNormal};
78 cueos_thread_id = osThreadNew(_cueos_thread, NULL, &attr);
79
80}
void DMX512_engine_init(void)
Initialises the DMX512 engine singleton.
Definition: DMX512_engine.c:61
void osc_packet_send(osc_media_type_e media_type, osc_control_type_e ctrl_type, uint16_t ctrl_id, uint32_t ctrl_val)
Prepares and send an OSC packet over UDP.
Definition: osc_server.c:115
void osc_server_init(void)
Initialises the OSC server instance.
Definition: osc_server.c:101
void rest_api_start(void)
Starts API HTTP server on port 8000.
Definition: rest_api.c:41
void web_application_start(void)
Starts static HTTP server on port 80. This server is ONLY dedicated to serve compiled HTML static fil...
fs_err_e fs_init(void)
Initialises the file system.
Definition: fs.c:33
void leds_driver_init(void)
LED Driver initialisation.
Definition: leds_driver.c:87
void leds_driver_set(led_driver_led_e led, led_driver_led_state_e state)
Assigns a state to a driver's led.
Definition: leds_driver.c:110
@ LED_STATE
Definition: leds_driver.h:59
@ LED_BLINK
Definition: leds_driver.h:42
void net_init(net_mode_e mode, void *net_ready_callback)
Initialises network.
Definition: net.c:138
@ NET_MODE_ETHERNET
Definition: net.h:44