Skip to content
Snippets Groups Projects
Commit d8a843bf authored by Sebastian Meiling's avatar Sebastian Meiling
Browse files

sys,fmt: update and fix docu

parent 65a230d1
No related branches found
No related tags found
No related merge requests found
...@@ -194,12 +194,13 @@ size_t fmt_s16_dec(char *out, int16_t val); ...@@ -194,12 +194,13 @@ size_t fmt_s16_dec(char *out, int16_t val);
* If @p out is NULL, will only return the number of bytes that would have * If @p out is NULL, will only return the number of bytes that would have
* been written. * been written.
* *
* @pre fp_digits < 8 (TENMAP_SIZE)
*
* @param[out] out Pointer to the output buffer, or NULL * @param[out] out Pointer to the output buffer, or NULL
* @param[in] val Fixed point value, MUST be <= 4 * @param[in] val Fixed point value
* @param[in] fp_digits Number of digits after the decimal point * @param[in] fp_digits Number of digits after the decimal point
* *
* @return Length of the resulting string * @return Length of the resulting string
* @return 0 if @p fp_digits is > 4
*/ */
size_t fmt_s16_dfp(char *out, int16_t val, unsigned fp_digits); size_t fmt_s16_dfp(char *out, int16_t val, unsigned fp_digits);
...@@ -222,12 +223,13 @@ size_t fmt_s16_dfp(char *out, int16_t val, unsigned fp_digits); ...@@ -222,12 +223,13 @@ size_t fmt_s16_dfp(char *out, int16_t val, unsigned fp_digits);
* If @p out is NULL, will only return the number of bytes that would have * If @p out is NULL, will only return the number of bytes that would have
* been written. * been written.
* *
* @pre fp_digits < 8 (TENMAP_SIZE)
*
* @param[out] out Pointer to the output buffer, or NULL * @param[out] out Pointer to the output buffer, or NULL
* @param[in] val Fixed point value * @param[in] val Fixed point value
* @param[in] fp_digits Number of digits after the decimal point, MUST be <= 9 * @param[in] fp_digits Number of digits after the decimal point
* *
* @return Length of the resulting string * @return Length of the resulting string
* @return 0 if @p fp_digits is > 9
*/ */
size_t fmt_s32_dfp(char *out, int32_t val, unsigned fp_digits); size_t fmt_s32_dfp(char *out, int32_t val, unsigned fp_digits);
...@@ -236,14 +238,18 @@ size_t fmt_s32_dfp(char *out, int32_t val, unsigned fp_digits); ...@@ -236,14 +238,18 @@ size_t fmt_s32_dfp(char *out, int32_t val, unsigned fp_digits);
* *
* Converts float value @p f to string * Converts float value @p f to string
* *
* @pre -2^32 < f < 2^32 * If @p out is NULL, will only return the number of bytes that would have
* been written.
* *
* @note This function is using floating point math. It pulls in about 2.4k * @attention This function is using floating point math.
* bytes of code on ARM Cortex-M platforms. * It pulls in about 2.4k bytes of code on ARM Cortex-M platforms.
*
* @pre -2^32 < f < 2^32
* @pre precision < 8 (TENMAP_SIZE)
* *
* @param[out] out string to write to (or NULL) * @param[out] out string to write to (or NULL)
* @param[in] f float value to convert * @param[in] f float value to convert
* @param[in] precision number of digits after decimal point (<=7) * @param[in] precision number of digits after decimal point
* *
* @returns nr of bytes the function did or would write to out * @returns nr of bytes the function did or would write to out
*/ */
...@@ -340,18 +346,19 @@ void print_u64_dec(uint64_t val); ...@@ -340,18 +346,19 @@ void print_u64_dec(uint64_t val);
/** /**
* @brief Print float value * @brief Print float value
* *
* @note See fmt_float for code size warning!
*
* @pre -2^32 < f < 2^32 * @pre -2^32 < f < 2^32
* @pre precision < TENMAP_SIZE (== 8)
* *
* @param[in] f float value to print * @param[in] f float value to print
* @param[in] precision number of digits after decimal point (<=7) * @param[in] precision number of digits after decimal point
*/ */
void print_float(float f, unsigned precision); void print_float(float f, unsigned precision);
/** /**
* @brief Print null-terminated string to stdout * @brief Print null-terminated string to stdout
* *
* @note See fmt_float for code size warning!
*
* @param[in] str Pointer to string to print * @param[in] str Pointer to string to print
*/ */
void print_str(const char* str); void print_str(const char* str);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment