ws2801d/src/main.c

55 lines
966 B
C
Raw Normal View History

2013-04-08 23:55:01 +02:00
#include <math.h>
2013-04-12 19:26:02 +02:00
2013-04-08 23:55:01 +02:00
#include <time.h>
#include <string.h>
#include <errno.h>
#include <stdint.h>
#include "../include/ws2801.h"
#include "../include/logger.h"
#include "../include/fader.h"
#include "../include/udpproto.h"
2013-04-08 23:55:01 +02:00
2013-04-12 19:26:02 +02:00
#define PORT 2703
2013-04-08 23:55:01 +02:00
#define NUM_MODULES 160
2013-04-08 23:55:01 +02:00
int main(void)
{
2013-04-12 19:26:02 +02:00
// initialize logger
2013-04-08 23:55:01 +02:00
logger_init();
// initialise the UDP server
if(udpproto_init(PORT) == -1) {
LOG(LVL_FATAL, "Could not initialize the UDP server.");
2013-04-12 19:26:02 +02:00
return 1;
}
// initialize ws2801 library
if(ws2801_init(NUM_MODULES) == -1) {
2013-04-08 23:55:01 +02:00
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;
}
2013-04-12 19:26:02 +02:00
LOG(LVL_INFO, "Initialisation complete.");
2013-04-08 23:55:01 +02:00
while(1) {
udpproto_process();
fader_update();
fader_wait_frame();
2013-04-08 23:55:01 +02:00
}
// shut down all modules
fader_shutdown();
2013-04-08 23:55:01 +02:00
ws2801_shutdown();
udpproto_shutdown();
2013-04-08 23:55:01 +02:00
return 0;
}