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