nRF5 SDK v12.1.0
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
Utility Functions and Definitions

Various types and definitions available to all applications. More...

Data Structures

struct  uint8_array_t
 Byte array type. More...
 
struct  regcertdatalist_t
 IEEE 11073-20601 Regulatory Certification Data List Structure. More...
 
struct  sfloat_t
 SFLOAT format (IEEE-11073 16-bit FLOAT, meaning 4 bits for exponent (base 10) and 12 bits mantissa) More...
 
struct  ble_date_time_t
 Date and Time structure. More...
 

Macros

#define STACK_BASE   &STACK$$Base
 
#define STACK_TOP   ((void*)((uint32_t)STACK_BASE + (uint32_t)&STACK$$Length))
 
#define STRING_CONCATENATE_IMPL(lhs, rhs)   lhs ## rhs
 Implementation specific macro for delayed macro expansion used in string concatenation. More...
 
#define STRING_CONCATENATE(lhs, rhs)   STRING_CONCATENATE_IMPL(lhs, rhs)
 Macro used to concatenate string using delayed macro expansion. More...
 
#define STATIC_ASSERT(EXPR)   ;enum { STRING_CONCATENATE(assert_line_, __LINE__) = 1 / (!!(EXPR)) }
 Macro for doing static (i.e. compile time) assertion. More...
 
#define NUM_VA_ARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10,_11, _12, _13, _14, _15, _16, _17, _18, _19, _20,_21, _22, _23, _24, _25, _26, _27, _28, _29, _30,_31, _32, _33, _34, _35, _36, _37, _38, _39, _40,_41, _42, _43, _44, _45, _46, _47, _48, _49, _50,_51, _52, _53, _54, _55, _56, _57, _58, _59, _60,_61, _62, N,...)   N
 Implementation details for NUM_VAR_ARGS.
 
#define NUM_VA_ARGS(...)
 Macro to get the number of arguments in a call variadic macro call. More...
 
#define NUM_VA_ARGS_LESS_1_IMPL(_ignored,_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10,_11, _12, _13, _14, _15, _16, _17, _18, _19, _20,_21, _22, _23, _24, _25, _26, _27, _28, _29, _30,_31, _32, _33, _34, _35, _36, _37, _38, _39, _40,_41, _42, _43, _44, _45, _46, _47, _48, _49, _50,_51, _52, _53, _54, _55, _56, _57, _58, _59, _60,_61, _62, N,...)   N
 Implementation details for NUM_VAR_ARGS.
 
#define NUM_VA_ARGS_LESS_1(...)
 Macro to get the number of arguments in a call variadic macro call. First argument is not counted. More...
 
#define ROUNDED_DIV(A, B)   (((A) + ((B) / 2)) / (B))
 Macro for performing rounded integer division (as opposed to truncating the result). More...
 
#define IS_POWER_OF_TWO(A)   ( ((A) != 0) && ((((A) - 1) & (A)) == 0) )
 Macro for checking if an integer is a power of two. More...
 
#define MSEC_TO_UNITS(TIME, RESOLUTION)   (((TIME) * 1000) / (RESOLUTION))
 Macro for converting milliseconds to ticks. More...
 
#define CEIL_DIV(A, B)   (((A) + (B) - 1) / (B))
 Macro for performing integer division, making sure the result is rounded up. More...
 
#define WORD_ALIGNED_MEM_BUFF(NAME, MIN_SIZE)   static uint32_t NAME[CEIL_DIV(MIN_SIZE, sizeof(uint32_t))]
 Macro for creating a buffer aligned to 4 bytes. More...
 
#define BYTES_TO_WORDS(n_bytes)   (((n_bytes) + 3) >> 2)
 Macro for calculating the number of words that are needed to hold a number of bytes. More...
 
#define BYTES_PER_WORD   (4)
 The number of bytes in a word.
 
#define ALIGN_NUM(alignment, number)   ((number - 1) + alignment - ((number - 1) % alignment))
 Macro for increasing a number to the nearest (larger) multiple of another number. More...
 
