touchgfx::Unicode::snprintfFloat() is only used within TouchGFX.
 
Symbols
loading...
Files
loading...
CodeScopeSTM32 Libraries and SamplesTouchGFXtouchgfx::Unicode::snprintfFloat()

touchgfx::Unicode::snprintfFloat() method

@fn static UnicodeChar* Unicode::snprintfFloat(UnicodeChar* dst, uint16_t dstSize, const char* format, const float value) Variant of snprintf. Variant of snprintf for one float only. The number format supports only one \%f with flags/modifiers. The following is supported: %[flags][width][.precision]f Where flags can be:
'-': left justify the field (see width). '+': force sign. ' ': insert space if value is positive. '\#': insert decimal point even if there are not decimals. '0': left pad with zeros instead of spaces (see width).
Where width is the desired width of the output. If the value is larger, more characters may be generated, but not more than the parameter dstSize. Where precision is the number of number of digits after the decimal point, default is 3. Use "%.f" to not generate any numbers after the decimal point. \code{.cpp} Unicode::UnicodeChar buffer[20]; Unicode::snprintfFloat(buffer, 20, "%6.4f", 3.14159f); // buffer="3.1416" Unicode::snprintfFloat(buffer, 20, "%#6.f", 3.14159f); // buffer=" 3." Unicode::snprintfFloat(buffer, 20, "%6f", 3.14159f); // buffer=" 3.142" Unicode::snprintfFloat(buffer, 20, "%+06.f", 3.14159f); // buffer="+00003" \endcode If more control over the output is needed, see snprintfFloats which can have more than a single "%f" in the string and also supports "*" in place of a number. @warning The format string is internally copied from at char* to a UnicodeChar*. This buffer has a limit of 63 characters, so if the format is longer than 63 characters, the caller must do this copying to prevent an assert from triggering: \code{.cpp} touchgfx::Unicode::UnicodeChar tmpfmt[200]; touchgfx::Unicode::strncpy(tmpfmt, "Very, very, very, very, very, very, very, very, very long format %f", 200); touchgfx::Unicode::snprintfFloats(dst, dstSize, tmpfmt, values); \endcode @see snprintf, snprintfFloats

Syntax

static UnicodeChar* snprintfFloat(UnicodeChar* dst,     uint16_t dstSize,     const char* format,     const float value);

Arguments

dst

dstSize

Size of the dst buffer measured by number of UnicodeChars the buffer can hold.

format

value

The floating point value to insert for %f.

Return value

pointer to the first element in the buffer where the formatted string is placed.

References

LocationText
Unicode.hpp:370
static UnicodeChar* snprintfFloat(UnicodeChar* dst, uint16_t dstSize, const UnicodeChar* format, const float value)
Unicode.hpp:495
static UnicodeChar* snprintfFloat(UnicodeChar* dst, uint16_t dstSize, const char* format, const float value)

Call Tree

Functions called by touchgfx::Unicode::snprintfFloat()
touchgfx::Unicode::snprintfFloat()
Data read by touchgfx::Unicode::snprintfFloat()
touchgfx::Unicode::snprintfFloat()
Type of touchgfx::Unicode::snprintfFloat()
touchgfx::Unicode::snprintfFloat()
all items filtered out