Skip to content

Commit dabcc75

Browse files
committed
added test generator
1 parent a01b7b9 commit dabcc75

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ fifo LED protocol as part of arcan >= 0.5.2.
1111
i2c connection in order to control PWM adafruit
1212
neopixel- LEDs.
1313

14+
testgen - simple stress-test to randomly flash lights,
15+
make and run like ./test | g810-led --aled -
16+
1417
# Setup/Use
1518

1619
fifos can be configured via:
@@ -19,7 +22,7 @@ fifos can be configured via:
1922
mkfifo /path/to/fifo2
2023

2124
and so on.
22-
25+
2326
to tell arcan about the presence of the LED devices (scanned on startup):
2427

2528
arcan_db add_appl_kv arcan ext_led /path/to/fifo

testgen/Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
test: test.c
2+
gcc -o test test.c

testgen/test.c

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <stdlib.h>
2+
#include <stdio.h>
3+
#include <unistd.h>
4+
5+
int main(int argc, char* argv[])
6+
{
7+
char rgb[3] = {'r', 'g', 'b'};
8+
int i;
9+
10+
while(1){
11+
/* reset all, buffer/apply immediately randomly */
12+
putchar('A'); putchar(0x00); putchar('i');
13+
putchar(0x00); putchar('c'); putchar(rand() % 2);
14+
15+
/* set one random channel to one random value */
16+
for (i=0;i<127;i++){
17+
putchar('a'); putchar(i); putchar(rgb[rand() % 3]);
18+
putchar(rand() % 255); putchar('c'); putchar(rand() % 2);
19+
}
20+
fflush(stdout);
21+
// sleep(1);
22+
}
23+
return EXIT_SUCCESS;
24+
}

0 commit comments

Comments
 (0)