1 /* $Id: ledframing.h,v 1.1 2010/07/10 09:28:52 simimeie Exp $
2 * Functions for led "animations"
10 /* Number of frames to allocate in memory.
11 * Note: One frame takes up 7 bytes of memory (or more if the compiler
12 * chooses a strange alignment)
13 * Must not be >255. */
17 uint16_t duration; /* in ticks */
18 unsigned char action:2;
32 /* Values for 'action' */
33 /* Fade from last to this color */
36 #define ACTION_STROBE 1
37 /* Maximum valid ACTION */
38 #define MAX_ACTION ACTION_STROBE
40 /* Initializes internal structures. */
41 void ledframing_init(void);
43 /* Create a frame from a struct frame. */
44 uint8_t addframe_frame(struct frame fr);
46 /* Create a frame that fades from the last color to this one. duration is
47 * the number of ticks this fading should take.
48 * There is an obvious special case: fading with a duration of 0 will just
49 * switch to that color.
50 * Returns 1 if successful, 0 on error (out of memory) */
51 uint8_t addframe_fade(uint16_t duration, uint8_t red, uint8_t green, uint8_t blue);
53 /* Create a frame where the LEDs are blinking. The color is not changed,
54 * thus stays whatever it was before. onticks and offticks give the number
55 * of ticks that the LEDs are on and off (respectively) in each blink
57 * This can obviously be used to turn off the LEDs for an interval:
58 * onticks = 0, offticks = duration.
59 * Returns 1 if successful, 0 on error (out of memory) */
60 uint8_t addframe_strobe(uint16_t duration, uint16_t onticks, uint16_t offticks);
62 /* Returns the next frame (or NULL if there isn't any left) */
63 struct frame * getnextframe(void);
65 /* Clears the frame buffer */
68 #endif /* _LEDFRAMING_H_ */