FastLED 3.10.6
Loading...
Searching...
No Matches

◆ describe()

fl::size fl::ResetInfo::describe ( fl::span< char > out,
bool verbose = false ) const

Write a single-line human-readable description into the caller's buffer.

Returns the number of bytes written (NOT including any trailing NUL, though a NUL is appended if there is room). Truncates safely if out is too small. Never allocates. Format:

"<cause>" if subcauseId == 0 "<cause> (<sub>)" if subcauseId != 0 && !verbose "<cause> (<sub>) raw=0x<hex>" if verbose

Definition at line 69 of file watchdog.cpp.hpp.

69 {
70 fl::size n = 0;
71 // <cause>
73 // ( <sub> ) if subcauseId != 0
74 if (subcauseId != 0) {
75 fl::string_view sub = subcauseName();
76 if (sub.size() != 0) {
77 n += platforms::writeView(out.subspan(n), fl::string_view(" ("));
78 n += platforms::writeView(out.subspan(n), sub);
79 n += platforms::writeChar(out.subspan(n), ')');
80 }
81 }
82 if (verbose) {
83 n += platforms::writeView(out.subspan(n), fl::string_view(" raw="));
85 }
86 return platforms::writeNulIfRoom(out, n);
87}
span< T, Count > subspan() const FL_NO_EXCEPT
Definition span.h:514
constexpr fl::size size() const FL_NO_EXCEPT
Definition string_view.h:99
fl::size writeNulIfRoom(fl::span< char > out, fl::size written) FL_NO_EXCEPT
fl::size writeChar(fl::span< char > out, char c) FL_NO_EXCEPT
fl::size writeView(fl::span< char > out, fl::string_view sv) FL_NO_EXCEPT
fl::size writeHex(fl::span< char > out, fl::u32 value) FL_NO_EXCEPT
fl::u32 rawRegister
Raw value of the platform's reset-cause register.
Definition watchdog.h:85
fl::string_view subcauseName() const FL_NO_EXCEPT
Platform-specific subcause name (zero-cost, static string_view).
fl::string_view causeName() const FL_NO_EXCEPT
Cause name (zero-cost, static string_view).
Definition watchdog.h:88
fl::u8 subcauseId
Platform-specific subcause id (0 = none)
Definition watchdog.h:84

References causeName(), fl::FL_NO_EXCEPT, rawRegister, fl::string_view::size(), subcauseId, subcauseName(), fl::platforms::writeChar(), fl::platforms::writeHex(), fl::platforms::writeNulIfRoom(), and fl::platforms::writeView().

Referenced by fl::platforms::scopedWatchdogFirstInit().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: