mirror of https://github.com/rusefi/ChibiOS.git
De-inlined chprintf().
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8454 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
af8938572a
commit
fd96d460ff
|
@ -276,6 +276,40 @@ unsigned_common:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief System formatted output function.
|
||||||
|
* @details This function implements a minimal @p printf() like functionality
|
||||||
|
* with output on a @p BaseSequentialStream.
|
||||||
|
* The general parameters format is: %[-][width|*][.precision|*][l|L]p.
|
||||||
|
* The following parameter types (p) are supported:
|
||||||
|
* - <b>x</b> hexadecimal integer.
|
||||||
|
* - <b>X</b> hexadecimal long.
|
||||||
|
* - <b>o</b> octal integer.
|
||||||
|
* - <b>O</b> octal long.
|
||||||
|
* - <b>d</b> decimal signed integer.
|
||||||
|
* - <b>D</b> decimal signed long.
|
||||||
|
* - <b>u</b> decimal unsigned integer.
|
||||||
|
* - <b>U</b> decimal unsigned long.
|
||||||
|
* - <b>c</b> character.
|
||||||
|
* - <b>s</b> string.
|
||||||
|
* .
|
||||||
|
*
|
||||||
|
* @param[in] chp pointer to a @p BaseSequentialStream implementing object
|
||||||
|
* @param[in] fmt formatting string
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
int chprintf(BaseSequentialStream *chp, const char *fmt, ...) {
|
||||||
|
va_list ap;
|
||||||
|
int formatted_bytes;
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
formatted_bytes = chvprintf(chp, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
return formatted_bytes;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief System formatted output function.
|
* @brief System formatted output function.
|
||||||
* @details This function implements a minimal @p vprintf()-like functionality
|
* @details This function implements a minimal @p vprintf()-like functionality
|
||||||
|
|
|
@ -38,45 +38,12 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
int chvprintf(BaseSequentialStream *chp, const char *fmt, va_list ap);
|
int chvprintf(BaseSequentialStream *chp, const char *fmt, va_list ap);
|
||||||
|
int chprintf(BaseSequentialStream *chp, const char *fmt, ...);
|
||||||
int chsnprintf(char *str, size_t size, const char *fmt, ...);
|
int chsnprintf(char *str, size_t size, const char *fmt, ...);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief System formatted output function.
|
|
||||||
* @details This function implements a minimal @p printf() like functionality
|
|
||||||
* with output on a @p BaseSequentialStream.
|
|
||||||
* The general parameters format is: %[-][width|*][.precision|*][l|L]p.
|
|
||||||
* The following parameter types (p) are supported:
|
|
||||||
* - <b>x</b> hexadecimal integer.
|
|
||||||
* - <b>X</b> hexadecimal long.
|
|
||||||
* - <b>o</b> octal integer.
|
|
||||||
* - <b>O</b> octal long.
|
|
||||||
* - <b>d</b> decimal signed integer.
|
|
||||||
* - <b>D</b> decimal signed long.
|
|
||||||
* - <b>u</b> decimal unsigned integer.
|
|
||||||
* - <b>U</b> decimal unsigned long.
|
|
||||||
* - <b>c</b> character.
|
|
||||||
* - <b>s</b> string.
|
|
||||||
* .
|
|
||||||
*
|
|
||||||
* @param[in] chp pointer to a @p BaseSequentialStream implementing object
|
|
||||||
* @param[in] fmt formatting string
|
|
||||||
*
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
static inline int chprintf(BaseSequentialStream *chp, const char *fmt, ...) {
|
|
||||||
va_list ap;
|
|
||||||
int formatted_bytes;
|
|
||||||
|
|
||||||
va_start(ap, fmt);
|
|
||||||
formatted_bytes = chvprintf(chp, fmt, ap);
|
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
return formatted_bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _CHPRINTF_H_ */
|
#endif /* _CHPRINTF_H_ */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
Loading…
Reference in New Issue