Microchip® Advanced Software Framework

ble_sdk/utils/ble_utils.h File Reference

BLE Utils declarations.

Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>

Macros

#define ALL_UNUSED(...)   ALL_UNUSED_IMPL( VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__ )
 
#define ALL_UNUSED_IMPL(nargs)   ALL_UNUSED_IMPL_(nargs)
 
#define ALL_UNUSED_IMPL_(nargs)   UNUSED ## nargs
 
#define BLE_ASSERT   (true)
 
#define ble_assert(expr)
 
#define BLE_ROLE_ALL   0x0F
 Device has all role, both peripheral and central. More...
 
#define BLE_ROLE_BROADCASTER   0x02
 Broadcaster role. More...
 
#define BLE_ROLE_CENTRAL   0x05
 Master/Central role. More...
 
#define BLE_ROLE_OBSERVER   0x01
 Observer role. More...
 
#define BLE_ROLE_PERIPHERAL   0x0A
 Peripheral/Slave role. More...
 
#define BLE_SDK_BUILD_NO(version)   (version & 0x0000FFFF)
 
#define BLE_SDK_MAJOR_NO(version)   ((version >> 28) & 0x0000000F)
 BluSDK version. More...
 
#define BLE_SDK_MINOR_NO(version)   ((version >> 24) & 0x0000000F)
 
#define BLE_SDK_MINOR_NO_INC   (1)
 
#define BLE_SDK_VERSION   BLUSDK_VER_6_1
 
#define BLU_SDK_API
 
#define BLUSDK_VER_6_0   (0x60000000)
 
#define BLUSDK_VER_6_1   (0x61000000)
 
#define BTLC1000_MR   0x00
 
#define BTLC1000_ZR   0x01
 
#define DBG_LOG
 
#define DBG_LOG_ADV
 
#define DBG_LOG_CONT   printf
 
#define DBG_LOG_CONT_DEV   ALL_UNUSED
 
#define DBG_LOG_DEV   ALL_UNUSED
 
#define DBG_LOG_PTS   ALL_UNUSED
 
#define IEEE11073_EXPONENT   (0xFF000000)
 
#define IEEE754_MANTISA(val)   ((uint32_t)(val * 10))
 
#define IEEE754_TO_IEEE11073_FLOAT(f_val)
 
#define NIBBLE2ASCII(nibble)   (((nibble < 0x0A) ? (nibble + '0') : (nibble + 0x57)))
 
#define UNUSED1(x)   (void)(x)
 
#define UNUSED2(x, y)   (void)(x),(void)(y)
 
#define UNUSED3(x, y, z)   (void)(x),(void)(y),(void)(z)
 
#define UNUSED4(a, x, y, z)   (void)(a),(void)(x),(void)(y),(void)(z)
 
#define UNUSED5(a, b, x, y, z)   (void)(a),(void)(b),(void)(x),(void)(y),(void)(z)
 
#define UNUSED6(a, b, c, x, y, z)   (void)(a),(void)(b),(void)(c),(void)(x),(void)(y),(void)(z)
 
#define UNUSED7(a, b, c, d, x, y, z)   (void)(a),(void)(b),(void)(c),(void)(d),(void)(x),(void)(y),(void)(z)
 
#define UNUSED8(a, b, c, d, e, x, y, z)   (void)(a),(void)(b),(void)(c),(void)(d),(void)(e),(void)(x),(void)(y),(void)(z)
 
#define VA_NUM_ARGS(...)   VA_NUM_ARGS_IMPL(__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1)
 
#define VA_NUM_ARGS_IMPL(_1, _2, _3, _4, _5, _6, _7, _8, N,...)   N
 

Functions

static uint32_t convert_ieee754_ieee11073_float (float f_val)
 
static void dump_hex_buffer (void *buf, uint32_t len)
 
uint8_t getchar_timeout (uint32_t timeout)
 

