Update with make-all-the-leds-the-same solo option.

This commit is contained in:
cnlohr 2015-08-08 23:02:39 -04:00
parent 68e7bd6bb6
commit ee756a820d
6 changed files with 61 additions and 5 deletions

View file

@ -235,6 +235,43 @@ void UpdateLinearLEDs()
}
void UpdateAllSameLEDs()
{
int i;
uint8_t freq = 0;
uint16_t amp = 0;
for( i = 0; i < MAXNOTES; i++ )
{
uint16_t ist = note_peak_amps2[i];
uint8_t ifrq = note_peak_freqs[i];
if( ist > amp && ifrq != 255 )
{
freq = ifrq;
amp = ist;
}
}
amp = (((uint32_t)(amp))*NOTE_FINAL_AMP)>>10;
if( amp > 255 ) amp = 255;
uint32_t color = ECCtoHEX( (freq+RootNoteOffset)%NOTERANGE, 255, amp );
for( i = 0; i < USE_NUM_LIN_LEDS; i++ )
{
ledOut[i*3+0] = ( color >> 0 ) & 0xff;
ledOut[i*3+1] = ( color >> 8 ) & 0xff;
ledOut[i*3+2] = ( color >>16 ) & 0xff;
}
}
uint32_t ECCtoHEX( uint8_t note, uint8_t sat, uint8_t val )
{
uint16_t hue = 0;

View file

@ -38,8 +38,13 @@
extern uint8_t ledArray[];
extern uint8_t ledOut[]; //[NUM_LIN_LEDS*3]
extern uint8_t RootNoteOffset; //Set to define what the root note is. 0 = A.
//For doing the nice linear strip LED updates
void UpdateLinearLEDs();
//For making all the LEDs the same and quickest. Good for solo instruments?
void UpdateAllSameLEDs();
uint32_t ECCtoHEX( uint8_t note, uint8_t sat, uint8_t val );
uint32_t EHSVtoHEX( uint8_t hue, uint8_t sat, uint8_t val ); //hue = 0..255 // TODO: TEST ME!!!