#define GET_ARG_1(a1, a2)   a1
 Macro for getting first of 2 parameters. More...
 
#define GET_ARG_2(a1, a2)   a2
 Macro for getting second of 2 parameters. More...
 

Typedefs

typedef uint8_t uint16_le_t [2]
 type for holding an encoded (i.e. little endian) 16 bit unsigned integer.
 
typedef uint8_t uint32_le_t [4]
 Type for holding an encoded (i.e. little endian) 32 bit unsigned integer.
 
typedef uint8_t nibble_t
 
typedef uint32_t uint24_t
 
typedef uint64_t uint40_t
 

Enumerations

enum  {
  UNIT_0_625_MS = 625,
  UNIT_1_25_MS = 1250,
  UNIT_10_MS = 10000
}
 

Functions

static __INLINE uint64_t value_rescale (uint32_t value, uint32_t old_unit_reversal, uint16_t new_unit_reversal)
 Function for changing the value unit. More...
 
static __INLINE uint8_t uint16_encode (uint16_t value, uint8_t *p_encoded_data)
 Function for encoding a uint16 value. More...
 
static __INLINE uint8_t uint24_encode (uint32_t value, uint8_t *p_encoded_data)
 Function for encoding a three-byte value. More...
 
static __INLINE uint8_t uint32_encode (uint32_t value, uint8_t *p_encoded_data)
 Function for encoding a uint32 value. More...
 
static __INLINE uint8_t uint48_encode (uint64_t value, uint8_t *p_encoded_data)
 Function for encoding a uint48 value. More...
 
static __INLINE uint16_t uint16_decode (const uint8_t *p_encoded_data)
 Function for decoding a uint16 value. More...
 
static __INLINE uint16_t uint16_big_decode (const uint8_t *p_encoded_data)
 Function for decoding a uint16 value in big-endian format. More...
 
static __INLINE uint32_t uint24_decode (const uint8_t *p_encoded_data)
 Function for decoding a three-byte value. More...
 
static __INLINE uint32_t uint32_decode (const uint8_t *p_encoded_data)
 Function for decoding a uint32 value. More...
 
static __INLINE uint32_t uint32_big_decode (const uint8_t *p_encoded_data)
 Function for decoding a uint32 value in big-endian format. More...
 
static __INLINE uint8_t uint32_big_encode (uint32_t value, uint8_t *p_encoded_data)
 Function for encoding a uint32 value in big-endian format. More...
 
static __INLINE uint64_t uint48_decode (const uint8_t *p_encoded_data)
 Function for decoding a uint48 value. More...
 
static __INLINE uint8_t battery_level_in_percent (const uint16_t mvolts)
 Function for converting the input voltage (in milli volts) into percentage of 3.0 Volts. More...
 
static __INLINE bool is_word_aligned (void const *p)
 Function for checking if a pointer value is aligned to a 4 byte boundary. More...
 
static __INLINE bool is_address_from_stack (void *ptr)
 Function for checking if provided address is located in stack space. More...
 
static __INLINE uint8_t bds_uint16_encode (const uint16_t *p_value, uint8_t *p_encoded_data)
 Function for encoding a uint16 value. More...
 
static __INLINE uint8_t bds_int16_encode (const int16_t *p_value, uint8_t *p_encoded_data)
 
static __INLINE uint8_t bds_uint24_encode (const uint32_t *p_value, uint8_t *p_encoded_data)
 Function for encoding a uint24 value. More...
 
static __INLINE uint8_t bds_uint32_encode (const uint32_t *p_value, uint8_t *p_encoded_data)
 Function for encoding a uint32 value. More...
 
static __INLINE uint8_t bds_uint40_encode (const uint64_t *p_value, uint8_t *p_encoded_data)
 Function for encoding a uint40 value. More...
 
static __INLINE uint8_t bds_sfloat_encode (const sfloat_t *p_value, uint8_t *p_encoded_data)
 Function for encoding a sfloat value. More...
 
