FastLED 3.9.15
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 68 of file watchdog.cpp.hpp.

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

References causeName(), FL_NOEXCEPT, 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: