CTRE Phoenix 6 C++ 26.50.0-alpha-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 <wpi/units/dimensionless.hpp>
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 * - Default Value: signals#StripTypeValue#GRB
33 */
35 /**
36 * \brief The brightness scalar for all LEDs controlled. All LED
37 * values sent to the CANdle will be scaled by this config.
38 *
39 * - Minimum Value: 0.0
40 * - Maximum Value: 1.0
41 * - Default Value: 1.0
42 * - Units: scalar
43 */
44 wpi::units::scalar_t BrightnessScalar = 1.0;
45 /**
46 * \brief The behavior of the LEDs when the control signal is lost.
47 *
48 * - Default Value: signals#LossOfSignalBehaviorValue#KeepRunning
49 */
51
52 /**
53 * \brief Modifies this configuration's StripType parameter and returns itself for
54 * method-chaining and easier to use config API.
55 *
56 * The type of LEDs that are being controlled.
57 *
58 * - Default Value: signals#StripTypeValue#GRB
59 *
60 * \param newStripType Parameter to modify
61 * \returns Itself
62 */
64 {
65 StripType = std::move(newStripType);
66 return *this;
67 }
68
69 /**
70 * \brief Modifies this configuration's BrightnessScalar parameter and returns itself for
71 * method-chaining and easier to use config API.
72 *
73 * The brightness scalar for all LEDs controlled. All LED values sent
74 * to the CANdle will be scaled by this config.
75 *
76 * - Minimum Value: 0.0
77 * - Maximum Value: 1.0
78 * - Default Value: 1.0
79 * - Units: scalar
80 *
81 * \param newBrightnessScalar Parameter to modify
82 * \returns Itself
83 */
84 constexpr LEDConfigs &WithBrightnessScalar(wpi::units::scalar_t newBrightnessScalar)
85 {
86 BrightnessScalar = std::move(newBrightnessScalar);
87 return *this;
88 }
89
90 /**
91 * \brief Modifies this configuration's LossOfSignalBehavior parameter and returns itself for
92 * method-chaining and easier to use config API.
93 *
94 * The behavior of the LEDs when the control signal is lost.
95 *
96 * - Default Value: signals#LossOfSignalBehaviorValue#KeepRunning
97 *
98 * \param newLossOfSignalBehavior Parameter to modify
99 * \returns Itself
100 */
102 {
103 LossOfSignalBehavior = std::move(newLossOfSignalBehavior);
104 return *this;
105 }
106
107
108
109 std::string ToString() const override;
110
111 std::string Serialize() const final;
112 ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final;
113};
114
115}
116}
117}
signals::LossOfSignalBehaviorValue LossOfSignalBehavior
The behavior of the LEDs when the control signal is lost.
Definition LEDConfigs.hpp:50
constexpr LEDConfigs & WithStripType(signals::StripTypeValue newStripType)
Modifies this configuration's StripType parameter and returns itself for method-chaining and easier t...
Definition LEDConfigs.hpp:63
wpi::units::scalar_t BrightnessScalar
The brightness scalar for all LEDs controlled.
Definition LEDConfigs.hpp:44
signals::StripTypeValue StripType
The type of LEDs that are being controlled.
Definition LEDConfigs.hpp:34
std::string ToString() const override
constexpr LEDConfigs & WithBrightnessScalar(wpi::units::scalar_t newBrightnessScalar)
Modifies this configuration's BrightnessScalar parameter and returns itself for method-chaining and e...
Definition LEDConfigs.hpp:84
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:101
std::string Serialize() const final
Definition Configuration.hpp:17
Definition ExternalFeedbackConfigs.hpp:21
Definition ExternalFeedbackConfigs.hpp:16
Definition FrcUsageReport.hpp:12
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