mca-pendel/sketches/led-driver/colors.h

27 lines
459 B
C
Raw Normal View History

2018-03-23 00:03:12 +01:00
#ifndef _COLORS_H_
#define _COLORS_H_
#include <stddef.h>
#include <stdint.h>
#define RGB_MAX 128
typedef struct {
uint8_t r;
uint8_t g;
uint8_t b;
} rgb_t;
typedef struct {
uint16_t hue;
uint8_t sat;
uint8_t val;
} hsv_t;
hsv_t makeHSV(uint16_t hue, uint8_t sat, uint8_t val);
rgb_t hsv2rgb(hsv_t* hsv);
void hsv2rgbList(hsv_t* hsv, rgb_t* rgb, size_t count);
void interpolateLinearly(hsv_t start, hsv_t end, size_t steps, hsv_t *colors);
#endif