diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-01-13 02:49:10 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-01-13 02:49:10 +0000 |
commit | cad9ed8e13b1b5e7448f41a71837d0e52ca0ad42 (patch) | |
tree | 78792e9d8701bc3b38f60de71caff9786884c875 /nuttx/lib | |
parent | d455b6a25a41db11963610dca5f4a63eee1a316c (diff) | |
download | px4-nuttx-cad9ed8e13b1b5e7448f41a71837d0e52ca0ad42.tar.gz px4-nuttx-cad9ed8e13b1b5e7448f41a71837d0e52ca0ad42.tar.bz2 px4-nuttx-cad9ed8e13b1b5e7448f41a71837d0e52ca0ad42.zip |
STM32 fixes for F4 32-bit timers
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4300 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/lib')
-rw-r--r-- | nuttx/lib/stdio/lib_libvsprintf.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/nuttx/lib/stdio/lib_libvsprintf.c b/nuttx/lib/stdio/lib_libvsprintf.c index 3bc112e92..341c055c6 100644 --- a/nuttx/lib/stdio/lib_libvsprintf.c +++ b/nuttx/lib/stdio/lib_libvsprintf.c @@ -529,6 +529,21 @@ static int getusize(uint8_t fmt, uint8_t flags, unsigned int n) utoascii(&nulloutstream, fmt, flags, n); return nulloutstream.nput; } + +/**************************************************************************** + * Name: getdblsize + ****************************************************************************/ + +#ifdef CONFIG_LIBC_FLOATINGPOINT +static int getdblsize(uint8_t fmt, int trunc, uint8_t flags, double n) +{ + struct lib_outstream_s nulloutstream; + lib_nulloutstream(&nulloutstream); + + lib_dtoa(&nulloutstream, fmt, trunc, flags, n); + return nulloutstream.nput; +} +#endif #endif /* CONFIG_NOPRINTF_FIELDWIDTH */ #ifdef CONFIG_LONG_IS_NOT_INT @@ -1535,9 +1550,30 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const char *src, va_list a else if (strchr("eEfgG", FMT_CHAR)) { double dblval = va_arg(ap, double); + +#ifndef CONFIG_NOPRINTF_FIELDWIDTH + int dblsize; + + /* Get the width of the output */ + + dblsize = getdblsize(FMT_CHAR, trunc, flags, dblval); + + /* Perform left field justification actions */ + + prejustify(obj, fmt, flags, width, dblsize); +#endif + + /* Output the number */ + lib_dtoa(obj, FMT_CHAR, trunc, flags, dblval); + +#ifndef CONFIG_NOPRINTF_FIELDWIDTH + /* Perform right field justification actions */ + + postjustify(obj, fmt, flags, width, dblsize); } #endif +#endif /* CONFIG_LIBC_FLOATINGPOINT */ } return obj->nput; |