CTRE Phoenix 6 C++ 26.0.0-beta-1
Loading...
Searching...
No Matches
LEDConfigs.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) Cross The Road Electronics.  All rights reserved.
3 * License information can be found in CTRE_LICENSE.txt
4 * For support and suggestions contact support@ctr-electronics.com or file
5 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases
6 */
7#pragma once
8
11#include <units/dimensionless.h>
12
13namespace ctre {
14namespace phoenix6 {
15
16
17namespace configs {
18
19/**
20 * \brief Configs related to CANdle LED control.
21 *
22 * \details All the configs related to controlling LEDs with the
23 * CANdle, including LED strip type and brightness.
24 */
26public:
27 constexpr LEDConfigs() = default;
28
29 /**
30 * \brief The type of LEDs that are being controlled.
31 *
32 */
34 /**
35 * \brief The brightness scalar for all LEDs controlled. All LED
36 * values sent to the CANdle will be scaled by this config.
37 *
38 * - Minimum Value: 0.0
39 * - Maximum Value: 1.0
40 * - Default Value: 1.0
41 * - Units: scalar
42 */
43 units::dimensionless::scalar_t BrightnessScalar = 1.0;
44 /**
45 * \brief The behavior of the LEDs when the control signal is lost.
46 *
47 */
49
50 /**
51 * \brief Modifies this configuration's StripType parameter and returns itself for
52 * method-chaining and easier to use config API.
53 *
54 * The type of LEDs that are being controlled.
55 *
56 *
57 * \param newStripType Parameter to modify
58 * \returns Itself
59 */
61 {
62 StripType = std::move(newStripType);
63 return *this;
64 }
65
66 /**
67 * \brief Modifies this configuration's BrightnessScalar parameter and returns itself for
68 * method-chaining and easier to use config API.
69 *
70 * The brightness scalar for all LEDs controlled. All LED values sent
71 * to the CANdle will be scaled by this config.
72 *
73 * - Minimum Value: 0.0
74 * - Maximum Value: 1.0
75 * - Default Value: 1.0
76 * - Units: scalar
77 *
78 * \param newBrightnessScalar Parameter to modify
79 * \returns Itself
80 */
81 constexpr LEDConfigs &WithBrightnessScalar(units::dimensionless::scalar_t newBrightnessScalar)
82 {
83 BrightnessScalar = std::move(newBrightnessScalar);
84 return *this;
85 }
86
87 /**
88 * \brief Modifies this configuration's LossOfSignalBehavior parameter and returns itself for
89 * method-chaining and easier to use config API.
90 *
91 * The behavior of the LEDs when the control signal is lost.
92 *
93 *
94 * \param newLossOfSignalBehavior Parameter to modify
95 * \returns Itself
96 */
98 {
99 LossOfSignalBehavior = std::move(newLossOfSignalBehavior);
100 return *this;
101 }
102
103
104
105 std::string ToString() const override;
106
107 std::string Serialize() const final;
108 ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final;
109};
110
111}
112}
113}
Configs related to CANdle LED control.
Definition LEDConfigs.hpp:25
signals::LossOfSignalBehaviorValue LossOfSignalBehavior
The behavior of the LEDs when the control signal is lost.
Definition LEDConfigs.hpp:48
constexpr LEDConfigs & WithStripType(signals::StripTypeValue newStripType)
Modifies this configuration's StripType parameter and returns itself for method-chaining and easier t...
Definition LEDConfigs.hpp:60
constexpr LEDConfigs & WithBrightnessScalar(units::dimensionless::scalar_t newBrightnessScalar)
Modifies this configuration's BrightnessScalar parameter and returns itself for method-chaining and e...
Definition LEDConfigs.hpp:81
signals::StripTypeValue StripType
The type of LEDs that are being controlled.
Definition LEDConfigs.hpp:33
std::string ToString() const override
units::dimensionless::scalar_t BrightnessScalar
The brightness scalar for all LEDs controlled.
Definition LEDConfigs.hpp:43
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
constexpr LEDConfigs & WithLossOfSignalBehavior(signals::LossOfSignalBehaviorValue newLossOfSignalBehavior)
Modifies this configuration's LossOfSignalBehavior parameter and returns itself for method-chaining a...
Definition LEDConfigs.hpp:97
std::string Serialize() const final
Definition Configuration.hpp:17
Definition motor_constants.h:14
The behavior of the LEDs when the control signal is lost.
Definition SpnEnums.hpp:3843
static constexpr int KeepRunning
LEDs remain enabled, and animations continue to run.
Definition SpnEnums.hpp:3849
The type of LEDs that are being controlled.
Definition SpnEnums.hpp:3769
static constexpr int GRB
LEDs that are controlled by Green-Red-Blue values.
Definition SpnEnums.hpp:3775