SPIKE-RT C++ API Reference
Loading...
Searching...
No Matches
Light.h
1//
2// Light.h
3//
4// Copyright (c) 2025 Embedded Technology Software Design Robot Contest
5//
6
7#ifndef SPIKE_CPP_API_LIGHT_H_
8#define SPIKE_CPP_API_LIGHT_H_
9
10extern "C" {
11#include <spike/hub/light.h>
12#include <pbio/color.h>
13}
14
15namespace spikeapi {
19class Light
20{
21public:
22
26 enum class EColor {
27 NONE = PBIO_COLOR_NONE,
28 BLACK = PBIO_COLOR_BLACK,
29 GRAY = PBIO_COLOR_GRAY,
30 WHITE = PBIO_COLOR_WHITE,
31 RED = PBIO_COLOR_RED,
32 BROWN = PBIO_COLOR_BROWN,
33 ORANGE = PBIO_COLOR_ORANGE,
34 YELLOW = PBIO_COLOR_YELLOW,
35 GREEN = PBIO_COLOR_GREEN,
36 SPRING_GREEN = PBIO_COLOR_SPRING_GREEN,
37 CYAN = PBIO_COLOR_CYAN,
38 BLUE = PBIO_COLOR_BLUE,
39 VIOLET = PBIO_COLOR_VIOLET,
40 MAGENTA = PBIO_COLOR_MAGENTA
41 };
42
43 struct HSV {
44 uint16_t h;
45 uint8_t s;
46 uint8_t v;
47 };
48
49
55 Light(void) = default;
56
61 void turnOnHSV(Light::HSV &colorHSV);
62
67 void turnOnColor(Light::EColor color);
68
72 void turnOff() const {
73 hub_light_off();
74 }
75
80 bool hasError() { return false; }
81
82
83}; // class Light
84} // namespace spikeapi
85
86#endif // !SPIKE_CPP_API_LIGHT_H_
void turnOff() const
Definition Light.h:72
Light(void)=default
bool hasError()
Definition Light.h:80
void turnOnColor(Light::EColor color)
Definition Light.cpp:17
EColor
Definition Light.h:26
void turnOnHSV(Light::HSV &colorHSV)
Definition Light.cpp:11
Definition Light.h:43