PicoWAN SDK Documentation
Macros | Functions
xprintf.h File Reference

Universal string handler for user console interface. More...

#include <stdarg.h>

Go to the source code of this file.

Macros

#define _USE_XFUNC_OUT   1 /* 1: Use output functions */
 
#define _CR_CRLF   1 /* 1: Convert \n ==> \r\n in the output char */
 
#define _USE_XFUNC_IN   0 /* 1: Use input function */
 
#define _LINE_ECHO   0 /* 1: Echo back input chars in xgets function */
 
#define DW_CHAR   sizeof(char)
 
#define DW_SHORT   sizeof(short)
 
#define DW_LONG   sizeof(long)
 

Functions

void xputc (char c)
 Put a character. More...
 
void xputs (const char *str)
 Put a null-terminated string. More...
 
void xvprintf (const char *fmt, va_list arp)
 Formatted string output (va_list version). More...
 
void xprintf (const char *fmt,...)
 Formatted string output to USART. More...
 
void xsprintf (char *buff, const char *fmt,...)
 Formatted string output into a buffer. More...
 

Detailed Description

Universal string handler for user console interface.



Copyright (C) 2011, ChaN, all right reserved. Copyright (C) 2018, Archos S.A., all right reserved.

Function Documentation

void xprintf ( const char *  fmt,
  ... 
)

Formatted string output to USART.

This function prints a formatted output (no floating point support).

Call Output
xprintf("%d", 1234); "1234"
xprintf("%6d,%3d%%", -200, 5); " -200, 5%"
xprintf("%-6u", 100); "100 "
xprintf("%ld", 12345678L); "12345678"
xprintf("%04x", 0xA3); "00a3"
xprintf("%08LX", 0x123ABC); "00123ABC"
xprintf("%016b", 0x550F); "0101010100001111"
xprintf("%s", "String"); "String"
xprintf("%-4s", "abc"); "abc "
xprintf("%4s", "abc"); " abc"
xprintf("%c", 'a'); "a"
Parameters
fmtThe formatted output.
...Variable list of arguments.
void xputc ( char  c)

Put a character.

Parameters
cThe character to put.
void xputs ( const char *  str)

Put a null-terminated string.

Parameters
strThe string to put.
void xsprintf ( char *  buff,
const char *  fmt,
  ... 
)

Formatted string output into a buffer.

This function is the same as xprintf(), but will fill a buffer.

Parameters
fmtThe formatted output.
...Variable list of arguments.
void xvprintf ( const char *  fmt,
va_list  arp 
)

Formatted string output (va_list version).

Parameters
fmtThe formatted output.
arpThe list of arguments.