adopted to longer LED strip

This commit is contained in:
Mario Hüttel 2018-04-13 21:14:18 +02:00
parent 69d26c3a46
commit 9558851e8b
2 changed files with 24 additions and 235 deletions

255
c/prog.c
View File

@ -24,7 +24,8 @@
#define MY_DEST_MAC5 0x00 #define MY_DEST_MAC5 0x00
#define DEFAULT_IF "enp5s0" #define DEFAULT_IF "enp5s0"
#define BUF_SIZ 1024 #define BUF_SIZ 1500
#define LED_CNT 360
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
@ -84,240 +85,28 @@ int main(int argc, char *argv[])
/* Packet data */ /* Packet data */
if (mode == 0) { if (mode == 0) {
for (i = 0; i < LED_CNT; i++) {
switch (i%3) {
case 0:
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
break;
case 1:
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff; sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00; sendbuf[tx_len++] = 0x00;
break;
case 2:
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00; sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
break;
}
}
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0x00;
sendbuf[tx_len++] = 0xff;
} else if (mode > 0 && mode < 4) { } else if (mode > 0 && mode < 4) {
for (i = 0; i< 60; i++) { for (i = 0; i< LED_CNT; i++) {
switch (mode) { switch (mode) {
case 1: case 1:
sendbuf[tx_len++] = 0xff; sendbuf[tx_len++] = 0xff;
@ -337,13 +126,13 @@ int main(int argc, char *argv[])
} }
} }
} else if (mode == 4) { } else if (mode == 4) {
for (i = 0; i< 3*60; i++) { for (i = 0; i< 3*LED_CNT; i++) {
sendbuf[tx_len++] = 0x00; sendbuf[tx_len++] = 0x00;
} }
} else if (mode == 5) { } else if (mode == 5) {
for (i = 0; i< 3*60; i++) { for (i = 0; i< 3*LED_CNT; i++) {
sendbuf[tx_len++] = 0xff; sendbuf[tx_len++] = 0xff;
} }
} else if (mode == 6) { } else if (mode == 6) {
@ -351,7 +140,7 @@ sendbuf[tx_len++] = 0xff;
r = (unsigned char) atoi(argv[2]); r = (unsigned char) atoi(argv[2]);
g = (unsigned char) atoi(argv[3]); g = (unsigned char) atoi(argv[3]);
b = (unsigned char) atoi(argv[4]); b = (unsigned char) atoi(argv[4]);
for (i = 0; i< 60; i++) { for (i = 0; i< LED_CNT; i++) {
sendbuf[tx_len++] = r; sendbuf[tx_len++] = r;
sendbuf[tx_len++] = g; sendbuf[tx_len++] = g;
sendbuf[tx_len++] = b; sendbuf[tx_len++] = b;

View File

@ -6,7 +6,7 @@
-- Author : Mario Hüttel <mario.huettel@gmx.net> -- Author : Mario Hüttel <mario.huettel@gmx.net>
-- Company : -- Company :
-- Created : 2018-04-05 -- Created : 2018-04-05
-- Last update: 2018-04-07 -- Last update: 2018-04-13
-- Platform : -- Platform :
-- Standard : VHDL'93/02 -- Standard : VHDL'93/02
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -146,7 +146,7 @@ begin -- architecture RTL
STD_FIFO_1 : entity work.STD_FIFO STD_FIFO_1 : entity work.STD_FIFO
generic map ( generic map (
DATA_WIDTH => 8, DATA_WIDTH => 8,
FIFO_DEPTH => 256) FIFO_DEPTH => 360*3)
port map ( port map (
CLK => clk, CLK => clk,
RST => fifo_rst, RST => fifo_rst,