blob: 373562a175667775de03d981be6a9c411d31ac79 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include "byte_math.h"
#include "pattern.h"
static rgb_t get_rgb(uint32_t time, size_t x)
{
int r = 0, g = 0, b = 0;
uint8_t time8 = time & 0xff;
int w = 0 ; // calc_w(time8 + x * 10);
r = 0xff;
g = byte_scale(byte_sin(time8 + x * 2), 0x60);
b = 0;
rgb_t color;
color.color = 0;
color.r = clip(r + w);
color.g = clip(byte_scale(g, AS_BYTE(0.75)) + w);
color.b = clip(byte_scale(b, AS_BYTE(0.75)) + w);
return color;
}
static void reset(void)
{
}
__attribute__((__section__(".patterns"))) volatile static pattern_t pat =
((pattern_t){.get_rgb = get_rgb, .name = "Hearth", .reset = reset});
|