28 lines
818 B
C
28 lines
818 B
C
#ifndef __ANIMATION_H__
|
|
#define __ANIMATION_H__
|
|
|
|
#include <avr/io.h>
|
|
|
|
// 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 line_s {
|
|
uint8_t y;
|
|
int8_t m;
|
|
int8_t error;
|
|
int8_t inc;
|
|
uint8_t dx;
|
|
} line_t;
|
|
|
|
// Construct a new line object. x1 must be greater than x0, and dy must be less than dx.
|
|
line_t line_new(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1);
|
|
|
|
// Calculate the next y value of the line.
|
|
uint8_t line_next(line_t *line);
|
|
|
|
// Diagnostic printout of the current state of line_t.
|
|
// void line_print(line_t *line);
|
|
|
|
#endif
|