CuVoodoo STM32F1 firmware template
Macros | Functions
print.c File Reference

printing utilities to replace the large printf from the standard library (code) More...

Go to the source code of this file.

Macros

#define CRLF   true
 if CR+LN new line should be enforced
 

Functions

static size_t print_char (char **str, size_t *size, char c)
 print character More...
 
static size_t print_string (char **str, size_t *size, const char *s)
 print string More...
 
static size_t print_unsigned (char **str, size_t *size, uint64_t u, uint8_t padding, bool sign)
 print unsigned number More...
 
static size_t print_signed (char **str, size_t *size, int64_t d, uint8_t padding, bool sign)
 print signed number More...
 
static size_t print_nibble (char **str, size_t *size, uint8_t nibble, bool upcase)
 print nibble (half-byte) More...
 
static size_t print_hex (char **str, size_t *size, uint32_t hex, uint8_t padding, bool prefix, bool upcase)
 print hex value More...
 
static size_t print_bits (char **str, size_t *size, uint32_t u, uint8_t padding, bool prefix)
 print bits More...
 
static size_t vsnprintf (char **str, size_t *size, const char *format, va_list va)
 print format string on string or user output More...
 
size_t printf (const char *format,...)
 print format string on user output More...
 
size_t snprintf (char *str, size_t size, const char *format,...)
 print format string on string or user output More...
 

Detailed Description

printing utilities to replace the large printf from the standard library (code)

Author
King Kévin kingk.nosp@m.evin.nosp@m.@cuvo.nosp@m.odoo.nosp@m..info
Date
2017

Definition in file print.c.

Function Documentation

◆ print_bits()

static size_t print_bits ( char **  str,
size_t *  size,
uint32_t  u,
uint8_t  padding,
bool  prefix 
)
static

print bits

Parameters
[out]strstring to print bits on (use NULL to print on user output)
[in,out]sizesize of string
[in]ubits to be printed
[in]paddingnumber of 0's to pad
[in]prefixif 0b prefix should be printed
Returns
number of characters printed

Definition at line 187 of file print.c.

◆ print_char()

static size_t print_char ( char **  str,
size_t *  size,
char  c 
)
static

print character

Parameters
[out]strstring to print character on (use NULL to print on user output)
[in,out]sizesize of string
[in]ccharacter to be printed
Returns
number of characters printed

Definition at line 41 of file print.c.

◆ print_hex()

static size_t print_hex ( char **  str,
size_t *  size,
uint32_t  hex,
uint8_t  padding,
bool  prefix,
bool  upcase 
)
static

print hex value

Parameters
[out]strstring to print hex on (use NULL to print on user output)
[in,out]sizesize of string
[in]hexhex value to be printed
[in]paddingnumber of 0's to pad
[in]prefixif 0x prefix should be printed
[in]upcaseuse upcase digits (A-F)
Returns
number of characters printed

Definition at line 153 of file print.c.

◆ print_nibble()

static size_t print_nibble ( char **  str,
size_t *  size,
uint8_t  nibble,
bool  upcase 
)
static

print nibble (half-byte)

Parameters
[out]strstring to print nibble on (use NULL to print on user output)
[in,out]sizesize of string
[in]nibblenibble to be printed
[in]upcaseuse upcase digits (A-F)
Returns
number of characters printed

Definition at line 131 of file print.c.

◆ print_signed()

static size_t print_signed ( char **  str,
size_t *  size,
int64_t  d,
uint8_t  padding,
bool  sign 
)
static

print signed number

Parameters
[out]strstring to print signed number on (use NULL to print on user output)
[in,out]sizesize of string
[in]dsigned number to be printed
[in]paddingnumber of 0's to pad
[in]signif sign should be printed
Returns
number of characters printed

Definition at line 113 of file print.c.

◆ print_string()

static size_t print_string ( char **  str,
size_t *  size,
const char *  s 
)
static

print string

Parameters
[out]strstring to print string on (use NULL to print on user output)
[in,out]sizesize of string
[in]sstring to be printed
Returns
number of characters printed

Definition at line 65 of file print.c.

◆ print_unsigned()

static size_t print_unsigned ( char **  str,
size_t *  size,
uint64_t  u,
uint8_t  padding,
bool  sign 
)
static

print unsigned number

Parameters
[out]strstring to print unsigned number on (use NULL to print on user output)
[in,out]sizesize of string
[in]uunsigned number to be printed
[in]paddingnumber of 0's to pad
[in]signif sign should be printed
Returns
number of characters printed

Definition at line 82 of file print.c.

◆ printf()

size_t printf ( const char *  format,
  ... 
)

print format string on user output

Parameters
[in]formatformat string to be printed
[in]...arguments referenced by format string to be printed
Returns
number of characters printed

Definition at line 296 of file print.c.

◆ snprintf()

size_t snprintf ( char *  str,
size_t  size,
const char *  format,
  ... 
)

print format string on string or user output

Parameters
[out]strstring to print format string on, or user output if str is set to NULL (str will always be terminated with a null character '\0')
[in,out]sizesize of string (writes at most size characters on str, including the termination null character '\0')
[in]formatformat string to be printed
[in]...arguments referenced by format string to be printed
Returns
number of characters printed (a return value of size or more means that the output was truncated)

Definition at line 306 of file print.c.

◆ vsnprintf()

static size_t vsnprintf ( char **  str,
size_t *  size,
const char *  format,
va_list  va 
)
static

print format string on string or user output

Parameters
[out]strstring to print format string on, or user output if str is set to NULL (str will always be terminated with a null character '\0')
[in,out]sizesize of string (writes at most size characters on str, including the termination null character '\0')
[in]formatformat string to be printed
[in]vaarguments referenced by format string to be printed
Returns
number of characters printed (a return value of size or more means that the output was truncated)

Definition at line 218 of file print.c.