microscope-ring-light-remot.../include/animation.h

54 lines
899 B
C

#ifndef _ANIMATION_H_
#define _ANIMATION_H_
#include <stdint.h>
enum animation_state {
ANI_RED,
ANI_GREEN,
ANI_BLUE,
ANI_RAINBOW,
ANI_FLASH_WHITE,
};
struct rgbw_color {
uint8_t red;
uint8_t green;
uint8_t blue;
uint8_t white;
};
enum rainbow_state {
RAINBOW_RY,
RAINBOW_YG,
RAINBOW_GC,
RAINBOW_CB,
RAINBOW_BM,
RAINBOW_MR,
};
struct animation {
enum animation_state state;
enum rainbow_state rb_start_state;
struct rgbw_color rb_start_color;
uint32_t step;
uint32_t last_tick;
uint32_t next_interval;
};
/**
* @brief Reset aniamtion to start conditions
*
* @param ani Animation
*/
void animation_reset(struct animation *ani);
/**
* @brief Poll animation
*
* @param ani Animation
* @param dmx_universe Target universe to play animation into. Must be big enough
*/
void animation_process(struct animation *ani, uint8_t *dmx_universe);
#endif /* _ANIMATION_H_ */