libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
color.h
Go to the documentation of this file.
1/*
2TODO:
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
16namespace daisy
17{
23class Color
24{
25 public:
26 Color() {}
27 ~Color() {}
28
42
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
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
Definition color.h:24
void Init(PresetColor c)
void Init(float red, float green, float blue)
Color()
Definition color.h:26
float Green() const
Definition color.h:60
float Blue() const
Definition color.h:63
Color operator*(float scale)
Definition color.h:70
uint8_t Green8() const
Definition color.h:66
float Red() const
Definition color.h:57
uint8_t Blue8() const
Definition color.h:67
~Color()
Definition color.h:27
uint8_t Red8() const
Definition color.h:65
PresetColor
Definition color.h:31
@ GOLD
Definition color.h:38
@ GREEN
Definition color.h:33
@ LAST
Definition color.h:40
@ BLUE
Definition color.h:34
@ OFF
Definition color.h:39
@ WHITE
Definition color.h:35
@ RED
Definition color.h:32
@ CYAN
Definition color.h:37
@ PURPLE
Definition color.h:36
Definition leddriver.h:33
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
Hardware defines and helpers for daisy field platform.
Definition index.h:2