|
|
@ -44,8 +44,12 @@ |
|
|
|
#include "../include/illumination.h" |
|
|
|
|
|
|
|
extern void busy_wait(unsigned int ms); // Worx! |
|
|
|
#define MAXTABLES 2 // 0..63 MUST match h/w! |
|
|
|
#define MAXLEDS 32 //27 // 1..256 MUST match h/w! |
|
|
|
|
|
|
|
// Considering timing: 2x 511 (1022 LEDs) or 63x 24 (1512 LEDs) superfast |
|
|
|
// 3x 511 (1533 LEDs) or 63x 48 (3024 LEDs) fast enough |
|
|
|
// 4x 511 (2044 LEDs) or 63x 64 (4032 LEDs) slow (slower than CPU mem. modification, s.b.) |
|
|
|
#define MAXTABLES 6 // 1..64 MUST match h/w! Use Power of 2! |
|
|
|
#define MAXLEDS 144 // 1..512 MUST match h/w! Use Power of 2! |
|
|
|
static int32_t arLEDBuffer[MAXTABLES][MAXLEDS] __attribute__((aligned(16)));; // GRB values |
|
|
|
|
|
|
|
extern char kbhit(void); |
|
|
@ -74,10 +78,10 @@ void enable_LEDS(int iEnable) |
|
|
|
static uint32_t uiLoopCount = 0; |
|
|
|
|
|
|
|
if(iEnable) { |
|
|
|
npe_b6NoOfTables_write(MAXTABLES); // Prepare # of tables |
|
|
|
npe_b9Len_write(MAXLEDS); // Prepare length |
|
|
|
npe_b6NoOfTables_write(MAXTABLES > 63? 63 : MAXTABLES ); // Prepare # of tables (0..63) |
|
|
|
npe_b9Len_write(MAXLEDS > 511? 511 : MAXLEDS); // Prepare length (0..511) |
|
|
|
for(int j=0;j<MAXTABLES;j++) { |
|
|
|
printf("DRAM->[%d] = %08Xh\n", j, (uint32_t)&arLEDBuffer[j]); |
|
|
|
//printf("DRAM->[%d] = %08Xh\n", j, (uint32_t)&arLEDBuffer[j]); |
|
|
|
npe_b6StoreOffset_write(j); // Indicate which entry to use for address storage |
|
|
|
npe_b32DRAMAddress_write((uint32_t)&arLEDBuffer[j]); // Base address of LED buffer |
|
|
|
} |
|
|
@ -131,7 +135,7 @@ int illumination(void) |
|
|
|
busy_wait(2000); |
|
|
|
|
|
|
|
// Let them flicker ... |
|
|
|
for(int i=0;i<MAXLEDS;i++) { |
|
|
|
for(int i=0;i<100;i++) { |
|
|
|
int32_t temp = green; |
|
|
|
green = red; |
|
|
|
red = blue; |
|
|
@ -161,7 +165,7 @@ int illumination(void) |
|
|
|
arLEDBuffer[iTable][1] = red; |
|
|
|
arLEDBuffer[iTable][2] = blue; |
|
|
|
} |
|
|
|
int max_LED = MAXLEDS-1; // 0..26 |
|
|
|
int max_LED = MAXLEDS-1; // 1..512 |
|
|
|
for(int i=0;i<MAXLEDS-3;i++) { // Forward shift 3 |
|
|
|
flush_l2_cache(); // Strictly nec. for longer transfers |
|
|
|
busy_wait(iDelay); |
|
|
|