forked from kukulski/BeagleBoneUDPLED
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tallwide.cpp
67 lines (53 loc) · 1.4 KB
/
tallwide.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//
// main.c
// udpListen
//
// Created by Timothy Kukulski on 10/30/12.
// Copyright (c) 2012 Adobe. All rights reserved.
//
#include "tclled.h"
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include "UDPSender.h"
#include <stdlib.h>
#include <signal.h>
#include "TCLZoned.hxx"
#include <vector>
#include <list>
#include <string>
#include <algorithm>
#include <iostream>
#include "Options.hxx"
void prepPixels(unsigned int *raw, const tcl_buffer &tcl);
void initTclBuf(const tcl_buffer &tcl);
void interruptHandler(int param);
using namespace std;
int main(int argc, const char * argv[])
{
Options opts(argc, argv);
TCLZoned tcl(opts.buffersize.x, opts.buffersize.y, opts.leds);
tcl.addZones(opts.zones);
tcl.addOmissions(opts.omissions);
UDPListener udp(opts.port);
opts.dump();
uint32_t *udpBuf = tcl.getBuffer()->getBuffer();
size_t bufSize = tcl.getBuffer()->getBufferSize();
// tcl.mapOutBadPixel(4,20);
tcl.testPattern();
tcl.send();
int sent = 0;
while(1) {
size_t amount = udp.listen(udpBuf,bufSize);
if(amount == bufSize) {
tcl.send();
if(sent == 0) {
cout << "received and sent a packet!";
sent++;
}
} else {
cout << "bad buffer size:" << amount << " expected: " << bufSize << endl;
}
}
return 0;
}