static __INLINE uint8_t bds_uint8_array_encode (const uint8_array_t *p_value, uint8_t *p_encoded_data)
 Function for encoding a uint8_array value. More...
 
static __INLINE uint8_t bds_ble_srv_utf8_str_encode (const ble_srv_utf8_str_t *p_value, uint8_t *p_encoded_data)
 Function for encoding a utf8_str value. More...
 
static __INLINE uint8_t bds_regcertdatalist_encode (const regcertdatalist_t *p_value, uint8_t *p_encoded_data)
 Function for encoding a regcertdatalist value. More...
 
static __INLINE uint8_t bds_ble_date_time_encode (const ble_date_time_t *p_date_time, uint8_t *p_encoded_data)
 Function for decoding a date_time value. More...
 
static __INLINE uint8_t bds_uint16_decode (const uint8_t len, const uint8_t *p_encoded_data, uint16_t *p_decoded_val)
 Function for decoding a uint16 value. More...
 
static __INLINE uint8_t bds_int16_decode (const uint8_t len, const uint8_t *p_encoded_data, int16_t *p_decoded_val)
 Function for decoding a int16 value. More...
 
static __INLINE uint8_t bds_uint24_decode (const uint8_t len, const uint8_t *p_encoded_data, uint32_t *p_decoded_val)
 Function for decoding a uint24 value. More...
 
static __INLINE uint8_t bds_uint32_decode (const uint8_t len, const uint8_t *p_encoded_data, uint32_t *p_decoded_val)
 Function for decoding a uint32 value. More...
 
static __INLINE uint8_t bds_uint40_decode (const uint8_t len, const uint8_t *p_encoded_data, uint64_t *p_decoded_val)
 Function for decoding a uint40 value. More...
 
static __INLINE uint8_t bds_sfloat_decode (const uint8_t len, const uint8_t *p_encoded_data, sfloat_t *p_decoded_val)
 Function for decoding a sfloat value. More...
 
static __INLINE uint8_t bds_uint8_array_decode (const uint8_t len, const uint8_t *p_encoded_data, uint8_array_t *p_decoded_val)
 Function for decoding a uint8_array value. More...
 
static __INLINE uint8_t bds_ble_srv_utf8_str_decode (const uint8_t len, const uint8_t *p_encoded_data, ble_srv_utf8_str_t *p_decoded_val)
 Function for decoding a utf8_str value. More...
 
static __INLINE uint8_t bds_regcertdatalist_decode (const uint8_t len, const uint8_t *p_encoded_data, regcertdatalist_t *p_decoded_val)
 Function for decoding a regcertdatalist value. More...
 
static __INLINE uint8_t bds_ble_date_time_decode (const uint8_t len, const uint8_t *p_encoded_data, ble_date_time_t *p_date_time)
 Function for decoding a date_time value. More...
 

Variables

char STACK $$Base
 
char STACK $$Length
 

Detailed Description

Various types and definitions available to all applications.

Macro Definition Documentation

#define ALIGN_NUM (   alignment,
  number 
)    ((number - 1) + alignment - ((number - 1) % alignment))

Macro for increasing a number to the nearest (larger) multiple of another number.

Parameters
[in]alignmentThe number to align to.
[in]numberThe number to align (increase).
Returns
The aligned (increased) number.
#define BYTES_TO_WORDS (   n_bytes)    (((n_bytes) + 3) >> 2)

Macro for calculating the number of words that are needed to hold a number of bytes.

Adds 3 and divides by 4.

Parameters
[in]n_bytesThe number of bytes.
Returns
The number of words that n_bytes take up (rounded up).
#define CEIL_DIV (   A,
 
)    (((A) + (B) - 1) / (B))

Macro for performing integer division, making sure the result is rounded up.

One typical use for this is to compute the number of objects with size B is needed to hold A number of bytes.

Parameters
[in]ANumerator.
[in]BDenominator.
Returns
Integer result of dividing A by B, rounded up.
#define GET_ARG_1 (   a1,
  a2 
)    a1

Macro for getting first of 2 parameters.

