mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
Add Color classes for use with AddressableLED (#2127)
Both floating point and 8-bit integer classes are included, as well as a wide selection of color constants. Co-authored-by: Austin Shalit <austinshalit@gmail.com>
This commit is contained in:
committed by
Peter Johnson
parent
96348e835a
commit
e874ba9313
@@ -15,6 +15,8 @@
|
||||
#include <wpi/ArrayRef.h>
|
||||
|
||||
#include "frc/ErrorBase.h"
|
||||
#include "util/Color.h"
|
||||
#include "util/Color8Bit.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
@@ -54,6 +56,28 @@ class AddressableLED : public ErrorBase {
|
||||
* @param v the v value [0-255]
|
||||
*/
|
||||
void SetHSV(int h, int s, int v);
|
||||
|
||||
/*
|
||||
* Sets a specific LED in the buffer.
|
||||
*
|
||||
* @param color The color of the LED
|
||||
*/
|
||||
void SetLED(const Color& color) {
|
||||
this->r = color.red * 255;
|
||||
this->g = color.green * 255;
|
||||
this->b = color.blue * 255;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets a specific LED in the buffer.
|
||||
*
|
||||
* @param color The color of the LED
|
||||
*/
|
||||
void SetLED(const Color8Bit& color) {
|
||||
this->r = color.red;
|
||||
this->g = color.green;
|
||||
this->b = color.blue;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user