IoAbstraction
TextUtilities.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 https://www.thecoderscorner.com (Dave Cherry).
3  * This product is licensed under an Apache license, see the LICENSE file in the top-level directory.
4  */
5 
6 #ifndef IOABSTRACTION_TEXTUTILITIES_H
7 #define IOABSTRACTION_TEXTUTILITIES_H
8 
9 #include <PlatformDetermination.h>
10 
19 void appendChar(char* str, char val, int len);
20 
24 #define NOT_PADDED 0
25 
38 void ltoaClrBuff(char* str, long val, uint8_t dp, char padChar, int len);
39 
53 void fastltoa_mv(char* str, long val, long divisor, char padChar, int len);
54 
68 void fastltoa(char* str, long val, uint8_t dp, char padChar, int len);
69 
80 void fastftoa(char* sz, float fl, int dp, int strSize);
81 
85 long dpToDivisor(int dp);
86 
93 long valueToSignificantPlaces(unsigned long value, bool negative);
94 
100 char hexChar(uint8_t val);
101 
107 uint8_t hexValueOf(char val);
108 
118 void intToHexString(char* buffer, size_t bufferSize, unsigned int input, int digits, bool with0x);
119 
125 inline float tcFltAbs(float f1) {
126  return f1 > 0.0F ? f1 : -f1;
127 }
128 
129 #if defined(IOA_USE_MBED) || defined(BUILD_FOR_PICO_CMAKE)
130 #define strcmp_P(x,y) strcmp(x,y)
131 #define strncpy_P(x,y,z) strncpy(x,y,z)
132 #define strcpy_P(x,y) strcpy(x,y)
133 #define strlen_P(x) strlen(x)
134 #define highByte(x) ((x) >> 8)
135 #define lowByte(x) ((x) & 0xff)
136 #define ltoa(a,b,c) itoa(a,b,c)
137 # ifndef min
138 # define min(x, y) (((x) < (y))?(x):(y))
139 # define max(x, y) (((x) > (y))?(x):(y))
140 # endif //TCMENU_MBED_NO_MINMAX
141 #endif // IOA_USE_MBED
142 
143 #ifdef IOA_ARDUINO_MBED
144 #define ltoa(a,b,c) itoa(a,b,c)
145 #endif
146 
147 #endif //IOABSTRACTION_TEXTUTILITIES_H
void intToHexString(char *buffer, size_t bufferSize, unsigned int input, int digits, bool with0x)
Definition: TextUtilities.cpp:109
char hexChar(uint8_t val)
Definition: TextUtilities.cpp:103
void fastltoa_mv(char *str, long val, long divisor, char padChar, int len)
Definition: TextUtilities.cpp:55
uint8_t hexValueOf(char val)
Definition: TextUtilities.cpp:130
void appendChar(char *str, char val, int len)
Definition: TextUtilities.cpp:9
long valueToSignificantPlaces(unsigned long value, bool negative)
Definition: TextUtilities.cpp:36
long dpToDivisor(int dp)
Definition: TextUtilities.cpp:20
void fastltoa(char *str, long val, uint8_t dp, char padChar, int len)
Definition: TextUtilities.cpp:51
float tcFltAbs(float f1)
Definition: TextUtilities.h:125
void fastftoa(char *sz, float fl, int dp, int strSize)
Definition: TextUtilities.cpp:84
void ltoaClrBuff(char *str, long val, uint8_t dp, char padChar, int len)
Definition: TextUtilities.cpp:46