libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
color.h
Go to the documentation of this file.
1
/*
2
TODO:
3
- Add Blend(), Scale(), etc.
4
- I'd also like to change the way the Color names are accessed.
5
*/
10
#pragma once
11
#ifndef DSY_COLOR_H
12
#define DSY_COLOR_H
13
#include <stdint.h>
14
15
16
namespace
daisy
17
{
23
class
Color
24
{
25
public
:
26
Color
() {}
27
~Color
() {}
28
30
enum
PresetColor
31
{
32
RED
,
33
GREEN
,
34
BLUE
,
35
WHITE
,
36
PURPLE
,
37
CYAN
,
38
GOLD
,
39
OFF
,
40
LAST
41
};
42
46
void
Init
(
PresetColor
c
);
47
54
void
Init
(
float
red
,
float
green
,
float
blue
);
55
57
inline
float
Red
()
const
{
return
red_; }
58
60
inline
float
Green
()
const
{
return
green_; }
61
63
inline
float
Blue
()
const
{
return
blue_; }
64
65
inline
uint8_t
Red8
()
const
{
return
red_ * 255; }
66
inline
uint8_t
Green8
()
const
{
return
green_ * 255; }
67
inline
uint8_t
Blue8
()
const
{
return
blue_ * 255; }
68
70
Color
operator*
(
float
scale
)
71
{
72
Color
c
;
73
c
.
Init
(red_ *
scale
, green_ *
scale
, blue_ *
scale
);
74
return
c
;
75
}
76
77
private
:
78
static
const
float
standard_colors[
LAST
][3];
79
float
red_, green_, blue_;
80
};
82
}
// namespace daisy
83
84
#endif
daisy::Color
Definition
color.h:24
daisy::Color::Init
void Init(PresetColor c)
daisy::Color::Init
void Init(float red, float green, float blue)
daisy::Color::Color
Color()
Definition
color.h:26
daisy::Color::Green
float Green() const
Definition
color.h:60
daisy::Color::Blue
float Blue() const
Definition
color.h:63
daisy::Color::operator*
Color operator*(float scale)
Definition
color.h:70
daisy::Color::Green8
uint8_t Green8() const
Definition
color.h:66
daisy::Color::Red
float Red() const
Definition
color.h:57
daisy::Color::Blue8
uint8_t Blue8() const
Definition
color.h:67
daisy::Color::~Color
~Color()
Definition
color.h:27
daisy::Color::Red8
uint8_t Red8() const
Definition
color.h:65
daisy::Color::PresetColor
PresetColor
Definition
color.h:31
daisy::Color::GOLD
@ GOLD
Definition
color.h:38
daisy::Color::GREEN
@ GREEN
Definition
color.h:33
daisy::Color::LAST
@ LAST
Definition
color.h:40
daisy::Color::BLUE
@ BLUE
Definition
color.h:34
daisy::Color::OFF
@ OFF
Definition
color.h:39
daisy::Color::WHITE
@ WHITE
Definition
color.h:35
daisy::Color::RED
@ RED
Definition
color.h:32
daisy::Color::CYAN
@ CYAN
Definition
color.h:37
daisy::Color::PURPLE
@ PURPLE
Definition
color.h:36
daisy::LedDriverPca9685
Definition
leddriver.h:33
daisy::LedDriverPca9685::Init
void Init(I2CHandle i2c, const uint8_t(&addresses)[numDrivers], DmaBuffer dma_buffer_a, DmaBuffer dma_buffer_b, dsy_gpio_pin oe_pin={DSY_GPIOX, 0})
Definition
leddriver.h:65
daisy
Hardware defines and helpers for daisy field platform.
Definition
index.h:2
src
util
color.h