Add the remaining six lights
This commit is contained in:
parent
7e16faefae
commit
bdbb13f67f
|
@ -46,7 +46,7 @@
|
||||||
mkProgram = { pkgs, gcc, cflags, pname, psrc, pbuildInputs ? [], avr ? false }:
|
mkProgram = { pkgs, gcc, cflags, pname, psrc, pbuildInputs ? [], avr ? false }:
|
||||||
let
|
let
|
||||||
AVR = if avr == true then "1" else "";
|
AVR = if avr == true then "1" else "";
|
||||||
in pkgs.stdenv.mkDerivation rec {
|
in pkgs.stdenv.mkDerivation rec {
|
||||||
name = pname;
|
name = pname;
|
||||||
src = psrc;
|
src = psrc;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ uint8_t random_step(uint8_t value, uint8_t min, uint8_t max) {
|
||||||
|
|
||||||
animation_t animation_new(void) {
|
animation_t animation_new(void) {
|
||||||
return (animation_t) {
|
return (animation_t) {
|
||||||
.color = { .brightness = 1, .r = 0, .g = 0, .b = 0 },
|
.color = { .brightness = 7, .r = 0, .g = 0, .b = 0 },
|
||||||
.red_line = time_line_new(0, 0, 0, 0),
|
.red_line = time_line_new(0, 0, 0, 0),
|
||||||
.green_line = time_line_new(0, 0, 0, 0),
|
.green_line = time_line_new(0, 0, 0, 0),
|
||||||
.blue_line = time_line_new(0, 0, 0, 0),
|
.blue_line = time_line_new(0, 0, 0, 0),
|
||||||
|
@ -76,6 +76,12 @@ lantern_t lantern_new(sk9822_t lights) {
|
||||||
animation_new(),
|
animation_new(),
|
||||||
animation_new(),
|
animation_new(),
|
||||||
animation_new(),
|
animation_new(),
|
||||||
|
animation_new(),
|
||||||
|
animation_new(),
|
||||||
|
animation_new(),
|
||||||
|
animation_new(),
|
||||||
|
animation_new(),
|
||||||
|
animation_new(),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -89,6 +95,18 @@ void lantern_start_normal(lantern_t *self, int light_idx) {
|
||||||
random_step(self->animations[0].color.g, 20, 50),
|
random_step(self->animations[0].color.g, 20, 50),
|
||||||
0,
|
0,
|
||||||
5);
|
5);
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[3],
|
||||||
|
random_step(self->animations[3].color.r, 180, 255),
|
||||||
|
random_step(self->animations[3].color.g, 20, 50),
|
||||||
|
0,
|
||||||
|
5);
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[6],
|
||||||
|
random_step(self->animations[3].color.r, 180, 255),
|
||||||
|
random_step(self->animations[3].color.g, 20, 50),
|
||||||
|
0,
|
||||||
|
5);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
animation_begin(
|
animation_begin(
|
||||||
|
@ -97,6 +115,18 @@ void lantern_start_normal(lantern_t *self, int light_idx) {
|
||||||
random_step(self->animations[1].color.g, 10, 30),
|
random_step(self->animations[1].color.g, 10, 30),
|
||||||
0,
|
0,
|
||||||
15);
|
15);
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[4],
|
||||||
|
random_step(self->animations[4].color.r, 160, 230),
|
||||||
|
random_step(self->animations[4].color.g, 10, 30),
|
||||||
|
0,
|
||||||
|
15);
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[7],
|
||||||
|
random_step(self->animations[7].color.r, 160, 230),
|
||||||
|
random_step(self->animations[7].color.g, 10, 30),
|
||||||
|
0,
|
||||||
|
15);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
animation_begin(
|
animation_begin(
|
||||||
|
@ -105,6 +135,18 @@ void lantern_start_normal(lantern_t *self, int light_idx) {
|
||||||
random_step(self->animations[2].color.g, 0, 10),
|
random_step(self->animations[2].color.g, 0, 10),
|
||||||
0,
|
0,
|
||||||
30);
|
30);
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[5],
|
||||||
|
random_step(self->animations[5].color.r, 140, 170),
|
||||||
|
random_step(self->animations[5].color.g, 0, 10),
|
||||||
|
0,
|
||||||
|
30);
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[8],
|
||||||
|
random_step(self->animations[8].color.r, 140, 170),
|
||||||
|
random_step(self->animations[8].color.g, 0, 10),
|
||||||
|
0,
|
||||||
|
30);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,6 +160,18 @@ void lantern_start_spooky(lantern_t *self, int light_idx) {
|
||||||
random_step(self->animations[0].color.g, 80, 120),
|
random_step(self->animations[0].color.g, 80, 120),
|
||||||
0,
|
0,
|
||||||
15);
|
15);
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[3],
|
||||||
|
0,
|
||||||
|
random_step(self->animations[3].color.g, 80, 120),
|
||||||
|
0,
|
||||||
|
15);
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[6],
|
||||||
|
0,
|
||||||
|
random_step(self->animations[6].color.g, 80, 120),
|
||||||
|
0,
|
||||||
|
15);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
animation_begin(
|
animation_begin(
|
||||||
|
@ -126,6 +180,18 @@ void lantern_start_spooky(lantern_t *self, int light_idx) {
|
||||||
random_step(self->animations[1].color.g, 60, 100),
|
random_step(self->animations[1].color.g, 60, 100),
|
||||||
0,
|
0,
|
||||||
15);
|
15);
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[4],
|
||||||
|
0,
|
||||||
|
random_step(self->animations[4].color.g, 60, 100),
|
||||||
|
0,
|
||||||
|
15);
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[7],
|
||||||
|
0,
|
||||||
|
random_step(self->animations[7].color.g, 60, 100),
|
||||||
|
0,
|
||||||
|
15);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
animation_begin(
|
animation_begin(
|
||||||
|
@ -134,6 +200,18 @@ void lantern_start_spooky(lantern_t *self, int light_idx) {
|
||||||
random_step(self->animations[2].color.g, 20, 40),
|
random_step(self->animations[2].color.g, 20, 40),
|
||||||
0,
|
0,
|
||||||
15);
|
15);
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[5],
|
||||||
|
0,
|
||||||
|
random_step(self->animations[5].color.g, 20, 40),
|
||||||
|
0,
|
||||||
|
15);
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[8],
|
||||||
|
0,
|
||||||
|
random_step(self->animations[8].color.g, 20, 40),
|
||||||
|
0,
|
||||||
|
15);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,25 +221,61 @@ void lantern_start_eerie(lantern_t *self, int light_idx) {
|
||||||
case 0:
|
case 0:
|
||||||
animation_begin(
|
animation_begin(
|
||||||
&self->animations[0],
|
&self->animations[0],
|
||||||
|
random_step(self->animations[0].color.r, 20, 40),
|
||||||
random_step(self->animations[0].color.g, 20, 40),
|
random_step(self->animations[0].color.g, 20, 40),
|
||||||
random_step(self->animations[0].color.g, 20, 40),
|
random_step(self->animations[0].color.b, 80, 120),
|
||||||
random_step(self->animations[0].color.g, 80, 120),
|
15);
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[3],
|
||||||
|
random_step(self->animations[3].color.r, 20, 40),
|
||||||
|
random_step(self->animations[3].color.g, 20, 40),
|
||||||
|
random_step(self->animations[3].color.b, 80, 120),
|
||||||
|
15);
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[6],
|
||||||
|
random_step(self->animations[6].color.r, 20, 40),
|
||||||
|
random_step(self->animations[6].color.g, 20, 40),
|
||||||
|
random_step(self->animations[6].color.b, 80, 120),
|
||||||
15);
|
15);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
animation_begin(
|
animation_begin(
|
||||||
&self->animations[1],
|
&self->animations[1],
|
||||||
random_step(self->animations[0].color.g, 0, 30),
|
random_step(self->animations[1].color.r, 0, 30),
|
||||||
random_step(self->animations[0].color.g, 0, 30),
|
random_step(self->animations[1].color.g, 0, 30),
|
||||||
random_step(self->animations[1].color.g, 60, 100),
|
random_step(self->animations[1].color.b, 60, 100),
|
||||||
|
30);
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[4],
|
||||||
|
random_step(self->animations[4].color.r, 0, 30),
|
||||||
|
random_step(self->animations[4].color.g, 0, 30),
|
||||||
|
random_step(self->animations[4].color.b, 60, 100),
|
||||||
|
30);
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[7],
|
||||||
|
random_step(self->animations[7].color.r, 0, 30),
|
||||||
|
random_step(self->animations[7].color.g, 0, 30),
|
||||||
|
random_step(self->animations[7].color.b, 60, 100),
|
||||||
30);
|
30);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
animation_begin(
|
animation_begin(
|
||||||
&self->animations[2],
|
&self->animations[2],
|
||||||
random_step(self->animations[0].color.g, 0, 10),
|
random_step(self->animations[2].color.r, 0, 10),
|
||||||
random_step(self->animations[0].color.g, 0, 10),
|
random_step(self->animations[2].color.g, 0, 10),
|
||||||
random_step(self->animations[2].color.g, 20, 40),
|
random_step(self->animations[2].color.b, 20, 40),
|
||||||
|
45);
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[5],
|
||||||
|
random_step(self->animations[5].color.r, 0, 10),
|
||||||
|
random_step(self->animations[5].color.g, 0, 10),
|
||||||
|
random_step(self->animations[5].color.b, 20, 40),
|
||||||
|
45);
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[8],
|
||||||
|
random_step(self->animations[8].color.r, 0, 10),
|
||||||
|
random_step(self->animations[8].color.g, 0, 10),
|
||||||
|
random_step(self->animations[8].color.b, 20, 40),
|
||||||
45);
|
45);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with thi
|
||||||
#ifndef __LANTERN_H__
|
#ifndef __LANTERN_H__
|
||||||
#define __LANTERN_H__
|
#define __LANTERN_H__
|
||||||
|
|
||||||
#define LIGHT_COUNT 3
|
#define LIGHT_COUNT 9
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
rgb_t color;
|
rgb_t color;
|
||||||
|
|
|
@ -74,6 +74,8 @@ int main(void) {
|
||||||
};
|
};
|
||||||
|
|
||||||
display_init(&display);
|
display_init(&display);
|
||||||
|
display_write_message(&display, "ready");
|
||||||
|
_delay_ms(1000);
|
||||||
|
|
||||||
dio_t buttons[4] = {
|
dio_t buttons[4] = {
|
||||||
{ .ddr = &DDRB, .port = &PORTB, .pin = &PINB, .addr = 5 },
|
{ .ddr = &DDRB, .port = &PORTB, .pin = &PINB, .addr = 5 },
|
||||||
|
|
Loading…
Reference in New Issue