Macros | Functions
printf.h File Reference
`#include <stdarg.h>`
`#include <stddef.h>`

Go to the source code of this file.

## Macros
#define | printf printf_
#define | sprintf sprintf_
#define | snprintf snprintf_
#define | vsnprintf vsnprintf_
#define | vprintf vprintf_

## Functions
void | _putchar (char character)
int | printf_ (const char *format,...)
int | sprintf_ (char *buffer, const char *format,...)
int | snprintf_ (char *buffer, size_t count, const char *format,...)
int | vsnprintf_ (char *buffer, size_t count, const char *format, va_list va)
int | vprintf_ (const char *format, va_list va)
int | fctprintf (void(*out)(char character, void *arg), void *arg, const char *format,...)
int | fctvprintf (void(*out)(char character, void *arg), void *arg, const char *format, va_list va)

## Macro Definition Documentation

## ◆ printf

#define printf printf_

Tiny printf implementation You have to implement putchar if you use printf() To avoid conflicts with the regular printf() API it is overridden by macro defines and internal underscore-appended functions like printf() are used

Parameters

  format | A string that specifies the format of the output

Returns
  The number of characters that are written into the array, not counting the terminating null character

Examples
  acc_processing_helpers.c, example_bring_up.c, example_control_helper.c, example_detector_distance.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, example_detector_presence.c, example_detector_presence_low_power_hibernate.c, example_detector_presence_low_power_off.c, example_detector_presence_multiple_configurations.c, example_diagnostic_test.c, example_processing_amplitude.c, example_processing_coherent_mean.c, example_processing_noncoherent_mean.c, example_processing_peak_interpolation.c, example_processing_static_presence.c, example_processing_subtract_adaptive_bg.c, example_service.c, example_service_low_power_sensor_disable.c, example_service_low_power_sensor_hibernate.c, example_service_multiple_configurations.c, example_service_sensor_disable.c, example_service_sensor_hibernate.c, example_service_sensor_off.c, example_service_subsweeps.c, and ref_app_tank_level.c.

Definition at line 60 of file printf.h.

## ◆ snprintf

#define snprintf snprintf_

Tiny snprintf/vsnprintf implementation

Parameters

  buffer | A pointer to the buffer where to store the formatted string
  count | The maximum number of characters to store in the buffer, including a terminating null character
  format | A string that specifies the format of the output
  va | A value identifying a variable arguments list

Returns
  The number of characters that are WRITTEN into the buffer, not counting the terminating null character If the formatted string is truncated the buffer size (count) is returned

Examples
  acc_processing_helpers.c, example_control_helper.c, example_service.c, example_service_low_power_sensor_disable.c, example_service_low_power_sensor_hibernate.c, example_service_multiple_configurations.c, example_service_sensor_disable.c, example_service_sensor_hibernate.c, example_service_sensor_off.c, and example_service_subsweeps.c.

Definition at line 84 of file printf.h.

## ◆ sprintf

#define sprintf sprintf_

Tiny sprintf implementation Due to security reasons (buffer overflow) YOU SHOULD CONSIDER USING (V)SNPRINTF INSTEAD!

Parameters

  buffer | A pointer to the buffer where to store the formatted string. MUST be big enough to store the output!
  format | A string that specifies the format of the output

Returns
  The number of characters that are WRITTEN into the buffer, not counting the terminating null character

Definition at line 71 of file printf.h.

## ◆ vprintf

#define vprintf vprintf_

Tiny vprintf implementation

Parameters

  format | A string that specifies the format of the output
  va | A value identifying a variable arguments list

Returns
  The number of characters that are WRITTEN into the buffer, not counting the terminating null character

Definition at line 96 of file printf.h.

## ◆ vsnprintf

#define vsnprintf vsnprintf_

Definition at line 85 of file printf.h.

## Function Documentation

## ◆ _putchar()

void _putchar | ( | char | character | ) |

Output a character to a custom device like UART, used by the printf() function This function is declared here only. You have to write your custom implementation somewhere

Parameters

  character | Character to output

## ◆ fctprintf()

int fctprintf | ( | void(*)(char character, void *arg) | out,
|  | void * | arg,
|  | const char * | format,
|  |  | ...
| ) |  |

printf with output function You may use this as dynamic alternative to printf() with its fixed _putchar() output

Parameters

  out | An output function which takes one character and an argument pointer
  arg | An argument pointer for user data passed to output function
  format | A string that specifies the format of the output

Returns
  The number of characters that are sent to the output function, not counting the terminating null character

Definition at line 905 of file printf.c.

## ◆ fctvprintf()

int fctvprintf | ( | void(*)(char character, void *arg) | out,
|  | void * | arg,
|  | const char * | format,
|  | va_list | va
| ) |  |

vprintf with output function You may use this as dynamic alternative to vprintf() with its fixed _putchar() output

Parameters

  out | An output function which takes one character and an argument pointer
  arg | An argument pointer for user data passed to output function
  format | A string that specifies the format of the output
  va | A value identifying a variable arguments list

Returns
  The number of characters that are sent to the output function, not counting the terminating null character

Definition at line 915 of file printf.c.

## ◆ printf_()

int printf_ | ( | const char * | format,
|  |  | ...
| ) |  |

Definition at line 861 of file printf.c.

## ◆ snprintf_()

int snprintf_ | ( | char * | buffer,
|  | size_t | count,
|  | const char * | format,
|  |  | ...
| ) |  |

Definition at line 882 of file printf.c.

## ◆ sprintf_()

int sprintf_ | ( | char * | buffer,
|  | const char * | format,
|  |  | ...
| ) |  |

Definition at line 872 of file printf.c.

## ◆ vprintf_()

int vprintf_ | ( | const char * | format,
|  | va_list | va
| ) |  |

Definition at line 892 of file printf.c.

## ◆ vsnprintf_()

int vsnprintf_ | ( | char * | buffer,
|  | size_t | count,
|  | const char * | format,
|  | va_list | va
| ) |  |

Definition at line 899 of file printf.c.