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

54 lines
899 B
C
Raw Permalink Normal View History

2022-10-22 00:16:33 +02:00
#ifndef _ANIMATION_H_
#define _ANIMATION_H_
#include <stdint.h>
enum animation_state {
ANI_RED,
ANI_GREEN,
ANI_BLUE,
ANI_RAINBOW,
ANI_FLASH_WHITE,
};
2022-10-23 17:27:18 +02:00
struct rgbw_color {
2022-10-22 11:57:36 +02:00
uint8_t red;
uint8_t green;
uint8_t blue;
2022-10-23 17:27:18 +02:00
uint8_t white;
2022-10-22 11:57:36 +02:00
};
enum rainbow_state {
RAINBOW_RY,
RAINBOW_YG,
RAINBOW_GC,
RAINBOW_CB,
RAINBOW_BM,
RAINBOW_MR,
};
2022-10-22 00:16:33 +02:00
struct animation {
enum animation_state state;
2022-10-22 11:57:36 +02:00
enum rainbow_state rb_start_state;
2022-10-23 17:27:18 +02:00
struct rgbw_color rb_start_color;
2022-10-22 00:16:33 +02:00
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_ */