59 lines
1.0 KiB
C
59 lines
1.0 KiB
C
#include <math.h>
|
|
|
|
#include <time.h>
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
#include <stdint.h>
|
|
|
|
#include "sk6812.h"
|
|
#include "logger.h"
|
|
#include "fader.h"
|
|
#include "udpproto.h"
|
|
|
|
#define PORT 2703
|
|
|
|
#define NUM_MODULES 160
|
|
#define GPIO_IDX 960
|
|
#define BASE_ADDR ((void*)0x40000000U)
|
|
|
|
int main(void)
|
|
{
|
|
struct sk6812_ctx ctx;
|
|
|
|
// 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(sk6812_init(&ctx, GPIO_IDX, BASE_ADDR, NUM_MODULES) == -1) {
|
|
LOG(LVL_FATAL, "Could not initialize SK6812 library.");
|
|
return 1;
|
|
}
|
|
|
|
// initialise the LED fader
|
|
if(fader_init(NUM_MODULES, &ctx) == -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();
|
|
sk6812_shutdown(&ctx);
|
|
udpproto_shutdown();
|
|
|
|
return 0;
|
|
}
|