Parameters
[in]a1First parameter.
[in]a2Second parameter.
#define GET_ARG_2 (   a1,
  a2 
)    a2

Macro for getting second of 2 parameters.

Parameters
[in]a1First parameter.
[in]a2Second parameter.
#define IS_POWER_OF_TWO (   A)    ( ((A) != 0) && ((((A) - 1) & (A)) == 0) )

Macro for checking if an integer is a power of two.

Parameters
[in]ANumber to be tested.
Returns
true if value is power of two.
false if value not power of two.
#define MSEC_TO_UNITS (   TIME,
  RESOLUTION 
)    (((TIME) * 1000) / (RESOLUTION))

Macro for converting milliseconds to ticks.

Parameters
[in]TIMENumber of milliseconds to convert.
[in]RESOLUTIONUnit to be converted to in [us/ticks].
#define NUM_VA_ARGS (   ...)
Value:
NUM_VA_ARGS_IMPL(__VA_ARGS__, 63, 62, 61, \
60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \
50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
40, 39, 38, 37, 36, 35, 34, 33, 32, 31, \
30, 29, 28, 27, 26, 25, 24, 23, 22, 21, \
20, 19, 18, 17, 16, 15, 14, 13, 12, 11, \
10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)

Macro to get the number of arguments in a call variadic macro call.

param[in] ... List of arguments

Return values
Numberof variadic arguments in the argument list
#define NUM_VA_ARGS_LESS_1 (   ...)
Value:
NUM_VA_ARGS_LESS_1_IMPL(__VA_ARGS__, 63, 62, 61, \
60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \
50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
40, 39, 38, 37, 36, 35, 34, 33, 32, 31, \
30, 29, 28, 27, 26, 25, 24, 23, 22, 21, \
20, 19, 18, 17, 16, 15, 14, 13, 12, 11, \
10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, ~)

Macro to get the number of arguments in a call variadic macro call. First argument is not counted.

param[in] ... List of arguments

Return values
Numberof variadic arguments in the argument list
#define ROUNDED_DIV (   A,
 
)    (((A) + ((B) / 2)) / (B))

Macro for performing rounded integer division (as opposed to truncating the result).

Parameters
[in]ANumerator.
[in]BDenominator.
Returns
Rounded (integer) result of dividing A by B.
#define STATIC_ASSERT (   EXPR)    ;enum { STRING_CONCATENATE(assert_line_, __LINE__) = 1 / (!!(EXPR)) }

Macro for doing static (i.e. compile time) assertion.

Note
If the EXPR isn't resolvable, then the error message won't be shown.
The output of STATIC_ASSERT will be different across different compilers.
Parameters
[in]EXPRConstant expression to be verified.
#define STRING_CONCATENATE (   lhs,
  rhs 
)    STRING_CONCATENATE_IMPL(lhs, rhs)

Macro used to concatenate string using delayed macro expansion.

Note
This macro will delay concatenation until the expressions have been resolved
Parameters
[in]lhsLeft hand side in concatenation
[in]rhsRight hand side in concatenation
#define STRING_CONCATENATE_IMPL (   lhs,
  rhs 
)    lhs ## rhs

Implementation specific macro for delayed macro expansion used in string concatenation.

Parameters
[in]lhsLeft hand side in concatenation
[in]rhsRight hand side in concatenation
#define WORD_ALIGNED_MEM_BUFF (   NAME,
  MIN_SIZE 
)    static uint32_t NAME[CEIL_DIV(MIN_SIZE, sizeof(uint32_t))]

Macro for creating a buffer aligned to 4 bytes.

Parameters
[in]NAMEName of the buffor.
[in]MIN_SIZESize of this buffor (it will be rounded up to multiples of 4 bytes).

Enumeration Type Documentation

anonymous enum
Enumerator
UNIT_0_625_MS 

Number of microseconds in 0.625 milliseconds.

UNIT_1_25_MS 

Number of microseconds in 1.25 milliseconds.

UNIT_10_MS 

Number of microseconds in 10 milliseconds.

Function Documentation

