I won't go into great detail on the render_7segment() function, except to
describe in broad terms how it works.
Here's the prototype for render_7segment():
void
render_7segment (char *digits,
unsigned char *r,
int xsize,
int ysize);
The parameters are:
- digits
- This is the ASCII string to render into the raw bitmap.
Currently, the render_7seg() function understands the numbers 0 through 9, a blank, and
the digits A through F (upper and lower case).
- r
- This is the raw graphics bitmap, allocated by the caller.
It is stored as one byte per pixel, left to right, top to bottom
(i.e., r [7] is X-coordinate 7, Y-coordinate 0).
- xsize, ysize
- This defines the size of the graphical bitmap.
To write to an arbitrary (X, Y) location, add the X value
to the product of the Y value and the xsize parameter.
As an exercise for the reader, you can extend the character set accepted by the
render_7segment() function.
You'll want to pay particular attention to the seg7 array, because it
contains the individual segment encodings for each character.