|
Lazuli
|
printf implementation. More...
#include <stdarg.h>#include <stdint.h>#include <stdio.h>#include <string.h>#include <Lazuli/common.h>#include <Lazuli/config.h>#include <Lazuli/sys/printf.h>Go to the source code of this file.
Functions | |
| static char | GetHexDigit (const uint8_t i, const bool isUpper) |
| Convert a base 16 unit value to its hexadecimal digit representation. | |
| static uint8_t | ConvertU16ToHexadecimal (uint16_t value, char *const buffer, const bool isUpper) |
| Convert an unsigned 16-bit integer to its ASCII hexadecimal representation. | |
| static uint8_t | ConvertU16ToOctal (uint16_t value, char *const buffer) |
| Convert an unsigned 16-bit integer to its ASCII octal representation. | |
| static int | OutputPadding (uint8_t padLength, const uint8_t size, const char padChar, const bool isNegative) |
| Output the padding, according to the selected options. | |
| static void | OutputBuffer (const char *const buffer, const uint8_t size) |
| Output the content of the buffer. | |
| static void | OutputReverseBuffer (const char *const buffer, uint8_t size) |
| Output the content of the buffer in reverse order. | |
| int | printf (const char *format,...) |
| Produce unbuffered formatted output to the serial line. | |
printf implementation.
This file describes the implementation of printf. For now, this module is useless if module SERIAL is not used.
Definition in file printf.c.
Convert a base 16 unit value to its hexadecimal digit representation.
The value must be <= 15.
| i | The value to convert. |
| isUpper | A boolean value indicating if the conversion must be done in uppercase. |
|
static |
Convert an unsigned 16-bit integer to its ASCII hexadecimal representation.
buffer in reverse order and without a final NUL character. The caller of this function then has to use the return value in order to use the characters in the buffer in the right order.| value | The 16-bit input value to convert. |
| buffer | A valid pointer to an allocated buffer of minimum size 4 chars. |
| isUpper | A boolean value indicating if the conversion must be done in uppercase. |
Convert an unsigned 16-bit integer to its ASCII octal representation.
buffer in reverse order and without a final NUL character. The caller of this function then has to use the return value in order to use the characters in the buffer in the right order.| value | The 16-bit input value to convert. |
| buffer | A valid pointer to an allocated buffer of minimum size 6 chars. |
|
static |
Output the padding, according to the selected options.
| padLength | The desired pad length. |
| size | The size of the buffer. |
| padChar | The character to use for padding. |
| isNegative | A boolean value indicating if the value to display is negative. |
|
static |
|
static |
| int printf | ( | const char * | format, |
| ... | |||
| ) |
Produce unbuffered formatted output to the serial line.
This function is fully reentrant.
0 The value should be zero-padded.
A decimal digit string can be used to specify a minimum field width.
The following conversion specifiers are currently allowed:
d, i The int argument is converted to decimal.
u The unsigned int argument is converted to decimal.
% The character '' is output.
| format | The format string. |
| ... | The variadic parameters. |