static __INLINE uint8_t battery_level_in_percent ( const uint16_t  mvolts)
static

Function for converting the input voltage (in milli volts) into percentage of 3.0 Volts.

The calculation is based on a linearized version of the battery's discharge curve. 3.0V returns 100% battery level. The limit for power failure is 2.1V and is considered to be the lower boundary.

The discharge curve for CR2032 is non-linear. In this model it is split into 4 linear sections:

  • Section 1: 3.0V - 2.9V = 100% - 42% (58% drop on 100 mV)
  • Section 2: 2.9V - 2.74V = 42% - 18% (24% drop on 160 mV)
  • Section 3: 2.74V - 2.44V = 18% - 6% (12% drop on 300 mV)
  • Section 4: 2.44V - 2.1V = 6% - 0% (6% drop on 340 mV)

These numbers are by no means accurate. Temperature and load in the actual application is not accounted for!

Parameters
[in]mvoltsThe voltage in mV
Returns
Battery level in percent.
static __INLINE uint8_t bds_ble_date_time_decode ( const uint8_t  len,
const uint8_t *  p_encoded_data,
ble_date_time_t p_date_time 
)
static

Function for decoding a date_time value.

Parameters
[in]lenlength of the field to be decoded.
[in]p_encoded_dataBuffer where the encoded data is stored.
[in]p_date_timepointer to the decoded value
Returns
length of the decoded field.
static __INLINE uint8_t bds_ble_date_time_encode ( const ble_date_time_t p_date_time,
uint8_t *  p_encoded_data 
)
static

Function for decoding a date_time value.

Parameters
[in]p_date_timepointer to the date_time structure to encode.
[in]p_encoded_datapointer to the encoded data
Returns
length of the encoded field.
static __INLINE uint8_t bds_ble_srv_utf8_str_decode ( const uint8_t  len,
const uint8_t *  p_encoded_data,
ble_srv_utf8_str_t p_decoded_val 
)
static

Function for decoding a utf8_str value.

Parameters
[in]lenlength of the field to be decoded.
[in]p_encoded_dataBuffer where the encoded data is stored.
[in]p_decoded_valpointer to the decoded value
Returns
length of the decoded field.
static __INLINE uint8_t bds_ble_srv_utf8_str_encode ( const ble_srv_utf8_str_t p_value,
uint8_t *  p_encoded_data 
)
static

Function for encoding a utf8_str value.

Parameters
[in]p_valueValue to be encoded.
[out]p_encoded_dataBuffer where the encoded data is to be written.
static __INLINE uint8_t bds_int16_decode ( const uint8_t  len,
const uint8_t *  p_encoded_data,
int16_t *  p_decoded_val 
)
static

Function for decoding a int16 value.

Parameters
[in]lenlength of the field to be decoded.
[in]p_encoded_dataBuffer where the encoded data is stored.
[in]p_decoded_valpointer to the decoded value
Returns
length of the decoded field.
static __INLINE uint8_t bds_regcertdatalist_decode ( const uint8_t  len,
const uint8_t *  p_encoded_data,
regcertdatalist_t p_decoded_val 
)
static

Function for decoding a regcertdatalist value.

Parameters
[in]lenlength of the field to be decoded.
[in]p_encoded_dataBuffer where the encoded data is stored.
[in]p_decoded_valpointer to the decoded value
Returns
length of the decoded field.
static __INLINE uint8_t bds_regcertdatalist_encode ( const regcertdatalist_t p_value,
uint8_t *  p_encoded_data 
)
static

Function for encoding a regcertdatalist value.

Parameters
[in]p_valueValue to be encoded.
[out]p_encoded_dataBuffer where the encoded data is to be written.
static __INLINE uint8_t bds_sfloat_decode ( const uint8_t  len,
const uint8_t *  p_encoded_data,
sfloat_t p_decoded_val 
)
static

Function for decoding a sfloat value.

