Changes from last meeting.
This commit is contained in:
parent
7cd1ac3d2e
commit
d5941812cc
2 changed files with 22 additions and 34 deletions
|
@ -23,6 +23,9 @@ int main(void)
|
||||||
//wdt_reset(); // we are alive, so don't reset the µC
|
//wdt_reset(); // we are alive, so don't reset the µC
|
||||||
usbPoll(); // keep connected
|
usbPoll(); // keep connected
|
||||||
|
|
||||||
|
// hier pause einfügen
|
||||||
|
_delay_ms(50); // beispielsweise 50 ms => muss angepasst werden an usb kommunikation
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,9 +46,11 @@ void init()
|
||||||
set_bit(TCCR1B, WGM12);
|
set_bit(TCCR1B, WGM12);
|
||||||
|
|
||||||
// Animations-Geschwindigkeit
|
// Animations-Geschwindigkeit
|
||||||
|
// (vergleichswert bei dem der Interrupt ausgelöst wird)
|
||||||
OCR1AH = 0x01;
|
OCR1AH = 0x01;
|
||||||
OCR1AL = 0x00;
|
OCR1AL = 0x00;
|
||||||
|
|
||||||
|
// anpassen auf reihenweise ausgabe
|
||||||
clear_bit(TCCR1B, CS12); // Prescaler 64
|
clear_bit(TCCR1B, CS12); // Prescaler 64
|
||||||
set_bit(TCCR1B, CS11);
|
set_bit(TCCR1B, CS11);
|
||||||
set_bit(TCCR1B, CS10);
|
set_bit(TCCR1B, CS10);
|
||||||
|
@ -54,38 +59,22 @@ void init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interruptvektor von TIMER1
|
// Interruptvektor von TIMER1
|
||||||
SIGNAL(SIG_OUTPUT_COMPARE1A)
|
//SIGNAL(SIG_OUTPUT_COMPARE1A) // alte schreibweise
|
||||||
|
ISR (TIMER1_COMPA_vect)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Pixel multiplexen
|
// Alle Pins von PORTD auf LOW setzen
|
||||||
for (uint8_t z = 0; z < 3; z++)
|
// Höchstes Bit in PORTA auf 0 setzen (Leitung 9 für letzte Reihe)
|
||||||
{
|
|
||||||
for (uint8_t y = 0; y < 3; y++)
|
|
||||||
{
|
|
||||||
for (uint8_t x = 0; x < 3; x++)
|
|
||||||
{
|
|
||||||
uint8_t n = z * 3 + x;
|
|
||||||
|
|
||||||
// LED an
|
// bei cube_row_offset % 3 eine Ebene weiter schalten (ABC-Leitungen durch rotieren)
|
||||||
if (cube[x][y][z] == 1)
|
// bei Systemstart muss A aktiviert sein.
|
||||||
{
|
|
||||||
if (n < 8) clear_bit(PORTB, n); else clear_bit(PORTD, 6);
|
|
||||||
set_bit(PORTD, y + 3);
|
|
||||||
}
|
|
||||||
// ON-Time
|
|
||||||
sleep_nop(PIXEL_TON);
|
|
||||||
|
|
||||||
// LED aus
|
// bits der anzuzeigenden reihe auslesen (cube & (0b00000111 << cube_row_offset))
|
||||||
if (cube[x][y][z] == 1)
|
// und in PORTD und Pin 8 von PORTA setzen
|
||||||
{
|
|
||||||
clear_bit(PORTD, y + 3);
|
// cube_row_offset += 3 // immer um 3 Bits weiter springen in 32Bit Variable
|
||||||
if (n < 8) set_bit(PORTB, n); else set_bit(PORTD, 6);
|
|
||||||
}
|
// cube_row_offset auf 0 setzen wenn maximum überschritten (27-3 = 24)
|
||||||
// OFF-Time
|
|
||||||
sleep_nop(PIXEL_TOFF)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,15 +15,14 @@
|
||||||
|
|
||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
//#include <util/delay.h>
|
#include <util/delay.h>
|
||||||
//#include <avr/pgmspace.h>
|
//#include <avr/pgmspace.h>
|
||||||
//#include <avr/wdt.h>
|
//#include <avr/wdt.h>
|
||||||
|
|
||||||
// Cube-Array
|
// Cube-Data
|
||||||
uint8_t cube[3][3][3];
|
volatile uint32_t cube = 0x00000000;
|
||||||
uint8_t buffer[3][3][3]; // Framebuffer
|
// Bit Offset in Cube-Data
|
||||||
|
volatile uint8_t cube_row_offset = 0x00;
|
||||||
volatile uint8_t frame_done = 0;
|
|
||||||
|
|
||||||
// Prototypen
|
// Prototypen
|
||||||
void init(void);
|
void init(void);
|
||||||
|
|
Loading…
Reference in a new issue