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