Ja drew, so war das gemeint. Folgender Code ist ungetestet, compiliert bei mir aber schon Mal:
Später kann über animations zur Laufzeit fast wie auf ein Array zugegriffen werden, dieser Code legt die eigentlichen Bitmuster bereits im Flash ab.Code:#include <avr/io.h> #include <avr/pgmspace.h> #include <stdint.h> typedef uint16_t Frame_t[9]; typedef struct { uint8_t frameCount; Frame_t * animation; } AnimationData_t; PROGMEM Frame_t Animation1[2] = { { 1, 2, 3, 4, 5, 6, 7, 8, 9 }, { 11, 12, 13, 14, 15, 16, 17, 18, 19 } }; PROGMEM Frame_t Animation2[1] = { { 21, 22, 23, 24, 25, 26, 27, 28, 29 } }; AnimationData_t animations[2] = { { sizeof(Animation1), Animation1 }, { sizeof(Animation2), Animation2 } }; int main(void) { for (uint8_t i = 0; i < sizeof(animations); i++) { for (uint8_t j = 0; j < animations[i].frameCount; j++) { Frame_t * frames = animations[i].animation; for (uint8_t k = 0; k < 9; k++) { uint16_t frameWord; frameWord = pgm_read_word(&frames[j][k]); } } } }
mfG
Markus







Zitieren

Lesezeichen