Skip to content

Instantly share code, notes, and snippets.

@ohsix
Created July 29, 2020 02:52
Show Gist options
  • Save ohsix/2a2a7e80fd9a9bdf0ceff1ee1f4fe973 to your computer and use it in GitHub Desktop.
Save ohsix/2a2a7e80fd9a9bdf0ceff1ee1f4fe973 to your computer and use it in GitHub Desktop.
typedef struct _segment {
float x0, y0;
float x_step, y_step;
int num_leds;
} led_segment;
typedef struct _element {
int num_segments;
int total_leds;
float width;
float height;
led_segment segments[];
} led_element;
const led_element colon = {
.num_segments = 1,
.total_leds = 2,
.width = 27, /* mm */
.height = 180,
/* x0, y0, step_x, step_y, steps */
{ 18.9, 128.3, -10.8, -76.6, 2 } // led 0 on top
// { 8.1, 51.7, 10.8, 76.6, 2 } // led 0 on bottom
};
const led_element test = {
.num_segments = 1,
.total_leds = 4,
.width = 9.6,
.height = 66.4,
{
{ 23.6, 103.3, 2.4, 16.6, 4 }, /* seg 0, slant */
}
};
const led_element digit = {
.num_segments = 7,
.total_leds = 28,
.width = 119.8,
.height = 180,
{
/*
x0, y0, x_step, y_step, steps (leds)
*/
{ 23.6, 103.3, 2.4, 16.6, 4 }, /* seg 0, slant */
{ 45.8, 166.5, 16.6, 0, 4 }, /* seg 1, horiz */
{ 107.1, 153.3, -2.4, -16.6, 4 }, /* seg 2, slant */
{ 96.4, 76.7, -2.4, -16.6, 4 }, /* seg 3, slant */
{ 74.2, 13.5, -16.6, 0, 4 }, /* seg 4, horiz */
{ 12.9, 26.8, 2.4, 16.6, 4 }, /* seg 5, slant */
{ 35.1, 90, 16.6, 0, 4 } /* seg 6, horiz */
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment