embeddedlibrary
reusable software modules for embedded systems
|
Functions | |
void | Push_printf (buffer_t *buf, char *str,...) |
printf implementation to char buffer More... | |
void | Push_vprintf (buffer_t *buf, char *str, va_list vars) |
vprintf implementation to char buffer More... | |
void | PushBinary16 (buffer_t *buf, uint16_t x) |
Push 16 bit binary number to char buffer. More... | |
void | Push_uint16 (buffer_t *buf, uint16_t x) |
Push unsigned integer to char buffer. More... | |
void | Push_int16 (buffer_t *buf, int16_t x) |
Push integer to char buffer. More... | |
void | Push_uint32 (buffer_t *buf, uint32_t x) |
Push unsigned long integer to char buffer. More... | |
void | Push_int32 (buffer_t *buf, int32_t x) |
Push long to char buffer. More... | |
void | PushStr (buffer_t *buf, char *str) |
Push char array (string) to char buffer. More... | |
void | PushHex (buffer_t *buf, uint16_t x) |
Push 16 bit value to char buffer in hex format. More... | |
void | PushFloat (buffer_t *buf, float x) |
Cheap implementation of float to char buffer. More... | |
Created on: Mar 11, 2014 Author: Michael
void Push_int16 | ( | buffer_t * | buf, |
int16_t | x | ||
) |
Push integer to char buffer.
Note this function is dependent on Push_uint16()
[in] | buf | Pointer to char buffer to print int to |
[in] | x | Integer to convert to text |
void Push_int32 | ( | buffer_t * | buf, |
int32_t | x | ||
) |
Push long to char buffer.
Note this function is dependent on Push_uint32()
[in] | buf | Pointer to char buffer to print int to |
[in] | x | Long to convert to text |
void Push_printf | ( | buffer_t * | buf, |
char * | str, | ||
... | |||
) |
printf implementation to char buffer
Currently supports the following replacement flags:
c
char, replaces flag with specified ASCII charb
binary, replaces flag with Binary representation See PushBinary16()l
long, replaces flag with Binary Representation See Push_int32()d
signed 16 bit integer, replaces flag with specified int. See Push_int16()e
f
or g
float, replaces flag with specified float See PushFloat()s
string, replaces flag with specified null terminated string See PushString()u
unsigned 16 bit integer, replaces flag with specified unsigned int See Push_uint16()x
16 bit hex formated integer, replaces flag with 4 digit hex value See PushHex()Example:
Would push to the buffer: "x = -1, hex - 0xFFFF, unsigned 65535, name = Muhlbaier"
[in] | buf | Pointer to char buffer to print formatted string to |
[in] | str | Pointer to null terminated string with replacement flags |
[in] | ... | Variable argument list corresponding with replacement flags |
void Push_uint16 | ( | buffer_t * | buf, |
uint16_t | x | ||
) |
Push unsigned integer to char buffer.
[in] | buf | Pointer to char buffer to print unsigned int to |
[in] | x | Unsigned integer to convert to text |
void Push_uint32 | ( | buffer_t * | buf, |
uint32_t | x | ||
) |
Push unsigned long integer to char buffer.
[in] | buf | Pointer to char buffer to print unsigned long to |
[in] | x | Unsigned integer to convert to text |
void Push_vprintf | ( | buffer_t * | buf, |
char * | str, | ||
va_list | vars | ||
) |
vprintf implementation to char buffer
Same as Push_printf() except with a va_list pointer instead of an actual variable argument list. This allows other functions similar to Push_printf to be implemented.
For example:
See Push_printf()
[in] | buf | Pointer to char buffer to print formatted string to |
[in] | str | Pointer to null terminated string with replacement flags |
[in] | vars | Variable argument list corresponding with replacement flags |
void PushBinary16 | ( | buffer_t * | buf, |
uint16_t | x | ||
) |
Push 16 bit binary number to char buffer.
[in] | buf | Pointer to char buffer to print to |
[in] | x | Unsigned 16-bit integer to convert to text in binary format |
void PushFloat | ( | buffer_t * | buf, |
float | x | ||
) |
Cheap implementation of float to char buffer.
Current implementation will format float as 0.000 by first printing out the integer portion of the float then multiplying the float by 1000 and subtracting the integer portion x 1000 and printing that after the .
[in] | buf | Pointer to char buffer to print float to |
[in] | x | Float value to convert to text |
void PushHex | ( | buffer_t * | buf, |
uint16_t | x | ||
) |
Push 16 bit value to char buffer in hex format.
Will push four char's to the buffer, for example: A0F3
[in] | buf | Pointer to char buffer to print hex formatted int to |
[in] | x | Integer to convert to hex |
void PushStr | ( | buffer_t * | buf, |
char * | str | ||
) |
Push char array (string) to char buffer.
[in] | buf | Pointer to char buffer to print string to |
[in] | str | Pointer to null terminated char array (e.g. string) |