sk6812d/src/main.c

55 lines
922 B
C

#include <math.h>
#include <time.h>
#include <string.h>
#include <errno.h>
#include <stdint.h>
#include "ws2801.h"
#include "logger.h"
#include "fader.h"
#include "udpproto.h"
#define PORT 2703
#define NUM_MODULES 160
int main(void)
{
// initialize logger
logger_init();
// initialise the UDP server
if(udpproto_init(PORT) == -1) {
LOG(LVL_FATAL, "Could not initialize the UDP server.");
return 1;
}
// initialize ws2801 library
if(ws2801_init(NUM_MODULES) == -1) {
LOG(LVL_FATAL, "Could not initialize WS2801 library.");
return 1;
}
// initialise the LED fader
if(fader_init(NUM_MODULES) == -1) {
LOG(LVL_FATAL, "Could not initialize the LED fader.");
return 1;
}
LOG(LVL_INFO, "Initialisation complete.");
while(1) {
udpproto_process();
fader_update();
fader_wait_frame();
}
// shut down all modules
fader_shutdown();
ws2801_shutdown();
udpproto_shutdown();
return 0;
}