123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
-
- #include <stdint.h>
- #include <avr/io.h>
- #include <avr/wdt.h>
-
- #include <buffhelp.h>
- #include <cube.h>
-
-
- void simpleAnimation(void);
- void anotherAnimation(void);
-
-
- #define NUMOFANIMATIONS 2
- void (*animations[NUMOFANIMATIONS])(void) = {&simpleAnimation, &anotherAnimation};
-
- uint8_t numOfAnimations(void) {
- return NUMOFANIMATIONS;
- }
-
- void executeAnimation(uint8_t id) {
- if (id < NUMOFANIMATIONS) {
- animations[id]();
- }
- }
-
- void simpleAnimation(void) {
- uint8_t *buff;
- int8_t x, y, z;
-
- buff = buffNew();
-
-
- for(y = 0; y < 8; y++) {
- for(x = 0; x < 8; x++) {
- for(z = 0; z < 8; z++) {
- buffSetPixel(buff, x, y, z);
- }
- }
-
- setImage(buff);
- while(!isFinished()) {
- wdt_reset();
- }
-
- buffClearAllPixels(buff);
- }
-
-
- for(y = 7; y >= 0; y--) {
- for(x = 0; x < 8; x++) {
- for(z = 0; z < 8; z++) {
- buffSetPixel(buff, x, y, z);
- }
- }
-
- setImage(buff);
- while(!isFinished()) {
- wdt_reset();
- }
-
- buffClearAllPixels(buff);
- }
-
-
- for(x = 0; x < 8; x++) {
- for(y = 0; y < 8; y++) {
- for(z = 0; z < 8; z++) {
- buffSetPixel(buff, x, y, z);
- }
- }
-
- setImage(buff);
- while(!isFinished()) {
- wdt_reset();
- }
-
- buffClearAllPixels(buff);
- }
-
- for(x = 7; x >= 0; x--) {
- for(y = 0; y < 8; y++) {
- for(z = 0; z < 8; z++) {
- buffSetPixel(buff, x, y, z);
- }
- }
-
- setImage(buff);
- while(!isFinished()) {
- wdt_reset();
- }
-
- ClearAllPixels(buff)
- }
-
-
- for(z = 0; z < 8; z++) {
- for(y = 0; y < 8; y++) {
- for(x = 0; x < 8; x++) {
- buffSetPixel(buff, x, y, z);
- }
- }
-
- setImage(buff);
- while(!isFinished()) {
- wdt_reset();
- }
-
- buffClearAllPixels(buff);
- }
-
- for(z = 7; z >= 0; z--) {
- for(x = 0; x < 8; x++) {
- for(y = 0; y < 8; y++) {
- buffSetPixel(buff, x, y, z);
- }
- }
-
- setImage(buff);
- while(!isFinished()) {
- wdt_reset();
- }
-
- ClearAllPixels(buff)
- }
-
- }
-
- void anotherAnimation(void) {
-
- }
|