KETCube
|
KETCube Common deffinitions nd inline functions. More...
Macros | |
#define | TRUE 1 |
boolean TRUE More... | |
#define | FALSE 0 |
boolean FALSE More... | |
#define | KETCUBE_COMMON_BUFFER_LEN 256 |
Typedefs | |
typedef uint8_t | byte |
Functions | |
void | KETCube_ErrorHandler (void) |
char * | ketCube_common_bytes2Str (uint8_t *byteArr, uint8_t len) |
static void | ketCube_common_Byte2hex (uint8_t byte, char *str) |
Convert a single Byte to HEX string (two bytes) More... | |
static void | ketCube_common_Int2dec (int32_t number, char *str, int len) |
Convert an integer to DEC string (with defined length, counting zero terminator) More... | |
static bool | ketCube_common_IsHexString (const char *str, uint8_t len) |
Test if the string is valid HEX string. More... | |
static bool | ketCube_common_IsDecString (const char *str, uint8_t len) |
Test if the string is valid DEC string. More... | |
static uint8_t | ketCube_common_Hex2Val (const char c) |
Convert HEX char to Int (Byte) More... | |
static void | ketCube_common_Hex2Bytes (uint8_t *bytes, const char *str, uint8_t len) |
Convert HEX string to Byte array. More... | |
static void | ketCube_common_Dec2int (int32_t *output, const char *str, uint8_t len) |
Convert DEC string to 4 byte signed integer. More... | |
static uint8_t | ketCube_common_Min (uint8_t a, uint8_t b) |
Return minimum of two bytes. More... | |
static uint8_t | ketCube_common_Max (uint8_t a, uint8_t b) |
Return maximum of two bytes. More... | |
static uint16_t | ketCube_common_Med (uint16_t *values, uint16_t size) |
Return median from an array of shorts. More... | |
static uint32_t | ketCube_common_Med32 (uint32_t *values, uint32_t size) |
Return median from an array of shorts. More... | |
static uint32_t | ketCube_common_Max32 (uint32_t *values, uint32_t size) |
Return max from an array of ints. More... | |
static uint32_t | ketCube_common_Min32 (uint32_t *values, uint32_t size) |
Return max from an array of ints. More... | |
static uint16_t | ketCube_common_Avg (uint16_t *values, uint16_t size) |
Return median from an array of shorts. More... | |
static uint16_t | ketCube_common_swapW (uint16_t n) |
Swap word (16-bit) values. More... | |
static void | ketCube_common_BasicErrorHandler () |
Basic Error Handler. More... | |
Variables | |
char | ketCube_common_buffer [] |
KETCube Common deffinitions nd inline functions.
This KETCube module incorporates common defs
#define FALSE 0 |
boolean FALSE
#define KETCUBE_COMMON_BUFFER_LEN 256 |
#define TRUE 1 |
boolean TRUE
typedef uint8_t byte |
|
inlinestatic |
Return median from an array of shorts.
values | shorts array |
size | array size |
avg | median |
|
inlinestatic |
Basic Error Handler.
|
inlinestatic |
Convert a single Byte to HEX string (two bytes)
byte | a single byte to convert |
str | pointer to a two-byte string |
char* ketCube_common_bytes2Str | ( | uint8_t * | byteArr, |
uint8_t | len | ||
) |
Print byte array to ketCube_common_buffer
byteArr | byte array |
len | byte array length |
str | pointer to resulting (NULL-terminated) string |
|
inlinestatic |
Convert DEC string to 4 byte signed integer.
output | pointer to output integer |
str | pointer to HEX string |
len | HEX string length |
|
inlinestatic |
Convert HEX string to Byte array.
bytes | pointer to byte array |
str | pointer to HEX string |
len | HEX string length |
|
inlinestatic |
Convert HEX char to Int (Byte)
c | hex character |
character | value 0 - 15; in case of error 0xFF |
|
inlinestatic |
Convert an integer to DEC string (with defined length, counting zero terminator)
number | a number to be converted |
str | pointer to a string of given length |
len | length of given string |
|
inlinestatic |
Test if the string is valid DEC string.
str | pointer to DEC string |
len | DEC string length |
TRUE | if it is a valid DEC string |
FALSE | otherwise |
|
inlinestatic |
Test if the string is valid HEX string.
str | pointer to HEX string |
len | HEX string length |
TRUE | if it is a valid HEX string |
FALSE | otherwise |
|
inlinestatic |
Return maximum of two bytes.
a | a number |
b | a number |
max | maximum |
|
inlinestatic |
Return max from an array of ints.
values | shorts array |
size | array size |
max | maximum |
|
inlinestatic |
Return median from an array of shorts.
values | shorts array |
size | array size |
med | median |
|
inlinestatic |
Return median from an array of shorts.
values | shorts array |
size | array size |
med | median |
|
inlinestatic |
Return minimum of two bytes.
a | a number |
b | a number |
min | minimum |
|
inlinestatic |
Return max from an array of ints.
values | shorts array |
size | array size |
max | maximum |
|
inlinestatic |
Swap word (16-bit) values.
This is intended for conversion when different Endianity is used
n | a 16-bit number |
n | with swapped bytes |
void KETCube_ErrorHandler | ( | void | ) |
|
extern |
Shared buffer for common usage anywhere.