Loading [MathJax]/extensions/tex2jax.js
CTRE Phoenix 6 C++ 25.4.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CoreCANdle.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
13
27#include <units/current.h>
28#include <units/dimensionless.h>
29#include <units/temperature.h>
30#include <units/voltage.h>
31
32namespace ctre {
33namespace phoenix6 {
34
35namespace hardware {
36namespace core {
37 class CoreCANdle;
38}
39}
40
41namespace configs {
42
43/**
44 * Class for CTR Electronics' CANdle® branded device, a device that controls
45 * LEDs over the CAN bus.
46 *
47 * This handles the configurations for the hardware#CANdle
48 */
50{
51public:
52 constexpr CANdleConfiguration() = default;
53
54 /**
55 * \brief True if we should factory default newer unsupported configs,
56 * false to leave newer unsupported configs alone.
57 *
58 * \details This flag addresses a corner case where the device may have
59 * firmware with newer configs that didn't exist when this
60 * version of the API was built. If this occurs and this
61 * flag is true, unsupported new configs will be factory
62 * defaulted to avoid unexpected behavior.
63 *
64 * This is also the behavior in Phoenix 5, so this flag
65 * is defaulted to true to match.
66 */
68
69
70 /**
71 * \brief Custom Params.
72 *
73 * \details Custom paramaters that have no real impact on controller.
74 *
75 * Parameter list:
76 *
77 * - CustomParamsConfigs#CustomParam0
78 * - CustomParamsConfigs#CustomParam1
79 *
80 */
82
83 /**
84 * \brief Configs related to CANdle LED control.
85 *
86 * \details All the configs related to controlling LEDs with the
87 * CANdle, including LED strip type and brightness.
88 *
89 * Parameter list:
90 *
91 * - LEDConfigs#StripType
92 * - LEDConfigs#BrightnessScalar
93 * - LEDConfigs#LossOfSignalBehavior
94 *
95 */
97
98 /**
99 * \brief Configs related to general CANdle features.
100 *
101 * \details This includes configs such as disabling the 5V rail and
102 * the behavior of VBat output.
103 *
104 * Parameter list:
105 *
106 * - CANdleFeaturesConfigs#Enable5VRail
107 * - CANdleFeaturesConfigs#VBatOutputMode
108 * - CANdleFeaturesConfigs#StatusLedWhenActive
109 *
110 */
112
113 /**
114 * \brief Modifies this configuration's CustomParams parameter and returns itself for
115 * method-chaining and easier to use config API.
116 *
117 * Custom Params.
118 *
119 * \details Custom paramaters that have no real impact on controller.
120 *
121 * Parameter list:
122 *
123 * - CustomParamsConfigs#CustomParam0
124 * - CustomParamsConfigs#CustomParam1
125 *
126 *
127 * \param newCustomParams Parameter to modify
128 * \returns Itself
129 */
131 {
132 CustomParams = std::move(newCustomParams);
133 return *this;
134 }
135
136 /**
137 * \brief Modifies this configuration's LED parameter and returns itself for
138 * method-chaining and easier to use config API.
139 *
140 * Configs related to CANdle LED control.
141 *
142 * \details All the configs related to controlling LEDs with the
143 * CANdle, including LED strip type and brightness.
144 *
145 * Parameter list:
146 *
147 * - LEDConfigs#StripType
148 * - LEDConfigs#BrightnessScalar
149 * - LEDConfigs#LossOfSignalBehavior
150 *
151 *
152 * \param newLED Parameter to modify
153 * \returns Itself
154 */
156 {
157 LED = std::move(newLED);
158 return *this;
159 }
160
161 /**
162 * \brief Modifies this configuration's CANdleFeatures parameter and returns itself for
163 * method-chaining and easier to use config API.
164 *
165 * Configs related to general CANdle features.
166 *
167 * \details This includes configs such as disabling the 5V rail and
168 * the behavior of VBat output.
169 *
170 * Parameter list:
171 *
172 * - CANdleFeaturesConfigs#Enable5VRail
173 * - CANdleFeaturesConfigs#VBatOutputMode
174 * - CANdleFeaturesConfigs#StatusLedWhenActive
175 *
176 *
177 * \param newCANdleFeatures Parameter to modify
178 * \returns Itself
179 */
181 {
182 CANdleFeatures = std::move(newCANdleFeatures);
183 return *this;
184 }
185
186 /**
187 * \brief Get the string representation of this configuration
188 */
189 std::string ToString() const
190 {
191 std::stringstream ss;
192 ss << "CANdleConfiguration" << std::endl;
193 ss << CustomParams.ToString();
194 ss << LED.ToString();
195 ss << CANdleFeatures.ToString();
196 return ss.str();
197 }
198
199 /**
200 * \brief Get the serialized form of this configuration
201 */
202 std::string Serialize() const
203 {
204 std::stringstream ss;
205 ss << CustomParams.Serialize();
206 ss << LED.Serialize();
208 return ss.str();
209 }
210
211 /**
212 * \brief Take a string and deserialize it to this configuration
213 */
214 ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize)
215 {
217 err = CustomParams.Deserialize(to_deserialize);
218 err = LED.Deserialize(to_deserialize);
219 err = CANdleFeatures.Deserialize(to_deserialize);
220 return err;
221 }
222};
223
224/**
225 * Class for CTR Electronics' CANdle® branded device, a device that controls
226 * LEDs over the CAN bus.
227 *
228 * This handles the configurations for the hardware#CANdle
229 */
231{
232private:
234 ParentConfigurator{std::move(id)}
235 {}
236
238
239public:
240 /**
241 * \brief Refreshes the values of the specified config group.
242 *
243 * This will wait up to #DefaultTimeoutSeconds.
244 *
245 * \details Call to refresh the selected configs from the device.
246 *
247 * \param configs The configs to refresh
248 * \returns StatusCode of refreshing the configs
249 */
251 {
252 return Refresh(configs, DefaultTimeoutSeconds);
253 }
254
255 /**
256 * \brief Refreshes the values of the specified config group.
257 *
258 * \details Call to refresh the selected configs from the device.
259 *
260 * \param configs The configs to refresh
261 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
262 * \returns StatusCode of refreshing the configs
263 */
264 ctre::phoenix::StatusCode Refresh(CANdleConfiguration &configs, units::time::second_t timeoutSeconds) const
265 {
266 std::string ref;
267 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
268 configs.Deserialize(ref);
269 return ret;
270 }
271
272 /**
273 * \brief Applies the contents of the specified config to the device.
274 *
275 * This will wait up to #DefaultTimeoutSeconds.
276 *
277 * \details Call to apply the selected configs.
278 *
279 * \param configs Configs to apply against.
280 * \returns StatusCode of the set command
281 */
283 {
284 return Apply(configs, DefaultTimeoutSeconds);
285 }
286
287 /**
288 * \brief Applies the contents of the specified config to the device.
289 *
290 * \details Call to apply the selected configs.
291 *
292 * \param configs Configs to apply against.
293 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
294 * \returns StatusCode of the set command
295 */
296 ctre::phoenix::StatusCode Apply(const CANdleConfiguration &configs, units::time::second_t timeoutSeconds)
297 {
298 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, configs.FutureProofConfigs, false);
299 }
300
301
302 /**
303 * \brief Refreshes the values of the specified config group.
304 *
305 * This will wait up to #DefaultTimeoutSeconds.
306 *
307 * \details Call to refresh the selected configs from the device.
308 *
309 * \param configs The configs to refresh
310 * \returns StatusCode of refreshing the configs
311 */
313 {
314 return Refresh(configs, DefaultTimeoutSeconds);
315 }
316 /**
317 * \brief Refreshes the values of the specified config group.
318 *
319 * \details Call to refresh the selected configs from the device.
320 *
321 * \param configs The configs to refresh
322 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
323 * \returns StatusCode of refreshing the configs
324 */
325 ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs, units::time::second_t timeoutSeconds) const
326 {
327 std::string ref;
328 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
329 configs.Deserialize(ref);
330 return ret;
331 }
332
333 /**
334 * \brief Applies the contents of the specified config to the device.
335 *
336 * This will wait up to #DefaultTimeoutSeconds.
337 *
338 * \details Call to apply the selected configs.
339 *
340 * \param configs Configs to apply against.
341 * \returns StatusCode of the set command
342 */
344 {
345 return Apply(configs, DefaultTimeoutSeconds);
346 }
347
348 /**
349 * \brief Applies the contents of the specified config to the device.
350 *
351 * \details Call to apply the selected configs.
352 *
353 * \param configs Configs to apply against.
354 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
355 * \returns StatusCode of the set command
356 */
357 ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs, units::time::second_t timeoutSeconds)
358 {
359 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
360 }
361
362 /**
363 * \brief Refreshes the values of the specified config group.
364 *
365 * This will wait up to #DefaultTimeoutSeconds.
366 *
367 * \details Call to refresh the selected configs from the device.
368 *
369 * \param configs The configs to refresh
370 * \returns StatusCode of refreshing the configs
371 */
373 {
374 return Refresh(configs, DefaultTimeoutSeconds);
375 }
376 /**
377 * \brief Refreshes the values of the specified config group.
378 *
379 * \details Call to refresh the selected configs from the device.
380 *
381 * \param configs The configs to refresh
382 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
383 * \returns StatusCode of refreshing the configs
384 */
385 ctre::phoenix::StatusCode Refresh(LEDConfigs &configs, units::time::second_t timeoutSeconds) const
386 {
387 std::string ref;
388 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
389 configs.Deserialize(ref);
390 return ret;
391 }
392
393 /**
394 * \brief Applies the contents of the specified config to the device.
395 *
396 * This will wait up to #DefaultTimeoutSeconds.
397 *
398 * \details Call to apply the selected configs.
399 *
400 * \param configs Configs to apply against.
401 * \returns StatusCode of the set command
402 */
404 {
405 return Apply(configs, DefaultTimeoutSeconds);
406 }
407
408 /**
409 * \brief Applies the contents of the specified config to the device.
410 *
411 * \details Call to apply the selected configs.
412 *
413 * \param configs Configs to apply against.
414 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
415 * \returns StatusCode of the set command
416 */
417 ctre::phoenix::StatusCode Apply(const LEDConfigs &configs, units::time::second_t timeoutSeconds)
418 {
419 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
420 }
421
422 /**
423 * \brief Refreshes the values of the specified config group.
424 *
425 * This will wait up to #DefaultTimeoutSeconds.
426 *
427 * \details Call to refresh the selected configs from the device.
428 *
429 * \param configs The configs to refresh
430 * \returns StatusCode of refreshing the configs
431 */
436 /**
437 * \brief Refreshes the values of the specified config group.
438 *
439 * \details Call to refresh the selected configs from the device.
440 *
441 * \param configs The configs to refresh
442 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
443 * \returns StatusCode of refreshing the configs
444 */
445 ctre::phoenix::StatusCode Refresh(CANdleFeaturesConfigs &configs, units::time::second_t timeoutSeconds) const
446 {
447 std::string ref;
448 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
449 configs.Deserialize(ref);
450 return ret;
451 }
452
453 /**
454 * \brief Applies the contents of the specified config to the device.
455 *
456 * This will wait up to #DefaultTimeoutSeconds.
457 *
458 * \details Call to apply the selected configs.
459 *
460 * \param configs Configs to apply against.
461 * \returns StatusCode of the set command
462 */
464 {
465 return Apply(configs, DefaultTimeoutSeconds);
466 }
467
468 /**
469 * \brief Applies the contents of the specified config to the device.
470 *
471 * \details Call to apply the selected configs.
472 *
473 * \param configs Configs to apply against.
474 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
475 * \returns StatusCode of the set command
476 */
477 ctre::phoenix::StatusCode Apply(const CANdleFeaturesConfigs &configs, units::time::second_t timeoutSeconds)
478 {
479 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
480 }
481
482
483 /**
484 * \brief Clear the sticky faults in the device.
485 *
486 * \details This typically has no impact on the device functionality.
487 * Instead, it just clears telemetry faults that are accessible via
488 * API and Tuner Self-Test.
489 *
490 * This will wait up to #DefaultTimeoutSeconds.
491 *
492 * This is available in the configurator in case the user wants
493 * to initialize their device entirely without passing a device
494 * reference down to the code that performs the initialization.
495 * In this case, the user passes down the configurator object
496 * and performs all the initialization code on the object.
497 *
498 * \returns StatusCode of the set command
499 */
504 /**
505 * \brief Clear the sticky faults in the device.
506 *
507 * \details This typically has no impact on the device functionality.
508 * Instead, it just clears telemetry faults that are accessible via
509 * API and Tuner Self-Test.
510 *
511 * This is available in the configurator in case the user wants
512 * to initialize their device entirely without passing a device
513 * reference down to the code that performs the initialization.
514 * In this case, the user passes down the configurator object
515 * and performs all the initialization code on the object.
516 *
517 * \param timeoutSeconds Maximum time to wait up to in seconds.
518 * \returns StatusCode of the set command
519 */
520 ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
521 {
522 std::stringstream ss;
523 char *ref;
524 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::SPN_ClearStickyFaults, 0, &ref); if (ref != nullptr) { ss << ref; free(ref); }
525 return SetConfigsPrivate(ss.str(), timeoutSeconds, false, true);
526 }
527
528 /**
529 * \brief Clear sticky fault: Hardware fault occurred
530 *
531 * This will wait up to #DefaultTimeoutSeconds.
532 *
533 * This is available in the configurator in case the user wants
534 * to initialize their device entirely without passing a device
535 * reference down to the code that performs the initialization.
536 * In this case, the user passes down the configurator object
537 * and performs all the initialization code on the object.
538 *
539 * \returns StatusCode of the set command
540 */
545 /**
546 * \brief Clear sticky fault: Hardware fault occurred
547 *
548 * This is available in the configurator in case the user wants
549 * to initialize their device entirely without passing a device
550 * reference down to the code that performs the initialization.
551 * In this case, the user passes down the configurator object
552 * and performs all the initialization code on the object.
553 *
554 * \param timeoutSeconds Maximum time to wait up to in seconds.
555 * \returns StatusCode of the set command
556 */
557 ctre::phoenix::StatusCode ClearStickyFault_Hardware(units::time::second_t timeoutSeconds)
558 {
559 std::stringstream ss;
560 char *ref;
561 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::ClearStickyFault_Hardware, 0, &ref); if (ref != nullptr) { ss << ref; free(ref); }
562 return SetConfigsPrivate(ss.str(), timeoutSeconds, false, true);
563 }
564
565 /**
566 * \brief Clear sticky fault: Device supply voltage dropped to near
567 * brownout levels
568 *
569 * This will wait up to #DefaultTimeoutSeconds.
570 *
571 * This is available in the configurator in case the user wants
572 * to initialize their device entirely without passing a device
573 * reference down to the code that performs the initialization.
574 * In this case, the user passes down the configurator object
575 * and performs all the initialization code on the object.
576 *
577 * \returns StatusCode of the set command
578 */
583 /**
584 * \brief Clear sticky fault: Device supply voltage dropped to near
585 * brownout levels
586 *
587 * This is available in the configurator in case the user wants
588 * to initialize their device entirely without passing a device
589 * reference down to the code that performs the initialization.
590 * In this case, the user passes down the configurator object
591 * and performs all the initialization code on the object.
592 *
593 * \param timeoutSeconds Maximum time to wait up to in seconds.
594 * \returns StatusCode of the set command
595 */
596 ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(units::time::second_t timeoutSeconds)
597 {
598 std::stringstream ss;
599 char *ref;
600 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::ClearStickyFault_Undervoltage, 0, &ref); if (ref != nullptr) { ss << ref; free(ref); }
601 return SetConfigsPrivate(ss.str(), timeoutSeconds, false, true);
602 }
603
604 /**
605 * \brief Clear sticky fault: Device boot while detecting the enable
606 * signal
607 *
608 * This will wait up to #DefaultTimeoutSeconds.
609 *
610 * This is available in the configurator in case the user wants
611 * to initialize their device entirely without passing a device
612 * reference down to the code that performs the initialization.
613 * In this case, the user passes down the configurator object
614 * and performs all the initialization code on the object.
615 *
616 * \returns StatusCode of the set command
617 */
622 /**
623 * \brief Clear sticky fault: Device boot while detecting the enable
624 * signal
625 *
626 * This is available in the configurator in case the user wants
627 * to initialize their device entirely without passing a device
628 * reference down to the code that performs the initialization.
629 * In this case, the user passes down the configurator object
630 * and performs all the initialization code on the object.
631 *
632 * \param timeoutSeconds Maximum time to wait up to in seconds.
633 * \returns StatusCode of the set command
634 */
636 {
637 std::stringstream ss;
638 char *ref;
639 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::ClearStickyFault_BootDuringEnable, 0, &ref); if (ref != nullptr) { ss << ref; free(ref); }
640 return SetConfigsPrivate(ss.str(), timeoutSeconds, false, true);
641 }
642
643 /**
644 * \brief Clear sticky fault: An unlicensed feature is in use, device
645 * may not behave as expected.
646 *
647 * This will wait up to #DefaultTimeoutSeconds.
648 *
649 * This is available in the configurator in case the user wants
650 * to initialize their device entirely without passing a device
651 * reference down to the code that performs the initialization.
652 * In this case, the user passes down the configurator object
653 * and performs all the initialization code on the object.
654 *
655 * \returns StatusCode of the set command
656 */
661 /**
662 * \brief Clear sticky fault: An unlicensed feature is in use, device
663 * may not behave as expected.
664 *
665 * This is available in the configurator in case the user wants
666 * to initialize their device entirely without passing a device
667 * reference down to the code that performs the initialization.
668 * In this case, the user passes down the configurator object
669 * and performs all the initialization code on the object.
670 *
671 * \param timeoutSeconds Maximum time to wait up to in seconds.
672 * \returns StatusCode of the set command
673 */
675 {
676 std::stringstream ss;
677 char *ref;
678 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::ClearStickyFault_UnlicensedFeatureInUse, 0, &ref); if (ref != nullptr) { ss << ref; free(ref); }
679 return SetConfigsPrivate(ss.str(), timeoutSeconds, false, true);
680 }
681
682 /**
683 * \brief Clear sticky fault: Device supply voltage is too high (above
684 * 30 V).
685 *
686 * This will wait up to #DefaultTimeoutSeconds.
687 *
688 * This is available in the configurator in case the user wants
689 * to initialize their device entirely without passing a device
690 * reference down to the code that performs the initialization.
691 * In this case, the user passes down the configurator object
692 * and performs all the initialization code on the object.
693 *
694 * \returns StatusCode of the set command
695 */
700 /**
701 * \brief Clear sticky fault: Device supply voltage is too high (above
702 * 30 V).
703 *
704 * This is available in the configurator in case the user wants
705 * to initialize their device entirely without passing a device
706 * reference down to the code that performs the initialization.
707 * In this case, the user passes down the configurator object
708 * and performs all the initialization code on the object.
709 *
710 * \param timeoutSeconds Maximum time to wait up to in seconds.
711 * \returns StatusCode of the set command
712 */
713 ctre::phoenix::StatusCode ClearStickyFault_Overvoltage(units::time::second_t timeoutSeconds)
714 {
715 std::stringstream ss;
716 char *ref;
717 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::ClearStickyFault_CANDLE_OVERVOLTAGE, 0, &ref); if (ref != nullptr) { ss << ref; free(ref); }
718 return SetConfigsPrivate(ss.str(), timeoutSeconds, false, true);
719 }
720
721 /**
722 * \brief Clear sticky fault: Device 5V line is too high (above 6 V).
723 *
724 * This will wait up to #DefaultTimeoutSeconds.
725 *
726 * This is available in the configurator in case the user wants
727 * to initialize their device entirely without passing a device
728 * reference down to the code that performs the initialization.
729 * In this case, the user passes down the configurator object
730 * and performs all the initialization code on the object.
731 *
732 * \returns StatusCode of the set command
733 */
738 /**
739 * \brief Clear sticky fault: Device 5V line is too high (above 6 V).
740 *
741 * This is available in the configurator in case the user wants
742 * to initialize their device entirely without passing a device
743 * reference down to the code that performs the initialization.
744 * In this case, the user passes down the configurator object
745 * and performs all the initialization code on the object.
746 *
747 * \param timeoutSeconds Maximum time to wait up to in seconds.
748 * \returns StatusCode of the set command
749 */
750 ctre::phoenix::StatusCode ClearStickyFault_5VTooHigh(units::time::second_t timeoutSeconds)
751 {
752 std::stringstream ss;
753 char *ref;
754 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::ClearStickyFault_CANDLE_5V_TOO_HIGH, 0, &ref); if (ref != nullptr) { ss << ref; free(ref); }
755 return SetConfigsPrivate(ss.str(), timeoutSeconds, false, true);
756 }
757
758 /**
759 * \brief Clear sticky fault: Device 5V line is too low (below 4 V).
760 *
761 * This will wait up to #DefaultTimeoutSeconds.
762 *
763 * This is available in the configurator in case the user wants
764 * to initialize their device entirely without passing a device
765 * reference down to the code that performs the initialization.
766 * In this case, the user passes down the configurator object
767 * and performs all the initialization code on the object.
768 *
769 * \returns StatusCode of the set command
770 */
775 /**
776 * \brief Clear sticky fault: Device 5V line is too low (below 4 V).
777 *
778 * This is available in the configurator in case the user wants
779 * to initialize their device entirely without passing a device
780 * reference down to the code that performs the initialization.
781 * In this case, the user passes down the configurator object
782 * and performs all the initialization code on the object.
783 *
784 * \param timeoutSeconds Maximum time to wait up to in seconds.
785 * \returns StatusCode of the set command
786 */
787 ctre::phoenix::StatusCode ClearStickyFault_5VTooLow(units::time::second_t timeoutSeconds)
788 {
789 std::stringstream ss;
790 char *ref;
791 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::ClearStickyFault_CANDLE_5V_TOO_LOW, 0, &ref); if (ref != nullptr) { ss << ref; free(ref); }
792 return SetConfigsPrivate(ss.str(), timeoutSeconds, false, true);
793 }
794
795 /**
796 * \brief Clear sticky fault: Device temperature exceeded limit.
797 *
798 * This will wait up to #DefaultTimeoutSeconds.
799 *
800 * This is available in the configurator in case the user wants
801 * to initialize their device entirely without passing a device
802 * reference down to the code that performs the initialization.
803 * In this case, the user passes down the configurator object
804 * and performs all the initialization code on the object.
805 *
806 * \returns StatusCode of the set command
807 */
812 /**
813 * \brief Clear sticky fault: Device temperature exceeded limit.
814 *
815 * This is available in the configurator in case the user wants
816 * to initialize their device entirely without passing a device
817 * reference down to the code that performs the initialization.
818 * In this case, the user passes down the configurator object
819 * and performs all the initialization code on the object.
820 *
821 * \param timeoutSeconds Maximum time to wait up to in seconds.
822 * \returns StatusCode of the set command
823 */
824 ctre::phoenix::StatusCode ClearStickyFault_Thermal(units::time::second_t timeoutSeconds)
825 {
826 std::stringstream ss;
827 char *ref;
828 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::ClearStickyFault_CANDLE_THERMAL, 0, &ref); if (ref != nullptr) { ss << ref; free(ref); }
829 return SetConfigsPrivate(ss.str(), timeoutSeconds, false, true);
830 }
831
832 /**
833 * \brief Clear sticky fault: CANdle output current exceeded the 6 A
834 * limit.
835 *
836 * This will wait up to #DefaultTimeoutSeconds.
837 *
838 * This is available in the configurator in case the user wants
839 * to initialize their device entirely without passing a device
840 * reference down to the code that performs the initialization.
841 * In this case, the user passes down the configurator object
842 * and performs all the initialization code on the object.
843 *
844 * \returns StatusCode of the set command
845 */
850 /**
851 * \brief Clear sticky fault: CANdle output current exceeded the 6 A
852 * limit.
853 *
854 * This is available in the configurator in case the user wants
855 * to initialize their device entirely without passing a device
856 * reference down to the code that performs the initialization.
857 * In this case, the user passes down the configurator object
858 * and performs all the initialization code on the object.
859 *
860 * \param timeoutSeconds Maximum time to wait up to in seconds.
861 * \returns StatusCode of the set command
862 */
863 ctre::phoenix::StatusCode ClearStickyFault_SoftwareFuse(units::time::second_t timeoutSeconds)
864 {
865 std::stringstream ss;
866 char *ref;
867 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::ClearStickyFault_CANDLE_SOFTWARE_FUSE, 0, &ref); if (ref != nullptr) { ss << ref; free(ref); }
868 return SetConfigsPrivate(ss.str(), timeoutSeconds, false, true);
869 }
870
871 /**
872 * \brief Clear sticky fault: CANdle has detected the output pin is
873 * shorted.
874 *
875 * This will wait up to #DefaultTimeoutSeconds.
876 *
877 * This is available in the configurator in case the user wants
878 * to initialize their device entirely without passing a device
879 * reference down to the code that performs the initialization.
880 * In this case, the user passes down the configurator object
881 * and performs all the initialization code on the object.
882 *
883 * \returns StatusCode of the set command
884 */
889 /**
890 * \brief Clear sticky fault: CANdle has detected the output pin is
891 * shorted.
892 *
893 * This is available in the configurator in case the user wants
894 * to initialize their device entirely without passing a device
895 * reference down to the code that performs the initialization.
896 * In this case, the user passes down the configurator object
897 * and performs all the initialization code on the object.
898 *
899 * \param timeoutSeconds Maximum time to wait up to in seconds.
900 * \returns StatusCode of the set command
901 */
902 ctre::phoenix::StatusCode ClearStickyFault_ShortCircuit(units::time::second_t timeoutSeconds)
903 {
904 std::stringstream ss;
905 char *ref;
906 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::ClearStickyFault_CANDLE_SHORT_CIRCUIT, 0, &ref); if (ref != nullptr) { ss << ref; free(ref); }
907 return SetConfigsPrivate(ss.str(), timeoutSeconds, false, true);
908 }
909};
910
911}
912
913namespace hardware {
914namespace core {
915
916/**
917 * Class for CTR Electronics' CANdle® branded device, a device that controls
918 * LEDs over the CAN bus.
919 */
921{
922private:
924
925public:
927
928 /**
929 * Constructs a new CANdle object.
930 *
931 * \param deviceId ID of the device, as configured in Phoenix Tuner.
932 * \param canbus Name of the CAN bus this device is on. Possible CAN bus strings are:
933 * - "rio" for the native roboRIO CAN bus
934 * - CANivore name or serial number
935 * - SocketCAN interface (non-FRC Linux only)
936 * - "*" for any CANivore seen by the program
937 * - empty string (default) to select the default for the system:
938 * - "rio" on roboRIO
939 * - "can0" on Linux
940 * - "*" on Windows
941 */
942 CoreCANdle(int deviceId, std::string canbus = "");
943
944 /**
945 * Constructs a new CANdle object.
946 *
947 * \param deviceId ID of the device, as configured in Phoenix Tuner.
948 * \param canbus The CAN bus this device is on.
949 */
950 CoreCANdle(int deviceId, CANBus canbus) :
951 CoreCANdle{deviceId, std::string{canbus.GetName()}}
952 {}
953
954 /**
955 * \brief Gets the configurator for this CANdle
956 *
957 * \details Gets the configurator for this CANdle
958 *
959 * \returns Configurator for this CANdle
960 */
962 {
963 return _configs;
964 }
965
966 /**
967 * \brief Gets the configurator for this CANdle
968 *
969 * \details Gets the configurator for this CANdle
970 *
971 * \returns Configurator for this CANdle
972 */
974 {
975 return _configs;
976 }
977
978
979private:
980 std::unique_ptr<sim::CANdleSimState> _simState{};
981public:
982 /**
983 * \brief Get the simulation state for this device.
984 *
985 * \details This function reuses an allocated simulation
986 * state object, so it is safe to call this function multiple
987 * times in a robot loop.
988 *
989 * \returns Simulation state
990 */
992 {
993 if (_simState == nullptr)
994 _simState = std::make_unique<sim::CANdleSimState>(*this);
995 return *_simState;
996 }
997
998
999
1000 /**
1001 * \brief App Major Version number.
1002 *
1003 * - Minimum Value: 0
1004 * - Maximum Value: 255
1005 * - Default Value: 0
1006 * - Units:
1007 *
1008 * Default Rates:
1009 * - CAN: 4.0 Hz
1010 *
1011 * This refreshes and returns a cached StatusSignal object.
1012 *
1013 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1014 * \returns VersionMajor Status Signal Object
1015 */
1016 StatusSignal<int> &GetVersionMajor(bool refresh = true);
1017
1018 /**
1019 * \brief App Minor Version number.
1020 *
1021 * - Minimum Value: 0
1022 * - Maximum Value: 255
1023 * - Default Value: 0
1024 * - Units:
1025 *
1026 * Default Rates:
1027 * - CAN: 4.0 Hz
1028 *
1029 * This refreshes and returns a cached StatusSignal object.
1030 *
1031 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1032 * \returns VersionMinor Status Signal Object
1033 */
1034 StatusSignal<int> &GetVersionMinor(bool refresh = true);
1035
1036 /**
1037 * \brief App Bugfix Version number.
1038 *
1039 * - Minimum Value: 0
1040 * - Maximum Value: 255
1041 * - Default Value: 0
1042 * - Units:
1043 *
1044 * Default Rates:
1045 * - CAN: 4.0 Hz
1046 *
1047 * This refreshes and returns a cached StatusSignal object.
1048 *
1049 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1050 * \returns VersionBugfix Status Signal Object
1051 */
1053
1054 /**
1055 * \brief App Build Version number.
1056 *
1057 * - Minimum Value: 0
1058 * - Maximum Value: 255
1059 * - Default Value: 0
1060 * - Units:
1061 *
1062 * Default Rates:
1063 * - CAN: 4.0 Hz
1064 *
1065 * This refreshes and returns a cached StatusSignal object.
1066 *
1067 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1068 * \returns VersionBuild Status Signal Object
1069 */
1070 StatusSignal<int> &GetVersionBuild(bool refresh = true);
1071
1072 /**
1073 * \brief Full Version of firmware in device. The format is a four
1074 * byte value.
1075 *
1076 * - Minimum Value: 0
1077 * - Maximum Value: 4294967295
1078 * - Default Value: 0
1079 * - Units:
1080 *
1081 * Default Rates:
1082 * - CAN: 4.0 Hz
1083 *
1084 * This refreshes and returns a cached StatusSignal object.
1085 *
1086 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1087 * \returns Version Status Signal Object
1088 */
1089 StatusSignal<int> &GetVersion(bool refresh = true);
1090
1091 /**
1092 * \brief Integer representing all fault flags reported by the device.
1093 *
1094 * \details These are device specific and are not used directly in
1095 * typical applications. Use the signal specific GetFault_*() methods
1096 * instead.
1097 *
1098 * - Minimum Value: 0
1099 * - Maximum Value: 4294967295
1100 * - Default Value: 0
1101 * - Units:
1102 *
1103 * Default Rates:
1104 * - CAN: 4.0 Hz
1105 *
1106 * This refreshes and returns a cached StatusSignal object.
1107 *
1108 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1109 * \returns FaultField Status Signal Object
1110 */
1111 StatusSignal<int> &GetFaultField(bool refresh = true);
1112
1113 /**
1114 * \brief Integer representing all (persistent) sticky fault flags
1115 * reported by the device.
1116 *
1117 * \details These are device specific and are not used directly in
1118 * typical applications. Use the signal specific GetStickyFault_*()
1119 * methods instead.
1120 *
1121 * - Minimum Value: 0
1122 * - Maximum Value: 4294967295
1123 * - Default Value: 0
1124 * - Units:
1125 *
1126 * Default Rates:
1127 * - CAN: 4.0 Hz
1128 *
1129 * This refreshes and returns a cached StatusSignal object.
1130 *
1131 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1132 * \returns StickyFaultField Status Signal Object
1133 */
1135
1136 /**
1137 * \brief Whether the device is Phoenix Pro licensed.
1138 *
1139 * - Default Value: False
1140 *
1141 * Default Rates:
1142 * - CAN: 4.0 Hz
1143 *
1144 * This refreshes and returns a cached StatusSignal object.
1145 *
1146 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1147 * \returns IsProLicensed Status Signal Object
1148 */
1150
1151 /**
1152 * \brief Measured supply voltage to the CANdle.
1153 *
1154 * - Minimum Value: 0.0
1155 * - Maximum Value: 32.767
1156 * - Default Value: 0
1157 * - Units: V
1158 *
1159 * Default Rates:
1160 * - CAN 2.0: 10.0 Hz
1161 * - CAN FD: 10.0 Hz (TimeSynced with Pro)
1162 *
1163 * This refreshes and returns a cached StatusSignal object.
1164 *
1165 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1166 * \returns SupplyVoltage Status Signal Object
1167 */
1169
1170 /**
1171 * \brief The measured voltage of the 5V rail line.
1172 *
1173 * - Minimum Value: 0.0
1174 * - Maximum Value: 10.23
1175 * - Default Value: 0
1176 * - Units: V
1177 *
1178 * Default Rates:
1179 * - CAN 2.0: 10.0 Hz
1180 * - CAN FD: 10.0 Hz (TimeSynced with Pro)
1181 *
1182 * This refreshes and returns a cached StatusSignal object.
1183 *
1184 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1185 * \returns FiveVRailVoltage Status Signal Object
1186 */
1188
1189 /**
1190 * \brief The measured output current. This includes both VBat and 5V
1191 * output current.
1192 *
1193 * - Minimum Value: 0.0
1194 * - Maximum Value: 10.23
1195 * - Default Value: 0
1196 * - Units: A
1197 *
1198 * Default Rates:
1199 * - CAN 2.0: 10.0 Hz
1200 * - CAN FD: 10.0 Hz (TimeSynced with Pro)
1201 *
1202 * This refreshes and returns a cached StatusSignal object.
1203 *
1204 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1205 * \returns OutputCurrent Status Signal Object
1206 */
1208
1209 /**
1210 * \brief The temperature that the CANdle measures itself to be at.
1211 *
1212 * - Minimum Value: -128
1213 * - Maximum Value: 127
1214 * - Default Value: 0
1215 * - Units: ℃
1216 *
1217 * Default Rates:
1218 * - CAN 2.0: 10.0 Hz
1219 * - CAN FD: 10.0 Hz (TimeSynced with Pro)
1220 *
1221 * This refreshes and returns a cached StatusSignal object.
1222 *
1223 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1224 * \returns DeviceTemp Status Signal Object
1225 */
1227
1228 /**
1229 * \brief The applied VBat modulation duty cycle.
1230 *
1231 * This signal will report 1.0 if the VBatOutputMode is configured to
1232 * be always on, and 0.0 if configured to be always off. Otherwise,
1233 * this will report the applied modulation from the last
1234 * ModulateVBatOut request.
1235 *
1236 * - Minimum Value: 0.0
1237 * - Maximum Value: 1.0
1238 * - Default Value: 0
1239 * - Units: frac
1240 *
1241 * Default Rates:
1242 * - CAN 2.0: 10.0 Hz
1243 * - CAN FD: 10.0 Hz (TimeSynced with Pro)
1244 *
1245 * This refreshes and returns a cached StatusSignal object.
1246 *
1247 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1248 * \returns VBatModulation Status Signal Object
1249 */
1251
1252 /**
1253 * \brief The maximum number of simultaneous animations supported by
1254 * the current version of CANdle firmware.
1255 *
1256 * Any control request using an animation slot greater than or equal
1257 * to this signal will be ignored.
1258 *
1259 * - Minimum Value: 0
1260 * - Maximum Value: 31
1261 * - Default Value: 0
1262 * - Units:
1263 *
1264 * Default Rates:
1265 * - CAN 2.0: 10.0 Hz
1266 * - CAN FD: 10.0 Hz (TimeSynced with Pro)
1267 *
1268 * This refreshes and returns a cached StatusSignal object.
1269 *
1270 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1271 * \returns MaxSimultaneousAnimationCount Status Signal Object
1272 */
1274
1275 /**
1276 * \brief Hardware fault occurred
1277 *
1278 * - Default Value: False
1279 *
1280 * Default Rates:
1281 * - CAN: 4.0 Hz
1282 *
1283 * This refreshes and returns a cached StatusSignal object.
1284 *
1285 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1286 * \returns Fault_Hardware Status Signal Object
1287 */
1289
1290 /**
1291 * \brief Hardware fault occurred
1292 *
1293 * - Default Value: False
1294 *
1295 * Default Rates:
1296 * - CAN: 4.0 Hz
1297 *
1298 * This refreshes and returns a cached StatusSignal object.
1299 *
1300 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1301 * \returns StickyFault_Hardware Status Signal Object
1302 */
1304
1305 /**
1306 * \brief Device supply voltage dropped to near brownout levels
1307 *
1308 * - Default Value: False
1309 *
1310 * Default Rates:
1311 * - CAN: 4.0 Hz
1312 *
1313 * This refreshes and returns a cached StatusSignal object.
1314 *
1315 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1316 * \returns Fault_Undervoltage Status Signal Object
1317 */
1319
1320 /**
1321 * \brief Device supply voltage dropped to near brownout levels
1322 *
1323 * - Default Value: False
1324 *
1325 * Default Rates:
1326 * - CAN: 4.0 Hz
1327 *
1328 * This refreshes and returns a cached StatusSignal object.
1329 *
1330 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1331 * \returns StickyFault_Undervoltage Status Signal Object
1332 */
1334
1335 /**
1336 * \brief Device boot while detecting the enable signal
1337 *
1338 * - Default Value: False
1339 *
1340 * Default Rates:
1341 * - CAN: 4.0 Hz
1342 *
1343 * This refreshes and returns a cached StatusSignal object.
1344 *
1345 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1346 * \returns Fault_BootDuringEnable Status Signal Object
1347 */
1349
1350 /**
1351 * \brief Device boot while detecting the enable signal
1352 *
1353 * - Default Value: False
1354 *
1355 * Default Rates:
1356 * - CAN: 4.0 Hz
1357 *
1358 * This refreshes and returns a cached StatusSignal object.
1359 *
1360 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1361 * \returns StickyFault_BootDuringEnable Status Signal Object
1362 */
1364
1365 /**
1366 * \brief An unlicensed feature is in use, device may not behave as
1367 * expected.
1368 *
1369 * - Default Value: False
1370 *
1371 * Default Rates:
1372 * - CAN: 4.0 Hz
1373 *
1374 * This refreshes and returns a cached StatusSignal object.
1375 *
1376 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1377 * \returns Fault_UnlicensedFeatureInUse Status Signal Object
1378 */
1380
1381 /**
1382 * \brief An unlicensed feature is in use, device may not behave as
1383 * expected.
1384 *
1385 * - Default Value: False
1386 *
1387 * Default Rates:
1388 * - CAN: 4.0 Hz
1389 *
1390 * This refreshes and returns a cached StatusSignal object.
1391 *
1392 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1393 * \returns StickyFault_UnlicensedFeatureInUse Status Signal Object
1394 */
1396
1397 /**
1398 * \brief Device supply voltage is too high (above 30 V).
1399 *
1400 * - Default Value: False
1401 *
1402 * Default Rates:
1403 * - CAN: 4.0 Hz
1404 *
1405 * This refreshes and returns a cached StatusSignal object.
1406 *
1407 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1408 * \returns Fault_Overvoltage Status Signal Object
1409 */
1411
1412 /**
1413 * \brief Device supply voltage is too high (above 30 V).
1414 *
1415 * - Default Value: False
1416 *
1417 * Default Rates:
1418 * - CAN: 4.0 Hz
1419 *
1420 * This refreshes and returns a cached StatusSignal object.
1421 *
1422 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1423 * \returns StickyFault_Overvoltage Status Signal Object
1424 */
1426
1427 /**
1428 * \brief Device 5V line is too high (above 6 V).
1429 *
1430 * - Default Value: False
1431 *
1432 * Default Rates:
1433 * - CAN: 4.0 Hz
1434 *
1435 * This refreshes and returns a cached StatusSignal object.
1436 *
1437 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1438 * \returns Fault_5VTooHigh Status Signal Object
1439 */
1441
1442 /**
1443 * \brief Device 5V line is too high (above 6 V).
1444 *
1445 * - Default Value: False
1446 *
1447 * Default Rates:
1448 * - CAN: 4.0 Hz
1449 *
1450 * This refreshes and returns a cached StatusSignal object.
1451 *
1452 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1453 * \returns StickyFault_5VTooHigh Status Signal Object
1454 */
1456
1457 /**
1458 * \brief Device 5V line is too low (below 4 V).
1459 *
1460 * - Default Value: False
1461 *
1462 * Default Rates:
1463 * - CAN: 4.0 Hz
1464 *
1465 * This refreshes and returns a cached StatusSignal object.
1466 *
1467 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1468 * \returns Fault_5VTooLow Status Signal Object
1469 */
1471
1472 /**
1473 * \brief Device 5V line is too low (below 4 V).
1474 *
1475 * - Default Value: False
1476 *
1477 * Default Rates:
1478 * - CAN: 4.0 Hz
1479 *
1480 * This refreshes and returns a cached StatusSignal object.
1481 *
1482 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1483 * \returns StickyFault_5VTooLow Status Signal Object
1484 */
1486
1487 /**
1488 * \brief Device temperature exceeded limit.
1489 *
1490 * - Default Value: False
1491 *
1492 * Default Rates:
1493 * - CAN: 4.0 Hz
1494 *
1495 * This refreshes and returns a cached StatusSignal object.
1496 *
1497 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1498 * \returns Fault_Thermal Status Signal Object
1499 */
1501
1502 /**
1503 * \brief Device temperature exceeded limit.
1504 *
1505 * - Default Value: False
1506 *
1507 * Default Rates:
1508 * - CAN: 4.0 Hz
1509 *
1510 * This refreshes and returns a cached StatusSignal object.
1511 *
1512 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1513 * \returns StickyFault_Thermal Status Signal Object
1514 */
1516
1517 /**
1518 * \brief CANdle output current exceeded the 6 A limit.
1519 *
1520 * - Default Value: False
1521 *
1522 * Default Rates:
1523 * - CAN: 4.0 Hz
1524 *
1525 * This refreshes and returns a cached StatusSignal object.
1526 *
1527 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1528 * \returns Fault_SoftwareFuse Status Signal Object
1529 */
1531
1532 /**
1533 * \brief CANdle output current exceeded the 6 A limit.
1534 *
1535 * - Default Value: False
1536 *
1537 * Default Rates:
1538 * - CAN: 4.0 Hz
1539 *
1540 * This refreshes and returns a cached StatusSignal object.
1541 *
1542 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1543 * \returns StickyFault_SoftwareFuse Status Signal Object
1544 */
1546
1547 /**
1548 * \brief CANdle has detected the output pin is shorted.
1549 *
1550 * - Default Value: False
1551 *
1552 * Default Rates:
1553 * - CAN: 4.0 Hz
1554 *
1555 * This refreshes and returns a cached StatusSignal object.
1556 *
1557 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1558 * \returns Fault_ShortCircuit Status Signal Object
1559 */
1561
1562 /**
1563 * \brief CANdle has detected the output pin is shorted.
1564 *
1565 * - Default Value: False
1566 *
1567 * Default Rates:
1568 * - CAN: 4.0 Hz
1569 *
1570 * This refreshes and returns a cached StatusSignal object.
1571 *
1572 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1573 * \returns StickyFault_ShortCircuit Status Signal Object
1574 */
1576
1577
1578 /**
1579 * \brief Modulates the CANdle VBat output to the specified duty
1580 * cycle. This can be used to control a single-color LED strip.
1581 *
1582 * Note that configs::CANdleFeaturesConfigs::VBatOutputMode must be
1583 * set to signals::VBatOutputModeValue::Modulated.
1584 *
1585 * \details
1586 *
1587 * - ModulateVBatOut Parameters:
1588 * - Output: Proportion of VBat to output in fractional units between 0.0 and
1589 * 1.0.
1590 *
1591 * \param request Control object to request of the device
1592 * \returns Status Code of the request, 0 is OK
1593 */
1595
1596 /**
1597 * \brief Sets LEDs to a solid color.
1598 *
1599 * \details
1600 *
1601 * - SolidColor Parameters:
1602 * - LEDStartIndex: The index of the first LED this animation controls
1603 * (inclusive). Indices 0-7 control the onboard LEDs, and 8-399
1604 * control an attached LED strip.
1605 * - LEDEndIndex: The index of the last LED this animation controls (inclusive).
1606 * Indices 0-7 control the onboard LEDs, and 8-399 control an
1607 * attached LED strip.
1608 * - Color: The color to apply to the LEDs.
1609 *
1610 * \param request Control object to request of the device
1611 * \returns Status Code of the request, 0 is OK
1612 */
1614
1615 /**
1616 * \brief An empty animation, clearing any animation in the specified
1617 * slot.
1618 *
1619 * \details
1620 *
1621 * - EmptyAnimation Parameters:
1622 * - Slot: The slot of this animation, within [0, 7]. Each slot on the CANdle can
1623 * store and run one animation.
1624 *
1625 * \param request Control object to request of the device
1626 * \returns Status Code of the request, 0 is OK
1627 */
1629
1630 /**
1631 * \brief Animation that gradually lights the entire LED strip one LED
1632 * at a time.
1633 *
1634 * \details
1635 *
1636 * - ColorFlowAnimation Parameters:
1637 * - LEDStartIndex: The index of the first LED this animation controls
1638 * (inclusive). Indices 0-7 control the onboard LEDs, and 8-399
1639 * control an attached LED strip
1640 *
1641 * If the start index is greater than the end index, the
1642 * direction will be reversed. The direction can also be changed
1643 * using the Direction parameter.
1644 * - LEDEndIndex: The index of the last LED this animation controls (inclusive).
1645 * Indices 0-7 control the onboard LEDs, and 8-399 control an
1646 * attached LED strip.
1647 *
1648 * If the end index is less than the start index, the direction
1649 * will be reversed. The direction can also be changed using the
1650 * Direction parameter.
1651 * - Slot: The slot of this animation, within [0, 7]. Each slot on the CANdle can
1652 * store and run one animation.
1653 * - Color: The color to use in the animation.
1654 * - Direction: The direction of the animation.
1655 * - FrameRate: The frame rate of the animation, from [2, 1000] Hz. This
1656 * determines the speed of the animation.
1657 *
1658 * A frame is defined as a transition in the state of the LEDs,
1659 * turning one on or off.
1660 *
1661 * \param request Control object to request of the device
1662 * \returns Status Code of the request, 0 is OK
1663 */
1665
1666 /**
1667 * \brief Animation that looks similar to a flame flickering.
1668 *
1669 * \details
1670 *
1671 * - FireAnimation Parameters:
1672 * - LEDStartIndex: The index of the first LED this animation controls
1673 * (inclusive). Indices 0-7 control the onboard LEDs, and 8-399
1674 * control an attached LED strip
1675 *
1676 * If the start index is greater than the end index, the
1677 * direction will be reversed. The direction can also be changed
1678 * using the Direction parameter.
1679 * - LEDEndIndex: The index of the last LED this animation controls (inclusive).
1680 * Indices 0-7 control the onboard LEDs, and 8-399 control an
1681 * attached LED strip.
1682 *
1683 * If the end index is less than the start index, the direction
1684 * will be reversed. The direction can also be changed using the
1685 * Direction parameter.
1686 * - Slot: The slot of this animation, within [0, 7]. Each slot on the CANdle can
1687 * store and run one animation.
1688 * - Brightness: The brightness of the animation, as a scalar from 0.0 to 1.0.
1689 * - Direction: The direction of the animation.
1690 * - Sparking: The proportion of time in which sparks reignite the fire, as a
1691 * scalar from 0.0 to 1.0.
1692 * - Cooling: The rate at which the fire cools along the travel, as a scalar from
1693 * 0.0 to 1.0.
1694 * - FrameRate: The frame rate of the animation, from [2, 1000] Hz. This
1695 * determines the speed of the animation.
1696 *
1697 * A frame is defined as a transition in the state of the LEDs,
1698 * advancing the animation of the fire.
1699 *
1700 * \param request Control object to request of the device
1701 * \returns Status Code of the request, 0 is OK
1702 */
1704
1705 /**
1706 * \brief Animation that bounces a pocket of light across the LED
1707 * strip.
1708 *
1709 * \details
1710 *
1711 * - LarsonAnimation Parameters:
1712 * - LEDStartIndex: The index of the first LED this animation controls
1713 * (inclusive). Indices 0-7 control the onboard LEDs, and 8-399
1714 * control an attached LED strip.
1715 * - LEDEndIndex: The index of the last LED this animation controls (inclusive).
1716 * Indices 0-7 control the onboard LEDs, and 8-399 control an
1717 * attached LED strip.
1718 * - Slot: The slot of this animation, within [0, 7]. Each slot on the CANdle can
1719 * store and run one animation.
1720 * - Color: The color to use in the animation.
1721 * - Size: The number of LEDs in the pocket of light, up to 15.
1722 * - BounceMode: The behavior of the pocket of light when it reaches the end of
1723 * the strip.
1724 * - FrameRate: The frame rate of the animation, from [2, 1000] Hz. This
1725 * determines the speed of the animation.
1726 *
1727 * A frame is defined as a transition in the state of the LEDs,
1728 * advancing the pocket of light by one LED.
1729 *
1730 * \param request Control object to request of the device
1731 * \returns Status Code of the request, 0 is OK
1732 */
1734
1735 /**
1736 * \brief Animation that creates a rainbow throughout all the LEDs.
1737 *
1738 * \details
1739 *
1740 * - RainbowAnimation Parameters:
1741 * - LEDStartIndex: The index of the first LED this animation controls
1742 * (inclusive). Indices 0-7 control the onboard LEDs, and 8-399
1743 * control an attached LED strip
1744 *
1745 * If the start index is greater than the end index, the
1746 * direction will be reversed. The direction can also be changed
1747 * using the Direction parameter.
1748 * - LEDEndIndex: The index of the last LED this animation controls (inclusive).
1749 * Indices 0-7 control the onboard LEDs, and 8-399 control an
1750 * attached LED strip.
1751 *
1752 * If the end index is less than the start index, the direction
1753 * will be reversed. The direction can also be changed using the
1754 * Direction parameter.
1755 * - Slot: The slot of this animation, within [0, 7]. Each slot on the CANdle can
1756 * store and run one animation.
1757 * - Brightness: The brightness of the animation, as a scalar from 0.0 to 1.0.
1758 * - Direction: The direction of the animation.
1759 * - FrameRate: The frame rate of the animation, from [2, 1000] Hz. This
1760 * determines the speed of the animation.
1761 *
1762 * A frame is defined as a transition in the state of the LEDs,
1763 * advancing the rainbow by about 3 degrees of hue (out of 360
1764 * degrees).
1765 *
1766 * \param request Control object to request of the device
1767 * \returns Status Code of the request, 0 is OK
1768 */
1770
1771 /**
1772 * \brief Animation that fades all the LEDs of a strip simultaneously
1773 * between Red, Green, and Blue.
1774 *
1775 * \details
1776 *
1777 * - RgbFadeAnimation Parameters:
1778 * - LEDStartIndex: The index of the first LED this animation controls
1779 * (inclusive). Indices 0-7 control the onboard LEDs, and 8-399
1780 * control an attached LED strip.
1781 * - LEDEndIndex: The index of the last LED this animation controls (inclusive).
1782 * Indices 0-7 control the onboard LEDs, and 8-399 control an
1783 * attached LED strip.
1784 * - Slot: The slot of this animation, within [0, 7]. Each slot on the CANdle can
1785 * store and run one animation.
1786 * - Brightness: The brightness of the animation, as a scalar from 0.0 to 1.0.
1787 * - FrameRate: The frame rate of the animation, from [2, 1000] Hz. This
1788 * determines the speed of the animation.
1789 *
1790 * A frame is defined as a transition in the state of the LEDs,
1791 * adjusting the brightness of the LEDs by 1%.
1792 *
1793 * \param request Control object to request of the device
1794 * \returns Status Code of the request, 0 is OK
1795 */
1797
1798 /**
1799 * \brief Animation that fades into and out of a specified color.
1800 *
1801 * \details
1802 *
1803 * - SingleFadeAnimation Parameters:
1804 * - LEDStartIndex: The index of the first LED this animation controls
1805 * (inclusive). Indices 0-7 control the onboard LEDs, and 8-399
1806 * control an attached LED strip.
1807 * - LEDEndIndex: The index of the last LED this animation controls (inclusive).
1808 * Indices 0-7 control the onboard LEDs, and 8-399 control an
1809 * attached LED strip.
1810 * - Slot: The slot of this animation, within [0, 7]. Each slot on the CANdle can
1811 * store and run one animation.
1812 * - Color: The color to use in the animation.
1813 * - FrameRate: The frame rate of the animation, from [2, 1000] Hz. This
1814 * determines the speed of the animation.
1815 *
1816 * A frame is defined as a transition in the state of the LEDs,
1817 * adjusting the brightness of the LEDs by 1%.
1818 *
1819 * \param request Control object to request of the device
1820 * \returns Status Code of the request, 0 is OK
1821 */
1823
1824 /**
1825 * \brief Animation that strobes the LEDs a specified color.
1826 *
1827 * \details
1828 *
1829 * - StrobeAnimation Parameters:
1830 * - LEDStartIndex: The index of the first LED this animation controls
1831 * (inclusive). Indices 0-7 control the onboard LEDs, and 8-399
1832 * control an attached LED strip.
1833 * - LEDEndIndex: The index of the last LED this animation controls (inclusive).
1834 * Indices 0-7 control the onboard LEDs, and 8-399 control an
1835 * attached LED strip.
1836 * - Slot: The slot of this animation, within [0, 7]. Each slot on the CANdle can
1837 * store and run one animation.
1838 * - Color: The color to use in the animation.
1839 * - FrameRate: The frame rate of the animation, from [1, 500] Hz. This
1840 * determines the speed of the animation.
1841 *
1842 * A frame is defined as a transition in the state of the LEDs,
1843 * turning all LEDs on or off.
1844 *
1845 * \param request Control object to request of the device
1846 * \returns Status Code of the request, 0 is OK
1847 */
1849
1850 /**
1851 * \brief Animation that randomly turns LEDs on and off to a certain
1852 * color.
1853 *
1854 * \details
1855 *
1856 * - TwinkleAnimation Parameters:
1857 * - LEDStartIndex: The index of the first LED this animation controls
1858 * (inclusive). Indices 0-7 control the onboard LEDs, and 8-399
1859 * control an attached LED strip.
1860 * - LEDEndIndex: The index of the last LED this animation controls (inclusive).
1861 * Indices 0-7 control the onboard LEDs, and 8-399 control an
1862 * attached LED strip.
1863 * - Slot: The slot of this animation, within [0, 7]. Each slot on the CANdle can
1864 * store and run one animation.
1865 * - Color: The color to use in the animation.
1866 * - MaxLEDsOnProportion: The max proportion of LEDs that can be on, in the range
1867 * [0.1, 1.0].
1868 * - FrameRate: The frame rate of the animation, from [2, 1000] Hz. This
1869 * determines the speed of the animation.
1870 *
1871 * A frame is defined as a transition in the state of the LEDs,
1872 * turning one on or off.
1873 *
1874 * \param request Control object to request of the device
1875 * \returns Status Code of the request, 0 is OK
1876 */
1878
1879 /**
1880 * \brief Animation that randomly turns on LEDs until it reaches the
1881 * maximum count, and then turns them all off.
1882 *
1883 * \details
1884 *
1885 * - TwinkleOffAnimation Parameters:
1886 * - LEDStartIndex: The index of the first LED this animation controls
1887 * (inclusive). Indices 0-7 control the onboard LEDs, and 8-399
1888 * control an attached LED strip.
1889 * - LEDEndIndex: The index of the last LED this animation controls (inclusive).
1890 * Indices 0-7 control the onboard LEDs, and 8-399 control an
1891 * attached LED strip.
1892 * - Slot: The slot of this animation, within [0, 7]. Each slot on the CANdle can
1893 * store and run one animation.
1894 * - Color: The color to use in the animation.
1895 * - MaxLEDsOnProportion: The max proportion of LEDs that can be on, in the range
1896 * [0.1, 1.0].
1897 * - FrameRate: The frame rate of the animation, from [2, 1000] Hz. This
1898 * determines the speed of the animation.
1899 *
1900 * A frame is defined as a transition in the state of the LEDs,
1901 * turning one LED on or all LEDs off.
1902 *
1903 * \param request Control object to request of the device
1904 * \returns Status Code of the request, 0 is OK
1905 */
1907
1908 /**
1909 * \brief Control device with generic control request object. User must make
1910 * sure the specified object is castable to a valid control request,
1911 * otherwise this function will fail at run-time and return the NotSupported
1912 * StatusCode
1913 *
1914 * \param request Control object to request of the device
1915 * \returns Status Code of the request, 0 is OK
1916 */
1918 {
1919 controls::ControlRequest const *ptr = &request;
1920 (void)ptr;
1921 auto const *ModulateVBatOutValue = dynamic_cast<controls::ModulateVBatOut const *>(ptr);
1922 if (ModulateVBatOutValue != nullptr)
1923 return SetControl(*ModulateVBatOutValue);
1924 auto const *SolidColorValue = dynamic_cast<controls::SolidColor const *>(ptr);
1925 if (SolidColorValue != nullptr)
1926 return SetControl(*SolidColorValue);
1927 auto const *EmptyAnimationValue = dynamic_cast<controls::EmptyAnimation const *>(ptr);
1928 if (EmptyAnimationValue != nullptr)
1929 return SetControl(*EmptyAnimationValue);
1930 auto const *ColorFlowAnimationValue = dynamic_cast<controls::ColorFlowAnimation const *>(ptr);
1931 if (ColorFlowAnimationValue != nullptr)
1932 return SetControl(*ColorFlowAnimationValue);
1933 auto const *FireAnimationValue = dynamic_cast<controls::FireAnimation const *>(ptr);
1934 if (FireAnimationValue != nullptr)
1935 return SetControl(*FireAnimationValue);
1936 auto const *LarsonAnimationValue = dynamic_cast<controls::LarsonAnimation const *>(ptr);
1937 if (LarsonAnimationValue != nullptr)
1938 return SetControl(*LarsonAnimationValue);
1939 auto const *RainbowAnimationValue = dynamic_cast<controls::RainbowAnimation const *>(ptr);
1940 if (RainbowAnimationValue != nullptr)
1941 return SetControl(*RainbowAnimationValue);
1942 auto const *RgbFadeAnimationValue = dynamic_cast<controls::RgbFadeAnimation const *>(ptr);
1943 if (RgbFadeAnimationValue != nullptr)
1944 return SetControl(*RgbFadeAnimationValue);
1945 auto const *SingleFadeAnimationValue = dynamic_cast<controls::SingleFadeAnimation const *>(ptr);
1946 if (SingleFadeAnimationValue != nullptr)
1947 return SetControl(*SingleFadeAnimationValue);
1948 auto const *StrobeAnimationValue = dynamic_cast<controls::StrobeAnimation const *>(ptr);
1949 if (StrobeAnimationValue != nullptr)
1950 return SetControl(*StrobeAnimationValue);
1951 auto const *TwinkleAnimationValue = dynamic_cast<controls::TwinkleAnimation const *>(ptr);
1952 if (TwinkleAnimationValue != nullptr)
1953 return SetControl(*TwinkleAnimationValue);
1954 auto const *TwinkleOffAnimationValue = dynamic_cast<controls::TwinkleOffAnimation const *>(ptr);
1955 if (TwinkleOffAnimationValue != nullptr)
1956 return SetControl(*TwinkleOffAnimationValue);
1958 }
1959
1960
1961 /**
1962 * \brief Clear the sticky faults in the device.
1963 *
1964 * \details This typically has no impact on the device functionality.
1965 * Instead, it just clears telemetry faults that are accessible via
1966 * API and Tuner Self-Test.
1967 *
1968 * \param timeoutSeconds Maximum time to wait up to in seconds.
1969 * \returns StatusCode of the set command
1970 */
1971 ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
1972 {
1973 return GetConfigurator().ClearStickyFaults(timeoutSeconds);
1974 }
1975 /**
1976 * \brief Clear the sticky faults in the device.
1977 *
1978 * \details This typically has no impact on the device functionality.
1979 * Instead, it just clears telemetry faults that are accessible via
1980 * API and Tuner Self-Test.
1981 *
1982 * This will wait up to 0.100 seconds (100ms) by default.
1983 *
1984 * \returns StatusCode of the set command
1985 */
1990
1991 /**
1992 * \brief Clear sticky fault: Hardware fault occurred
1993 *
1994 * \param timeoutSeconds Maximum time to wait up to in seconds.
1995 * \returns StatusCode of the set command
1996 */
1997 ctre::phoenix::StatusCode ClearStickyFault_Hardware(units::time::second_t timeoutSeconds)
1998 {
1999 return GetConfigurator().ClearStickyFault_Hardware(timeoutSeconds);
2000 }
2001 /**
2002 * \brief Clear sticky fault: Hardware fault occurred
2003 *
2004 * This will wait up to 0.100 seconds (100ms) by default.
2005 *
2006 * \returns StatusCode of the set command
2007 */
2012
2013 /**
2014 * \brief Clear sticky fault: Device supply voltage dropped to near
2015 * brownout levels
2016 *
2017 * \param timeoutSeconds Maximum time to wait up to in seconds.
2018 * \returns StatusCode of the set command
2019 */
2020 ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(units::time::second_t timeoutSeconds)
2021 {
2022 return GetConfigurator().ClearStickyFault_Undervoltage(timeoutSeconds);
2023 }
2024 /**
2025 * \brief Clear sticky fault: Device supply voltage dropped to near
2026 * brownout levels
2027 *
2028 * This will wait up to 0.100 seconds (100ms) by default.
2029 *
2030 * \returns StatusCode of the set command
2031 */
2036
2037 /**
2038 * \brief Clear sticky fault: Device boot while detecting the enable
2039 * signal
2040 *
2041 * \param timeoutSeconds Maximum time to wait up to in seconds.
2042 * \returns StatusCode of the set command
2043 */
2045 {
2046 return GetConfigurator().ClearStickyFault_BootDuringEnable(timeoutSeconds);
2047 }
2048 /**
2049 * \brief Clear sticky fault: Device boot while detecting the enable
2050 * signal
2051 *
2052 * This will wait up to 0.100 seconds (100ms) by default.
2053 *
2054 * \returns StatusCode of the set command
2055 */
2060
2061 /**
2062 * \brief Clear sticky fault: An unlicensed feature is in use, device
2063 * may not behave as expected.
2064 *
2065 * \param timeoutSeconds Maximum time to wait up to in seconds.
2066 * \returns StatusCode of the set command
2067 */
2069 {
2071 }
2072 /**
2073 * \brief Clear sticky fault: An unlicensed feature is in use, device
2074 * may not behave as expected.
2075 *
2076 * This will wait up to 0.100 seconds (100ms) by default.
2077 *
2078 * \returns StatusCode of the set command
2079 */
2084
2085 /**
2086 * \brief Clear sticky fault: Device supply voltage is too high (above
2087 * 30 V).
2088 *
2089 * \param timeoutSeconds Maximum time to wait up to in seconds.
2090 * \returns StatusCode of the set command
2091 */
2092 ctre::phoenix::StatusCode ClearStickyFault_Overvoltage(units::time::second_t timeoutSeconds)
2093 {
2094 return GetConfigurator().ClearStickyFault_Overvoltage(timeoutSeconds);
2095 }
2096 /**
2097 * \brief Clear sticky fault: Device supply voltage is too high (above
2098 * 30 V).
2099 *
2100 * This will wait up to 0.100 seconds (100ms) by default.
2101 *
2102 * \returns StatusCode of the set command
2103 */
2108
2109 /**
2110 * \brief Clear sticky fault: Device 5V line is too high (above 6 V).
2111 *
2112 * \param timeoutSeconds Maximum time to wait up to in seconds.
2113 * \returns StatusCode of the set command
2114 */
2115 ctre::phoenix::StatusCode ClearStickyFault_5VTooHigh(units::time::second_t timeoutSeconds)
2116 {
2117 return GetConfigurator().ClearStickyFault_5VTooHigh(timeoutSeconds);
2118 }
2119 /**
2120 * \brief Clear sticky fault: Device 5V line is too high (above 6 V).
2121 *
2122 * This will wait up to 0.100 seconds (100ms) by default.
2123 *
2124 * \returns StatusCode of the set command
2125 */
2130
2131 /**
2132 * \brief Clear sticky fault: Device 5V line is too low (below 4 V).
2133 *
2134 * \param timeoutSeconds Maximum time to wait up to in seconds.
2135 * \returns StatusCode of the set command
2136 */
2137 ctre::phoenix::StatusCode ClearStickyFault_5VTooLow(units::time::second_t timeoutSeconds)
2138 {
2139 return GetConfigurator().ClearStickyFault_5VTooLow(timeoutSeconds);
2140 }
2141 /**
2142 * \brief Clear sticky fault: Device 5V line is too low (below 4 V).
2143 *
2144 * This will wait up to 0.100 seconds (100ms) by default.
2145 *
2146 * \returns StatusCode of the set command
2147 */
2152
2153 /**
2154 * \brief Clear sticky fault: Device temperature exceeded limit.
2155 *
2156 * \param timeoutSeconds Maximum time to wait up to in seconds.
2157 * \returns StatusCode of the set command
2158 */
2159 ctre::phoenix::StatusCode ClearStickyFault_Thermal(units::time::second_t timeoutSeconds)
2160 {
2161 return GetConfigurator().ClearStickyFault_Thermal(timeoutSeconds);
2162 }
2163 /**
2164 * \brief Clear sticky fault: Device temperature exceeded limit.
2165 *
2166 * This will wait up to 0.100 seconds (100ms) by default.
2167 *
2168 * \returns StatusCode of the set command
2169 */
2174
2175 /**
2176 * \brief Clear sticky fault: CANdle output current exceeded the 6 A
2177 * limit.
2178 *
2179 * \param timeoutSeconds Maximum time to wait up to in seconds.
2180 * \returns StatusCode of the set command
2181 */
2182 ctre::phoenix::StatusCode ClearStickyFault_SoftwareFuse(units::time::second_t timeoutSeconds)
2183 {
2184 return GetConfigurator().ClearStickyFault_SoftwareFuse(timeoutSeconds);
2185 }
2186 /**
2187 * \brief Clear sticky fault: CANdle output current exceeded the 6 A
2188 * limit.
2189 *
2190 * This will wait up to 0.100 seconds (100ms) by default.
2191 *
2192 * \returns StatusCode of the set command
2193 */
2198
2199 /**
2200 * \brief Clear sticky fault: CANdle has detected the output pin is
2201 * shorted.
2202 *
2203 * \param timeoutSeconds Maximum time to wait up to in seconds.
2204 * \returns StatusCode of the set command
2205 */
2206 ctre::phoenix::StatusCode ClearStickyFault_ShortCircuit(units::time::second_t timeoutSeconds)
2207 {
2208 return GetConfigurator().ClearStickyFault_ShortCircuit(timeoutSeconds);
2209 }
2210 /**
2211 * \brief Clear sticky fault: CANdle has detected the output pin is
2212 * shorted.
2213 *
2214 * This will wait up to 0.100 seconds (100ms) by default.
2215 *
2216 * \returns StatusCode of the set command
2217 */
2222};
2223
2224}
2225}
2226
2227}
2228}
2229
ii that the Software will be uninterrupted or error free
Definition CTRE_LICENSE.txt:251
CTREXPORT int c_ctre_phoenix6_serialize_double(int spn, double value, char **str)
Class for getting information about an available CAN bus.
Definition CANBus.hpp:19
Represents a status signal with data of type T, and operations available to retrieve information abou...
Definition StatusSignal.hpp:656
Class for CTR Electronics' CANdle® branded device, a device that controls LEDs over the CAN bus.
Definition CoreCANdle.hpp:50
bool FutureProofConfigs
True if we should factory default newer unsupported configs, false to leave newer unsupported configs...
Definition CoreCANdle.hpp:67
CANdleFeaturesConfigs CANdleFeatures
Configs related to general CANdle features.
Definition CoreCANdle.hpp:111
constexpr CANdleConfiguration & WithLED(LEDConfigs newLED)
Modifies this configuration's LED parameter and returns itself for method-chaining and easier to use ...
Definition CoreCANdle.hpp:155
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize)
Take a string and deserialize it to this configuration.
Definition CoreCANdle.hpp:214
LEDConfigs LED
Configs related to CANdle LED control.
Definition CoreCANdle.hpp:96
std::string ToString() const
Get the string representation of this configuration.
Definition CoreCANdle.hpp:189
std::string Serialize() const
Get the serialized form of this configuration.
Definition CoreCANdle.hpp:202
constexpr CANdleConfiguration & WithCustomParams(CustomParamsConfigs newCustomParams)
Modifies this configuration's CustomParams parameter and returns itself for method-chaining and easie...
Definition CoreCANdle.hpp:130
constexpr CANdleConfiguration & WithCANdleFeatures(CANdleFeaturesConfigs newCANdleFeatures)
Modifies this configuration's CANdleFeatures parameter and returns itself for method-chaining and eas...
Definition CoreCANdle.hpp:180
CustomParamsConfigs CustomParams
Custom Params.
Definition CoreCANdle.hpp:81
Class for CTR Electronics' CANdle® branded device, a device that controls LEDs over the CAN bus.
Definition CoreCANdle.hpp:231
ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdle.hpp:343
ctre::phoenix::StatusCode ClearStickyFault_5VTooHigh()
Clear sticky fault: Device 5V line is too high (above 6 V).
Definition CoreCANdle.hpp:734
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable(units::time::second_t timeoutSeconds)
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANdle.hpp:635
ctre::phoenix::StatusCode ClearStickyFault_Overvoltage(units::time::second_t timeoutSeconds)
Clear sticky fault: Device supply voltage is too high (above 30 V).
Definition CoreCANdle.hpp:713
ctre::phoenix::StatusCode Apply(const LEDConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANdle.hpp:417
ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdle.hpp:325
ctre::phoenix::StatusCode Refresh(LEDConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdle.hpp:372
ctre::phoenix::StatusCode ClearStickyFault_SoftwareFuse()
Clear sticky fault: CANdle output current exceeded the 6 A limit.
Definition CoreCANdle.hpp:846
ctre::phoenix::StatusCode ClearStickyFault_Thermal()
Clear sticky fault: Device temperature exceeded limit.
Definition CoreCANdle.hpp:808
ctre::phoenix::StatusCode Refresh(CANdleConfiguration &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdle.hpp:264
ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
Clear the sticky faults in the device.
Definition CoreCANdle.hpp:520
ctre::phoenix::StatusCode ClearStickyFault_Overvoltage()
Clear sticky fault: Device supply voltage is too high (above 30 V).
Definition CoreCANdle.hpp:696
ctre::phoenix::StatusCode ClearStickyFault_Thermal(units::time::second_t timeoutSeconds)
Clear sticky fault: Device temperature exceeded limit.
Definition CoreCANdle.hpp:824
ctre::phoenix::StatusCode ClearStickyFault_ShortCircuit()
Clear sticky fault: CANdle has detected the output pin is shorted.
Definition CoreCANdle.hpp:885
ctre::phoenix::StatusCode Refresh(CANdleConfiguration &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdle.hpp:250
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage()
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANdle.hpp:579
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse()
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANdle.hpp:657
ctre::phoenix::StatusCode ClearStickyFault_5VTooLow(units::time::second_t timeoutSeconds)
Clear sticky fault: Device 5V line is too low (below 4 V).
Definition CoreCANdle.hpp:787
ctre::phoenix::StatusCode Apply(const CANdleConfiguration &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANdle.hpp:296
ctre::phoenix::StatusCode ClearStickyFault_5VTooHigh(units::time::second_t timeoutSeconds)
Clear sticky fault: Device 5V line is too high (above 6 V).
Definition CoreCANdle.hpp:750
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable()
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANdle.hpp:618
ctre::phoenix::StatusCode Apply(const CANdleFeaturesConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANdle.hpp:477
ctre::phoenix::StatusCode Refresh(CANdleFeaturesConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdle.hpp:445
ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdle.hpp:312
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse(units::time::second_t timeoutSeconds)
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANdle.hpp:674
ctre::phoenix::StatusCode ClearStickyFault_5VTooLow()
Clear sticky fault: Device 5V line is too low (below 4 V).
Definition CoreCANdle.hpp:771
ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANdle.hpp:357
ctre::phoenix::StatusCode ClearStickyFault_Hardware()
Clear sticky fault: Hardware fault occurred.
Definition CoreCANdle.hpp:541
ctre::phoenix::StatusCode ClearStickyFaults()
Clear the sticky faults in the device.
Definition CoreCANdle.hpp:500
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(units::time::second_t timeoutSeconds)
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANdle.hpp:596
ctre::phoenix::StatusCode Refresh(CANdleFeaturesConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdle.hpp:432
ctre::phoenix::StatusCode ClearStickyFault_ShortCircuit(units::time::second_t timeoutSeconds)
Clear sticky fault: CANdle has detected the output pin is shorted.
Definition CoreCANdle.hpp:902
ctre::phoenix::StatusCode ClearStickyFault_Hardware(units::time::second_t timeoutSeconds)
Clear sticky fault: Hardware fault occurred.
Definition CoreCANdle.hpp:557
ctre::phoenix::StatusCode Apply(const CANdleFeaturesConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdle.hpp:463
ctre::phoenix::StatusCode Refresh(LEDConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdle.hpp:385
ctre::phoenix::StatusCode Apply(const LEDConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdle.hpp:403
ctre::phoenix::StatusCode ClearStickyFault_SoftwareFuse(units::time::second_t timeoutSeconds)
Clear sticky fault: CANdle output current exceeded the 6 A limit.
Definition CoreCANdle.hpp:863
ctre::phoenix::StatusCode Apply(const CANdleConfiguration &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdle.hpp:282
Configs related to general CANdle features.
Definition Configs.hpp:6181
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition Configs.hpp:6277
std::string Serialize() const override
Definition Configs.hpp:6267
std::string ToString() const override
Definition Configs.hpp:6257
Custom Params.
Definition Configs.hpp:4576
std::string ToString() const override
Definition Configs.hpp:4645
std::string Serialize() const override
Definition Configs.hpp:4654
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition Configs.hpp:4663
Configs related to CANdle LED control.
Definition Configs.hpp:6060
std::string ToString() const override
Definition Configs.hpp:6140
std::string Serialize() const override
Definition Configs.hpp:6150
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition Configs.hpp:6160
Definition Configurator.hpp:22
ctre::phoenix::StatusCode SetConfigsPrivate(const std::string &serializedString, units::time::second_t timeoutSeconds, bool futureProofConfigs, bool overrideIfDuplicate)
Definition Configurator.hpp:77
ctre::phoenix::StatusCode GetConfigsPrivate(std::string &serializedString, units::time::second_t timeoutSeconds) const
Definition Configurator.hpp:101
units::time::second_t DefaultTimeoutSeconds
The default maximum amount of time to wait for a config.
Definition Configurator.hpp:27
Animation that gradually lights the entire LED strip one LED at a time.
Definition ColorFlowAnimation.hpp:28
Abstract Control Request class that other control requests extend for use.
Definition ControlRequest.hpp:30
An empty animation, clearing any animation in the specified slot.
Definition EmptyAnimation.hpp:26
Animation that looks similar to a flame flickering.
Definition FireAnimation.hpp:28
Animation that bounces a pocket of light across the LED strip.
Definition LarsonAnimation.hpp:28
Modulates the CANdle VBat output to the specified duty cycle.
Definition ModulateVBatOut.hpp:31
Animation that creates a rainbow throughout all the LEDs.
Definition RainbowAnimation.hpp:28
Animation that fades all the LEDs of a strip simultaneously between Red, Green, and Blue.
Definition RgbFadeAnimation.hpp:28
Animation that fades into and out of a specified color.
Definition SingleFadeAnimation.hpp:27
Sets LEDs to a solid color.
Definition SolidColor.hpp:27
Animation that strobes the LEDs a specified color.
Definition StrobeAnimation.hpp:27
Animation that randomly turns LEDs on and off to a certain color.
Definition TwinkleAnimation.hpp:28
Animation that randomly turns on LEDs until it reaches the maximum count, and then turns them all off...
Definition TwinkleOffAnimation.hpp:29
Definition DeviceIdentifier.hpp:19
Parent class for all devices.
Definition ParentDevice.hpp:28
Class for CTR Electronics' CANdle® branded device, a device that controls LEDs over the CAN bus.
Definition CoreCANdle.hpp:921
ctre::phoenix::StatusCode SetControl(const controls::TwinkleAnimation &request)
Animation that randomly turns LEDs on and off to a certain color.
ctre::phoenix::StatusCode SetControl(const controls::StrobeAnimation &request)
Animation that strobes the LEDs a specified color.
StatusSignal< bool > & GetFault_Undervoltage(bool refresh=true)
Device supply voltage dropped to near brownout levels.
configs::CANdleConfigurator & GetConfigurator()
Gets the configurator for this CANdle.
Definition CoreCANdle.hpp:961
ctre::phoenix::StatusCode SetControl(const controls::FireAnimation &request)
Animation that looks similar to a flame flickering.
StatusSignal< bool > & GetIsProLicensed(bool refresh=true)
Whether the device is Phoenix Pro licensed.
StatusSignal< bool > & GetFault_Hardware(bool refresh=true)
Hardware fault occurred.
StatusSignal< units::voltage::volt_t > & GetSupplyVoltage(bool refresh=true)
Measured supply voltage to the CANdle.
ctre::phoenix::StatusCode ClearStickyFault_Overvoltage(units::time::second_t timeoutSeconds)
Clear sticky fault: Device supply voltage is too high (above 30 V).
Definition CoreCANdle.hpp:2092
ctre::phoenix::StatusCode ClearStickyFault_ShortCircuit(units::time::second_t timeoutSeconds)
Clear sticky fault: CANdle has detected the output pin is shorted.
Definition CoreCANdle.hpp:2206
StatusSignal< units::current::ampere_t > & GetOutputCurrent(bool refresh=true)
The measured output current.
StatusSignal< bool > & GetStickyFault_ShortCircuit(bool refresh=true)
CANdle has detected the output pin is shorted.
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage()
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANdle.hpp:2032
StatusSignal< units::temperature::celsius_t > & GetDeviceTemp(bool refresh=true)
The temperature that the CANdle measures itself to be at.
CoreCANdle(int deviceId, std::string canbus="")
Constructs a new CANdle object.
ctre::phoenix::StatusCode SetControl(const controls::EmptyAnimation &request)
An empty animation, clearing any animation in the specified slot.
ctre::phoenix::StatusCode SetControl(const controls::RainbowAnimation &request)
Animation that creates a rainbow throughout all the LEDs.
ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
Clear the sticky faults in the device.
Definition CoreCANdle.hpp:1971
ctre::phoenix::StatusCode ClearStickyFaults()
Clear the sticky faults in the device.
Definition CoreCANdle.hpp:1986
StatusSignal< bool > & GetStickyFault_UnlicensedFeatureInUse(bool refresh=true)
An unlicensed feature is in use, device may not behave as expected.
StatusSignal< bool > & GetFault_Thermal(bool refresh=true)
Device temperature exceeded limit.
ctre::phoenix::StatusCode ClearStickyFault_Hardware(units::time::second_t timeoutSeconds)
Clear sticky fault: Hardware fault occurred.
Definition CoreCANdle.hpp:1997
ctre::phoenix::StatusCode SetControl(const controls::SolidColor &request)
Sets LEDs to a solid color.
StatusSignal< bool > & GetStickyFault_Overvoltage(bool refresh=true)
Device supply voltage is too high (above 30 V).
StatusSignal< int > & GetMaxSimultaneousAnimationCount(bool refresh=true)
The maximum number of simultaneous animations supported by the current version of CANdle firmware.
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse(units::time::second_t timeoutSeconds)
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANdle.hpp:2068
ctre::phoenix::StatusCode SetControl(const controls::LarsonAnimation &request)
Animation that bounces a pocket of light across the LED strip.
ctre::phoenix::StatusCode ClearStickyFault_Hardware()
Clear sticky fault: Hardware fault occurred.
Definition CoreCANdle.hpp:2008
ctre::phoenix::StatusCode ClearStickyFault_5VTooLow()
Clear sticky fault: Device 5V line is too low (below 4 V).
Definition CoreCANdle.hpp:2148
ctre::phoenix::StatusCode SetControl(const controls::TwinkleOffAnimation &request)
Animation that randomly turns on LEDs until it reaches the maximum count, and then turns them all off...
ctre::phoenix::StatusCode SetControl(const controls::ModulateVBatOut &request)
Modulates the CANdle VBat output to the specified duty cycle.
StatusSignal< units::voltage::volt_t > & GetFiveVRailVoltage(bool refresh=true)
The measured voltage of the 5V rail line.
StatusSignal< bool > & GetStickyFault_Hardware(bool refresh=true)
Hardware fault occurred.
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable()
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANdle.hpp:2056
StatusSignal< units::dimensionless::scalar_t > & GetVBatModulation(bool refresh=true)
The applied VBat modulation duty cycle.
ctre::phoenix::StatusCode ClearStickyFault_5VTooHigh(units::time::second_t timeoutSeconds)
Clear sticky fault: Device 5V line is too high (above 6 V).
Definition CoreCANdle.hpp:2115
ctre::phoenix::StatusCode ClearStickyFault_SoftwareFuse()
Clear sticky fault: CANdle output current exceeded the 6 A limit.
Definition CoreCANdle.hpp:2194
CoreCANdle(int deviceId, CANBus canbus)
Constructs a new CANdle object.
Definition CoreCANdle.hpp:950
StatusSignal< bool > & GetFault_UnlicensedFeatureInUse(bool refresh=true)
An unlicensed feature is in use, device may not behave as expected.
StatusSignal< bool > & GetStickyFault_5VTooHigh(bool refresh=true)
Device 5V line is too high (above 6 V).
StatusSignal< bool > & GetFault_Overvoltage(bool refresh=true)
Device supply voltage is too high (above 30 V).
StatusSignal< int > & GetStickyFaultField(bool refresh=true)
Integer representing all (persistent) sticky fault flags reported by the device.
ctre::phoenix::StatusCode ClearStickyFault_Overvoltage()
Clear sticky fault: Device supply voltage is too high (above 30 V).
Definition CoreCANdle.hpp:2104
ctre::phoenix::StatusCode ClearStickyFault_5VTooLow(units::time::second_t timeoutSeconds)
Clear sticky fault: Device 5V line is too low (below 4 V).
Definition CoreCANdle.hpp:2137
ctre::phoenix::StatusCode SetControl(const controls::SingleFadeAnimation &request)
Animation that fades into and out of a specified color.
StatusSignal< int > & GetVersion(bool refresh=true)
Full Version of firmware in device.
StatusSignal< bool > & GetFault_5VTooLow(bool refresh=true)
Device 5V line is too low (below 4 V).
ctre::phoenix::StatusCode ClearStickyFault_Thermal()
Clear sticky fault: Device temperature exceeded limit.
Definition CoreCANdle.hpp:2170
StatusSignal< bool > & GetFault_5VTooHigh(bool refresh=true)
Device 5V line is too high (above 6 V).
StatusSignal< bool > & GetFault_BootDuringEnable(bool refresh=true)
Device boot while detecting the enable signal.
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse()
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANdle.hpp:2080
StatusSignal< bool > & GetStickyFault_Thermal(bool refresh=true)
Device temperature exceeded limit.
StatusSignal< bool > & GetStickyFault_SoftwareFuse(bool refresh=true)
CANdle output current exceeded the 6 A limit.
ctre::phoenix::StatusCode SetControl(const controls::RgbFadeAnimation &request)
Animation that fades all the LEDs of a strip simultaneously between Red, Green, and Blue.
StatusSignal< int > & GetVersionMajor(bool refresh=true)
App Major Version number.
StatusSignal< bool > & GetStickyFault_BootDuringEnable(bool refresh=true)
Device boot while detecting the enable signal.
ctre::phoenix::StatusCode ClearStickyFault_5VTooHigh()
Clear sticky fault: Device 5V line is too high (above 6 V).
Definition CoreCANdle.hpp:2126
ctre::phoenix::StatusCode ClearStickyFault_ShortCircuit()
Clear sticky fault: CANdle has detected the output pin is shorted.
Definition CoreCANdle.hpp:2218
sim::CANdleSimState & GetSimState()
Get the simulation state for this device.
Definition CoreCANdle.hpp:991
StatusSignal< int > & GetVersionBuild(bool refresh=true)
App Build Version number.
ctre::phoenix::StatusCode SetControl(const controls::ControlRequest &request)
Control device with generic control request object.
Definition CoreCANdle.hpp:1917
StatusSignal< int > & GetVersionMinor(bool refresh=true)
App Minor Version number.
StatusSignal< int > & GetFaultField(bool refresh=true)
Integer representing all fault flags reported by the device.
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable(units::time::second_t timeoutSeconds)
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANdle.hpp:2044
ctre::phoenix::StatusCode ClearStickyFault_SoftwareFuse(units::time::second_t timeoutSeconds)
Clear sticky fault: CANdle output current exceeded the 6 A limit.
Definition CoreCANdle.hpp:2182
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(units::time::second_t timeoutSeconds)
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANdle.hpp:2020
StatusSignal< bool > & GetFault_SoftwareFuse(bool refresh=true)
CANdle output current exceeded the 6 A limit.
configs::CANdleConfigurator const & GetConfigurator() const
Gets the configurator for this CANdle.
Definition CoreCANdle.hpp:973
StatusSignal< bool > & GetStickyFault_5VTooLow(bool refresh=true)
Device 5V line is too low (below 4 V).
StatusSignal< bool > & GetFault_ShortCircuit(bool refresh=true)
CANdle has detected the output pin is shorted.
StatusSignal< bool > & GetStickyFault_Undervoltage(bool refresh=true)
Device supply voltage dropped to near brownout levels.
ctre::phoenix::StatusCode SetControl(const controls::ColorFlowAnimation &request)
Animation that gradually lights the entire LED strip one LED at a time.
ctre::phoenix::StatusCode ClearStickyFault_Thermal(units::time::second_t timeoutSeconds)
Clear sticky fault: Device temperature exceeded limit.
Definition CoreCANdle.hpp:2159
StatusSignal< int > & GetVersionBugfix(bool refresh=true)
App Bugfix Version number.
Class to control the state of a simulated hardware::CANdle.
Definition CANdleSimState.hpp:31
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:27
static constexpr int OK
No Error.
Definition StatusCodes.h:34
static constexpr int NotSupported
This is not supported.
Definition StatusCodes.h:652
Definition Diff_PositionDutyCycle_Position.hpp:15
Definition span.hpp:401