Some small performance improvements from Thomas Kopp.

This commit is contained in:
Aaron Mueller 2014-06-22 21:06:06 +02:00
parent 119e9889c9
commit 5fe28a0205

View file

@ -38,7 +38,7 @@ void init()
PORTD = 0b01000000; PORTD = 0b01000000;
// Setup Timer-Interrupt "TIMER1" compare match interrupt // Setup Timer-Interrupt "TIMER1" compare match interrupt
TIMSK |= (1 << OCIE1A); TIMSK = (1 << OCIE1A);
// Refreshrate is 100Hz of the whole LEDCube. // Refreshrate is 100Hz of the whole LEDCube.
// The ISR comes up at 300Hz. // The ISR comes up at 300Hz.
@ -48,7 +48,7 @@ void init()
OCR1AL = 0b01110001; OCR1AL = 0b01110001;
// Set prescale to 64 and clear the counter on compare match. // Set prescale to 64 and clear the counter on compare match.
TCCR1B |= (1 << CS11) | (1 << CS10) | (1 << WGM12); TCCR1B = (1 << CS11) | (1 << CS10) | (1 << WGM12);
sei(); // Enable interrupts global sei(); // Enable interrupts global
} }
@ -57,7 +57,6 @@ void init()
*/ */
ISR (TIMER1_COMPA_vect) ISR (TIMER1_COMPA_vect)
{ {
if (!(--delay)) // decrease the counter and check if we are done with waiting if (!(--delay)) // decrease the counter and check if we are done with waiting
{ {
if (frmnum == MAX_EEPROM_FRAMES) if (frmnum == MAX_EEPROM_FRAMES)
@ -82,6 +81,7 @@ ISR (TIMER1_COMPA_vect)
} }
// !!!Don't touch the 6th bit (9th LED wire)!!! // !!!Don't touch the 6th bit (9th LED wire)!!!
// PORTD = __, 9, C, B, A, D+, D-, __
PORTD &= 0b11000111; // delete bit 3 to 6 (bit 3 to 5 = layer 0 to 2 PORTD &= 0b11000111; // delete bit 3 to 6 (bit 3 to 5 = layer 0 to 2
uint8_t tmp = level * 9; // calculate the position in the frame uint8_t tmp = level * 9; // calculate the position in the frame