#define ALL_UNUSED (   ...)    ALL_UNUSED_IMPL( VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__ )
#define ALL_UNUSED_IMPL (   nargs)    ALL_UNUSED_IMPL_(nargs)
#define ALL_UNUSED_IMPL_ (   nargs)    UNUSED ## nargs
#define BLE_ASSERT   (true)
#define ble_assert (   expr)
Value:
{\
if (!(expr)) while (true);\
}
if((SERIAL_RX_BUF_SIZE_HOST-1)==serial_rx_buf_tail)
Definition: sio2host.c:258
#define true
Definition: compiler.h:363
#define BLE_ROLE_ALL   0x0F

Device has all role, both peripheral and central.

#define BLE_ROLE_BROADCASTER   0x02

Broadcaster role.

#define BLE_ROLE_CENTRAL   0x05

Master/Central role.

#define BLE_ROLE_OBSERVER   0x01

Observer role.

#define BLE_ROLE_PERIPHERAL   0x0A

Peripheral/Slave role.

#define BLE_SDK_BUILD_NO (   version)    (version & 0x0000FFFF)
#define BLE_SDK_MAJOR_NO (   version)    ((version >> 28) & 0x0000000F)

BluSDK version.

#define BLE_SDK_MINOR_NO (   version)    ((version >> 24) & 0x0000000F)
#define BLE_SDK_MINOR_NO_INC   (1)
#define BLE_SDK_VERSION   BLUSDK_VER_6_1
#define BLU_SDK_API
#define BLUSDK_VER_6_0   (0x60000000)
#define BLUSDK_VER_6_1   (0x61000000)
#define BTLC1000_MR   0x00
#define BTLC1000_ZR   0x01
#define DBG_LOG
Value:
printf("\r\n");\
printf
#define DBG_LOG_ADV
Value:
printf("\r\nBLE-ADV: ");\
printf
#define DBG_LOG_CONT   printf

Referenced by dump_hex_buffer().

#define DBG_LOG_CONT_DEV   ALL_UNUSED
#define DBG_LOG_DEV   ALL_UNUSED
#define DBG_LOG_PTS   ALL_UNUSED
#define IEEE11073_EXPONENT   (0xFF000000)
#define IEEE754_MANTISA (   val)    ((uint32_t)(val * 10))
#define IEEE754_TO_IEEE11073_FLOAT (   f_val)
Value:
#define IEEE754_MANTISA(val)
Definition: ble_sdk/utils/ble_utils.h:121
#define IEEE11073_EXPONENT
Definition: ble_sdk/utils/ble_utils.h:119

Referenced by convert_ieee754_ieee11073_float().

#define NIBBLE2ASCII (   nibble)    (((nibble < 0x0A) ? (nibble + '0') : (nibble + 0x57)))
#define UNUSED1 (   x)    (void)(x)
#define UNUSED2 (   x,
 
)    (void)(x),(void)(y)
#define UNUSED3 (   x,
  y,
 
)    (void)(x),(void)(y),(void)(z)
#define UNUSED4 (   a,
  x,
  y,
 
)    (void)(a),(void)(x),(void)(y),(void)(z)
#define UNUSED5 (   a,
  b,
  x,
  y,
 
)    (void)(a),(void)(b),(void)(x),(void)(y),(void)(z)
#define UNUSED6 (   a,
  b,
  c,
  x,
  y,
 
)    (void)(a),(void)(b),(void)(c),(void)(x),(void)(y),(void)(z)
#define UNUSED7 (   a,
  b,
  c,
  d,
  x,
  y,
 
)    (void)(a),(void)(b),(void)(c),(void)(d),(void)(x),(void)(y),(void)(z)
#define UNUSED8 (   a,
  b,
  c,
  d,
  e,
  x,
  y,
 
)    (void)(a),(void)(b),(void)(c),(void)(d),(void)(e),(void)(x),(void)(y),(void)(z)
#define VA_NUM_ARGS (   ...)    VA_NUM_ARGS_IMPL(__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1)
#define VA_NUM_ARGS_IMPL (   _1,
  _2,
  _3,
  _4,
  _5,
  _6,
  _7,
  _8,
  N,
  ... 
)    N

static uint32_t convert_ieee754_ieee11073_float ( float  f_val)
inlinestatic
static void dump_hex_buffer ( void *  buf,
uint32_t  len 
)
inlinestatic

References buffer, and DBG_LOG_CONT.

uint8_t getchar_timeout ( uint32_t  timeout)