Go to the source code of this file.
Classes | |
struct | ConnectorLocalInfo |
Functions | |
void | appendChar (char *str, char val, int len) |
void | ltoaClrBuff (char *str, long val, uint8_t dp, char padChar, int len) |
void | fastltoa_mv (char *str, long val, long divisor, char padChar, int len) |
void | fastltoa (char *str, long val, uint8_t dp, char padChar, int len) |
void | fastftoa (char *sz, float fl, int dp, int strSize) |
long | dpToDivisor (int dp) |
uint8_t | safeProgCpy (char *dst, const char *pgmSrc, uint8_t size) |
char * | potentialProgramMemory (const char *x) |
Variables | |
char | szGlobalBuffer [] |
A series of utilities that used thoughout tcMenu
struct ConnectorLocalInfo |
void appendChar | ( | char * | str, |
char | val, | ||
int | len | ||
) |
appends a character at the end of the string, if there is space according to len
void ltoaClrBuff | ( | char * | str, |
long | val, | ||
uint8_t | dp, | ||
char | padChar, | ||
int | len | ||
) |
A fast long to ascii function that more feature complete than the standard library. Supports zero padding and maximum number of decimal places. This version always starts at position 0 in the provided buffer and goes up to position len always leaving space for a terminator. The other two versions below support appending instead.
str | the buffer to be output to |
val | the value to be converted |
divisor | the power of 10 largest value (eg 10000, 1000000L etc) |
padChar | the character to pad with (or NOT_PADDED which is 0) |
len | the length of the buffer passed in, it will not be exceeded. |
void fastltoa_mv | ( | char * | str, |
long | val, | ||
long | divisor, | ||
char | padChar, | ||
int | len | ||
) |
A fast long to ascii function that more feature complete than the standard library. Supports zero padding and the largest actual value to use normally a power of 10. Absolute largest value displayable is 1000000000 - 1. NOTE that this function will append at the end of the current string. Use ltoaClrBuff to start at position 0. This call will not exceed the length provided and will properly terminate the string.
str | the buffer to be appended to |
val | the value to be converted |
divisor | the power of 10 largest value (eg 10000, 1000000L etc) |
padChar | the character to pad with (or NOT_PADDED which is 0) |
len | the length of the buffer passed in, it will not be exceeded. |
void fastltoa | ( | char * | str, |
long | val, | ||
uint8_t | dp, | ||
char | padChar, | ||
int | len | ||
) |
A fast long to ascii function that more feature complete than the standard library. Supports zero padding and the number of decimal places to use. Maximum number of decimal places is 9. NOTE that this function will append at the end of the current string and will not exceed the length provided, it will also properly terminate the string. Use ltoaClrBuff to start at position 0 in the buffer.
str | the buffer to be appended to |
val | the value to be converted |
dp | the number of decimal places allowed |
padChar | the character to pad with (or NOT_PADDED which is 0) |
len | the length of the buffer passed in, it will not be exceeded. |
void fastftoa | ( | char * | sz, |
float | fl, | ||
int | dp, | ||
int | strSize | ||
) |
A very simple floating point string function based on the fastltoa above. It can print floating point values up to 9 whole digits and 9 decimal places. Note this function appends the floating point value at the end of the string, to put the value at the beginning, ensure the string is zero length.
sz | the string to append to, |
fl | the float to convert |
dp | the numer of decimal places (max 9) |
strSize | the string maximum length (usually from sizeof) |
long dpToDivisor | ( | int | dp | ) |
converts decimal places into a suitable divisor, eg: 2 -> 100, 4 -> 10000
uint8_t safeProgCpy | ( | char * | dst, |
const char * | pgmSrc, | ||
uint8_t | size | ||
) |
This is always safe to call, if there's a string that's in program mem on AVR but not on other boards, this always does the right thing.
dst | the destination buffer |
pgmSrc | the source to be copied (program mem on AVR) |
size | the size of dst. |