|
|
|
@ -46,6 +46,26 @@ extern void busy_wait(unsigned int ms); // Worx! |
|
|
|
|
#define MAXLEDS 27 // 1..256 MUST match h/w!
|
|
|
|
|
static int32_t arLEDBuffer[MAXTABLES][MAXLEDS]; // GRB values
|
|
|
|
|
|
|
|
|
|
extern char kbhit(void); |
|
|
|
|
extern int key_eval(void); |
|
|
|
|
|
|
|
|
|
static int iDelay = 100; // 100ms by default
|
|
|
|
|
|
|
|
|
|
int key_eval(void) |
|
|
|
|
{ |
|
|
|
|
switch(kbhit()) { |
|
|
|
|
case 'w': if(iDelay < 200) |
|
|
|
|
iDelay += 10;
|
|
|
|
|
break; |
|
|
|
|
case 's': if(iDelay > 20)
|
|
|
|
|
iDelay -= 10;
|
|
|
|
|
break; |
|
|
|
|
case 'x': return 1; // Abort indication
|
|
|
|
|
default: ; |
|
|
|
|
} |
|
|
|
|
return(0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void enable_LEDS(int iEnable) |
|
|
|
|
{ |
|
|
|
|
npe_b8Len_write(MAXLEDS); // Prepare length
|
|
|
|
@ -79,7 +99,7 @@ void load_triple_LEDs(int iTable, int32_t green, int32_t red, int32_t blue) |
|
|
|
|
}
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void illumination(void) |
|
|
|
|
int illumination(void) |
|
|
|
|
{
|
|
|
|
|
int32_t green = 0x040000; |
|
|
|
|
int32_t red = 0x000400; |
|
|
|
@ -107,7 +127,8 @@ void illumination(void) |
|
|
|
|
for(iTable=0;iTable<MAXTABLES;iTable++) |
|
|
|
|
load_triple_LEDs(iTable, green, red, blue); |
|
|
|
|
send_LEDs(); |
|
|
|
|
busy_wait(80); // Slow down a bit
|
|
|
|
|
busy_wait(iDelay); // Slow down a bit
|
|
|
|
|
if(key_eval()) return 1; |
|
|
|
|
} |
|
|
|
|
// Make 3 run along ...
|
|
|
|
|
green = 0x404000; |
|
|
|
@ -122,22 +143,24 @@ void illumination(void) |
|
|
|
|
int max_LED = MAXLEDS-1; // 0..26
|
|
|
|
|
for(int i=0;i<MAXLEDS-3;i++) { // Forward shift 3
|
|
|
|
|
send_LEDs(); |
|
|
|
|
busy_wait(100); |
|
|
|
|
busy_wait(iDelay); |
|
|
|
|
for(iTable=0;iTable<MAXTABLES;iTable++) { |
|
|
|
|
for(int j=0;j<max_LED;j++) |
|
|
|
|
arLEDBuffer[iTable][max_LED - j] = arLEDBuffer[iTable][(max_LED - 1) - j]; |
|
|
|
|
arLEDBuffer[iTable][i] = 0; |
|
|
|
|
} |
|
|
|
|
if(key_eval()) return 1; |
|
|
|
|
} |
|
|
|
|
printf("Halfway thru ...\n"); |
|
|
|
|
for(int i=0;i<MAXLEDS-1;i++) { // Backward shift 3
|
|
|
|
|
send_LEDs(); |
|
|
|
|
busy_wait(100); |
|
|
|
|
busy_wait(iDelay); |
|
|
|
|
for(iTable=0;iTable<MAXTABLES;iTable++) { |
|
|
|
|
for(int j=0;j<max_LED;j++) |
|
|
|
|
arLEDBuffer[iTable][j] = arLEDBuffer[iTable][j+1]; |
|
|
|
|
arLEDBuffer[iTable][max_LED-i] = 0; |
|
|
|
|
} |
|
|
|
|
if(key_eval()) return 1; |
|
|
|
|
} |
|
|
|
|
busy_wait(400); |
|
|
|
|
|
|
|
|
@ -148,5 +171,6 @@ void illumination(void) |
|
|
|
|
busy_wait(500); |
|
|
|
|
enable_LEDS(0); |
|
|
|
|
printf("Finished!\n"); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|