diff options
Diffstat (limited to 'os/various/chprintf.h')
-rw-r--r-- | os/various/chprintf.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/os/various/chprintf.h b/os/various/chprintf.h index 1d758f680..306adc988 100644 --- a/os/various/chprintf.h +++ b/os/various/chprintf.h @@ -25,6 +25,8 @@ #ifndef _CHPRINTF_H_
#define _CHPRINTF_H_
+#include <stdarg.h>
+
/**
* @brief Float type support.
*/
@@ -35,11 +37,42 @@ #ifdef __cplusplus
extern "C" {
#endif
- void chprintf(BaseSequentialStream *chp, const char *fmt, ...);
+ void chvprintf(BaseSequentialStream *chp, const char *fmt, va_list ap);
#ifdef __cplusplus
}
#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 void chprintf(BaseSequentialStream *chp, const char *fmt, ...) {
+ va_list ap;
+
+ va_start(ap, fmt);
+ chvprintf(chp, fmt, ap);
+ va_end(ap);
+}
+
#endif /* _CHPRINTF_H_ */
/** @} */
|