avr/lantern/lantern.h

56 lines
1.4 KiB
C

/*
Copyright 2022, Savanni D'Gerinel <savanni@luminescent-dreams.com>
This file is part of Savanni's AVR library.
This AVR library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This AVR library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this AVR library. If not, see <https://www.gnu.org/licenses/>.
*/
#include <animation.h>
#include <display.h>
#include <sk9822.h>
#ifndef __LANTERN_H__
#define __LANTERN_H__
#define LIGHT_COUNT 9
typedef struct {
rgb_t color;
time_line_t red_line;
time_line_t green_line;
time_line_t blue_line;
uint8_t frame;
uint8_t duration;
} animation_t;
typedef enum {
cse_off,
cse_normal,
cse_spooky,
cse_eerie,
cse_flash
} color_scheme_e;
typedef struct {
sk9822_t lights;
color_scheme_e color_scheme;
animation_t animations[LIGHT_COUNT];
} lantern_t;
lantern_t lantern_new(sk9822_t);
void lantern_set_mode(lantern_t *, color_scheme_e);
void lantern_step(lantern_t *, rgb_t *);
void lantern_show(lantern_t *, display_t *);
#endif