Parameters
[in]lenlength of the field to be decoded.
[in]p_encoded_dataBuffer where the encoded data is stored.
[in]p_decoded_valpointer to the decoded value
Returns
length of the decoded field.
static __INLINE uint8_t bds_sfloat_encode ( const sfloat_t p_value,
uint8_t *  p_encoded_data 
)
static

Function for encoding a sfloat value.

Parameters
[in]p_valueValue to be encoded.
[out]p_encoded_dataBuffer where the encoded data is to be written.
Returns
Number of bytes written.
static __INLINE uint8_t bds_uint16_decode ( const uint8_t  len,
const uint8_t *  p_encoded_data,
uint16_t *  p_decoded_val 
)
static

Function for decoding a uint16 value.

Parameters
[in]lenlength of the field to be decoded.
[in]p_encoded_dataBuffer where the encoded data is stored.
[in]p_decoded_valpointer to the decoded value
Returns
length of the decoded field.
static __INLINE uint8_t bds_uint16_encode ( const uint16_t *  p_value,
uint8_t *  p_encoded_data 
)
static

Function for encoding a uint16 value.

Parameters
[in]p_valueValue to be encoded.
[out]p_encoded_dataBuffer where the encoded data is to be written.
Returns
Number of bytes written.
static __INLINE uint8_t bds_uint24_decode ( const uint8_t  len,
const uint8_t *  p_encoded_data,
uint32_t *  p_decoded_val 
)
static

Function for decoding a uint24 value.

Parameters
[in]lenlength of the field to be decoded.
[in]p_encoded_dataBuffer where the encoded data is stored.
[in]p_decoded_valpointer to the decoded value
Returns
length of the decoded field.
static __INLINE uint8_t bds_uint24_encode ( const uint32_t *  p_value,
uint8_t *  p_encoded_data 
)
static

Function for encoding a uint24 value.

Parameters
[in]p_valueValue to be encoded.
[out]p_encoded_dataBuffer where the encoded data is to be written.
Returns
Number of bytes written.
static __INLINE uint8_t bds_uint32_decode ( const uint8_t  len,
const uint8_t *  p_encoded_data,
uint32_t *  p_decoded_val 
)
static

Function for decoding a uint32 value.

Parameters
[in]lenlength of the field to be decoded.
[in]p_encoded_dataBuffer where the encoded data is stored.
[in]p_decoded_valpointer to the decoded value
Returns
length of the decoded field.
static __INLINE uint8_t bds_uint32_encode ( const uint32_t *  p_value,
uint8_t *  p_encoded_data 
)
static

Function for encoding a uint32 value.

Parameters
[in]p_valueValue to be encoded.
[out]p_encoded_dataBuffer where the encoded data is to be written.
Returns
Number of bytes written.
static __INLINE uint8_t bds_uint40_decode ( const uint8_t  len,
const uint8_t *  p_encoded_data,
uint64_t *  p_decoded_val 
)
static

Function for decoding a uint40 value.

Parameters
[in]lenlength of the field to be decoded.
[in]p_encoded_dataBuffer where the encoded data is stored.
[in]p_decoded_valpointer to the decoded value
Returns
length of the decoded field.
static __INLINE uint8_t bds_uint40_encode ( const uint64_t *  p_value,
uint8_t *  p_encoded_data 
)
static

Function for encoding a uint40 value.

Parameters
[in]p_valueValue to be encoded.
[out]p_encoded_dataBuffer where the encoded data is to be written.
Returns
Number of bytes written.
static __INLINE uint8_t bds_uint8_array_decode ( const uint8_t  len,
const uint8_t *  p_encoded_data,
uint8_array_t p_decoded_val 
)
static

Function for decoding a uint8_array value.

Parameters
[in]lenlength of the field to be decoded.
[in]p_encoded_dataBuffer where the encoded data is stored.
[in]p_decoded_valpointer to the decoded value
Returns
length of the decoded field.
static __INLINE uint8_t bds_uint8_array_encode ( const uint8_array_t p_value,
uint8_t *  p_encoded_data 
)
static

Function for encoding a uint8_array value.

