/* * animations.c * * Copyright 2011 Thomas Buck * Copyright 2011 Max Nuding * Copyright 2011 Felix Bäder * * This file is part of LED-Cube. * * LED-Cube is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * LED-Cube is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LED-Cube. If not, see . */ #include #include #include #include #include // Prototypes for all animations void simpleAnimation(void); void anotherAnimation(void); // Array of animation functions #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](); // Call animation } } void simpleAnimation(void) { // Call this at least every 500ms wdt_reset(); // Else it will reset the cpu } void anotherAnimation(void) { }