[<<][zephyr][>>][..]
Fri May 8 14:07:51 EDT 2020

Compiling BLE example

Example has bitrotted, so track down some errors.

[  9%] Building C object CMakeFiles/app.dir/src/main.c.obj
In file included from /home/tom/exo/zephyr/ble/src/main.c:18:
/home/tom/exo/zephyr/ble/src/main.c:67:17: warning: initialization of 'void (*)(const struct bt_gatt_attr *, u16_t)' {aka 'void (*)(const struct bt_gatt_attr *, short unsigned int)'} from incompatible pointer type 'struct bt_gatt_ccc_cfg *' [-Wincompatible-pointer-types]
   67 |     BT_GATT_CCC(T_ccc_cfg, T_ccc_cfg_changed),
      |


void (*)(const struct bt_gatt_attr *, u16_t)
aka
void (*)(const struct bt_gatt_attr *, short unsigned int)
!=
struct bt_gatt_ccc_cfg *

That's odd.

Ok I'm going to have to index this.

Indexed.

So what is going on here?

    BT_GATT_CCC(T_ccc_cfg, T_ccc_cfg_changed),

gatt.h says:

/** @def BT_GATT_CCC
 *  @brief Client Characteristic Configuration Declaration Macro.
 *
 *  Helper macro to declare a CCC attribute.
 *
 *  @param _changed Configuration changed callback.
 *  @param _perm CCC access permissions.
 */
#define BT_GATT_CCC(_changed, _perm)				\
	BT_GATT_CCC_MANAGED(((struct _bt_gatt_ccc[])			\
		{BT_GATT_CCC_INITIALIZER(_changed, NULL, NULL)}), _perm)

So this is just another macro.

API docs from
https://docs.zephyrproject.org/1.9.0/api/bluetooth.html

say:

BT_GATT_CCC(_cfg, _cfg_changed)

    Client Characteristic Configuration Declaration Macro.

    Helper macro to declare a CCC attribute.

    Parameters

            _cfg: Initial configuration.
            _cfg_changed: Configuration changed callback.



So what am I running?

tom@panda:/nix/exo/zephyr-project/zephyr$ cat VERSION 
VERSION_MAJOR = 2
VERSION_MINOR = 2
PATCHLEVEL = 99
VERSION_TWEAK = 0
EXTRAVERSION =


This is the old definition from:

https://github.com/zephyrproject-rtos/zephyr/blob/v1.9-branch/include/bluetooth/gatt.h


/** @def BT_GATT_CCC
 *  @brief Client Characteristic Configuration Declaration Macro.
 *
 *  Helper macro to declare a CCC attribute.
 *
 *  @param _cfg Initial configuration.
 *  @param _cfg_changed Configuration changed callback.
 */
#define BT_GATT_CCC(_cfg, _cfg_changed)					\
{									\
	.uuid = BT_UUID_GATT_CCC,					\
	.perm = BT_GATT_PERM_READ | BT_GATT_PERM_WRITE,			\
	.read = bt_gatt_attr_read_ccc,					\
	.write = bt_gatt_attr_write_ccc,				\
	.user_data = (&(struct _bt_gatt_ccc) { .cfg = _cfg,		\
					       .cfg_len = ARRAY_SIZE(_cfg), \
					       .cfg_changed = _cfg_changed, }),\
}


It's probably going to be easier to start from another example.







[Reply][About]
[<<][zephyr][>>][..]