External Code Interface (ECI)
|
Macros | |
#define | D2STR(x) #x |
#define | SIZEOF_ARRAY(ar) (sizeof(ar)/sizeof(ar[0])) |
#define | SIZEOF_MEMBER(memberOf, member) sizeof(((memberOf*)0)->member) |
#define | SIZEOF_ARRAY_MEMBER(memberOf, member) (sizeof(((memberOf*)0)->member)/sizeof(((memberOf*)0)->member[0])) |
#define | BSWAP_16(x) |
#define | BSWAP_32(x) |
#define | BSWAP_64(x) |
#define | HEX__(n) 0x##n##LU |
#define | B8__(x) |
#define | B8(d) ((uint8_t)B8__(HEX__(d))) |
#define | B16(dmsb, dlsb) |
#define | B32(dmsb, db2, db3, dlsb) |
Various utility macros.
#define B16 | ( | dmsb, | |
dlsb | |||
) |
#define B32 | ( | dmsb, | |
db2, | |||
db3, | |||
dlsb | |||
) |
#define B8__ | ( | x | ) |
8-bit Conversion Function
#define BSWAP_16 | ( | x | ) |
Swaps the low and high bytes of a 16 bit value
x | 16 bit value to swap |
#define BSWAP_32 | ( | x | ) |
Swaps the 2 lowest and 2 highest bytes of a 32 bit value
x | 32 bit value to swap |
#define BSWAP_64 | ( | x | ) |
Swap the 4 lowest and 4 highest bytes of a 64 bit value
x | 64 bit value to swap |
#define D2STR | ( | x | ) | #x |
Converts Define or Enum to string.
x | value to be stringified by the preprocessor |
#define HEX__ | ( | n | ) | 0x##n##LU |
Turn a numeric literal into a hex constant. This avoids problems with leading zeroes. 8-bit constants have a max value of 0x11111111, which always fits in an unsigned long
n | literal to be converted |
#define SIZEOF_ARRAY | ( | ar | ) | (sizeof(ar)/sizeof(ar[0])) |
Returns the number of elements in the array. This uses sizeof(ar[0]) to determine the size which means the array must contain at least one element (should be null)
ar | array to calculate size of |
#define SIZEOF_ARRAY_MEMBER | ( | memberOf, | |
member | |||
) | (sizeof(((memberOf*)0)->member)/sizeof(((memberOf*)0)->member[0])) |
Returns the number of elements of an array for a member of a structure.
memberOf | struct which contains the member |
member | array to calculate the size of |
#define SIZEOF_MEMBER | ( | memberOf, | |
member | |||
) | sizeof(((memberOf*)0)->member) |
Returns the number of bytes for the member of the structure.
memberOf | struct which contains the member |
member | name of the member to calculate |