printf


hex printing

These functions allow you to print data that might contain non-printable characters. The output is in the standard hex output format, with hex representation on the left, and characters to the right. include "hex_output.h"

#define print_hexdump(buffer, size)   print_hexdump_ex(buffer, size, 16)
 print a hexdump of buffer. This function prints 16 characters per line.
void print_hexdump_ex (const char *buffer, uint16_t size, uint16_t line_length)
 print a hexdump of a buffer.

printf

The printf function is similiar to the printf() function used in regular C programming, except that in this case the output is sent over the UART, meaning it is readable on a PC or other connected device.

This implementation does not support all formatting and has a few differences from the standard C function:

  1. use %C for 8-bit numbers. Example output: 255
  2. use %d for 16-bit numbers. Example output: 65535
  3. use %l for 32-bit numbers. Example output: 4294967295
  4. use %c for characters. Example output: a
  5. use %s for strings. Example output: hello world!
  6. use %b for binary. Example output: 00110001
  7. use %o for octal. Example output: 31
  8. use %h for hexadecimal. Example output: 3f
  9. use %x for hexadecimal. Example output: 0x3f
  10. padding and minumum width modifiers are supported. Example output: 00012

See src/apps/printf/test_printf.c for more examples.

Note: All numeric types are unsigned. printf does not support negative signed numbers.

int puts (const char *msg)
 print a non-formatted string.
int putchar (int character)
 print a single character.
int printf (const char *format,...)
 print a formatted string.

Detailed Description

/**

This module contains functions that allow a node attached to a PC to easily output data to the mos_shell. include "printf.h"


Define Documentation

#define print_hexdump buffer,
size   )     print_hexdump_ex(buffer, size, 16)
 

Parameters:
buffer a pointer to an array of bytes to print.
size the number of bytes to print.

Definition at line 55 of file hex_output.h.


Function Documentation

void print_hexdump_ex const char *  buffer,
uint16_t  size,
uint16_t  line_length
 

Parameters:
buffer a pointer to an array of bytes to print.
size the number of bytes to print.
line_length the number of characters to print on each line.

int printf const char *  format,
  ...
 

Parameters:
format the format string specifying what arguments are included and how to display them.
... any arguments referenced in the format string.
Returns:
0 on success, -1 if the format string is NULL.

int putchar int  character  ) 
 

Parameters:
character the character to print.
Returns:
0

int puts const char *  msg  ) 
 

Parameters:
msg the string to print.
Returns:
0


Generated on Mon Nov 23 06:26:00 2009 for MANTIS by  doxygen 1.4.6