Parameters
[in]p_valueValue to be encoded.
[out]p_encoded_dataBuffer where the encoded data is to be written.
static __INLINE bool is_address_from_stack ( void *  ptr)
static

Function for checking if provided address is located in stack space.

Parameters
[in]ptrPointer to be checked.
Returns
true if address is in stack space, false otherwise.
static __INLINE bool is_word_aligned ( void const *  p)
static

Function for checking if a pointer value is aligned to a 4 byte boundary.

Parameters
[in]pPointer value to be checked.
Returns
TRUE if pointer is aligned to a 4 byte boundary, FALSE otherwise.
static __INLINE uint16_t uint16_big_decode ( const uint8_t *  p_encoded_data)
static

Function for decoding a uint16 value in big-endian format.

Parameters
[in]p_encoded_dataBuffer where the encoded data is stored.
Returns
Decoded value.
static __INLINE uint16_t uint16_decode ( const uint8_t *  p_encoded_data)
static

Function for decoding a uint16 value.

Parameters
[in]p_encoded_dataBuffer where the encoded data is stored.
Returns
Decoded value.
static __INLINE uint8_t uint16_encode ( uint16_t  value,
uint8_t *  p_encoded_data 
)
static

Function for encoding a uint16 value.

Parameters
[in]valueValue to be encoded.
[out]p_encoded_dataBuffer where the encoded data is to be written.
Returns
Number of bytes written.
static __INLINE uint32_t uint24_decode ( const uint8_t *  p_encoded_data)
static

Function for decoding a three-byte value.

Parameters
[in]p_encoded_dataBuffer where the encoded data is stored.
Returns
Decoded value (uint32_t).
static __INLINE uint8_t uint24_encode ( uint32_t  value,
uint8_t *  p_encoded_data 
)
static

Function for encoding a three-byte value.

Parameters
[in]valueValue to be encoded.
[out]p_encoded_dataBuffer where the encoded data is to be written.
Returns
Number of bytes written.
static __INLINE uint32_t uint32_big_decode ( const uint8_t *  p_encoded_data)
static

Function for decoding a uint32 value in big-endian format.

Parameters
[in]p_encoded_dataBuffer where the encoded data is stored.
Returns
Decoded value.
static __INLINE uint8_t uint32_big_encode ( uint32_t  value,
uint8_t *  p_encoded_data 
)
static

Function for encoding a uint32 value in big-endian format.

Parameters
[in]valueValue to be encoded.
[out]p_encoded_dataBuffer where the encoded data will be written.
Returns
Number of bytes written.
static __INLINE uint32_t uint32_decode ( const uint8_t *  p_encoded_data)
static

Function for decoding a uint32 value.

Parameters
[in]p_encoded_dataBuffer where the encoded data is stored.
Returns
Decoded value.
static __INLINE uint8_t uint32_encode ( uint32_t  value,
uint8_t *  p_encoded_data 
)
static

Function for encoding a uint32 value.

Parameters
[in]valueValue to be encoded.
[out]p_encoded_dataBuffer where the encoded data is to be written.
Returns
Number of bytes written.
static __INLINE uint64_t uint48_decode ( const uint8_t *  p_encoded_data)
static

Function for decoding a uint48 value.

Parameters
[in]p_encoded_dataBuffer where the encoded data is stored.
Returns
Decoded value. (uint64_t)
static __INLINE uint8_t uint48_encode ( uint64_t  value,
uint8_t *  p_encoded_data 
)
static

Function for encoding a uint48 value.

Parameters
[in]valueValue to be encoded.
[out]p_encoded_dataBuffer where the encoded data is to be written.
Returns
Number of bytes written.
static __INLINE uint64_t value_rescale ( uint32_t  value,
uint32_t  old_unit_reversal,
uint16_t  new_unit_reversal 
)
static

Function for changing the value unit.

Parameters
[in]valueValue to be rescaled.
[in]old_unit_reversalReversal of the incoming unit.
[in]new_unit_reversalReversal of the desired unit.
Returns
Number of bytes written.

Documentation feedback | Developer Zone | Subscribe | Updated