avr/animation/animation.h

37 lines
874 B
C

#ifndef __ANIMATION_H__
#define __ANIMATION_H__
#ifdef __AVR__
#include <avr/io.h>
#else
typedef int uint8_t;
#endif
// line_t provides a simplified implementation of Bresenham's line drawing
// technique. At this time, it assumes a transition of x = 0 -> 60, and a dy
// between -59 and 59. I am not sure I understand Bresenham's algorithm yet,
// but I'll need to revisit all of this if I want to expand the boundaries.
typedef struct {
int y;
int de;
int error;
int inc;
int dt;
int dy;
int y0;
int y1;
} time_line_t;
// Construct a new line object. x1 must be greater than x0, and dy must be less than dx.
time_line_t time_line_new(int, int, int, int);
// Calculate the next y value of the line.
int time_line_next(time_line_t *);
// Diagnostic printout of the current state of line_t.
void time_line_print(time_line_t *);
#endif