|
Le-Guily
Firmware du robot auto-équilibré (Zephyr, STM32WB55)
|
Driver BLE. Plus de détails...
#include "ble.h"#include <zephyr/kernel.h>#include <zephyr/sys/printk.h>#include <zephyr/bluetooth/bluetooth.h>#include <zephyr/bluetooth/conn.h>#include <zephyr/bluetooth/gatt.h>#include <zephyr/bluetooth/uuid.h>Aller au code source de ce fichier.
Macros | |
| #define | LG_SVC_UUID BT_UUID_128_ENCODE(0x4c470001, 0x0000, 0x1000, 0x8000, 0x00805f9b34fb) |
| #define | LG_TELE_UUID BT_UUID_128_ENCODE(0x4c470002, 0x0000, 0x1000, 0x8000, 0x00805f9b34fb) |
| #define | LG_CMD_UUID BT_UUID_128_ENCODE(0x4c470003, 0x0000, 0x1000, 0x8000, 0x00805f9b34fb) |
Fonctions | |
| static void | adv_start (struct k_work *work) |
| static | K_WORK_DEFINE (adv_work, adv_start) |
| static void | connected (struct bt_conn *conn, uint8_t err) |
| static void | disconnected (struct bt_conn *conn, uint8_t reason) |
| static void | recycled (void) |
| BT_CONN_CB_DEFINE (conn_callbacks) | |
| static ssize_t | write_cmd (struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags) |
| BT_GATT_SERVICE_DEFINE (lg_svc, BT_GATT_PRIMARY_SERVICE(&svc_uuid), BT_GATT_CHARACTERISTIC(&tele_uuid.uuid, BT_GATT_CHRC_NOTIFY, BT_GATT_PERM_NONE, NULL, NULL, NULL), BT_GATT_CCC(NULL, BT_GATT_PERM_READ|BT_GATT_PERM_WRITE), BT_GATT_CHARACTERISTIC(&cmd_uuid.uuid, BT_GATT_CHRC_WRITE|BT_GATT_CHRC_WRITE_WITHOUT_RESP, BT_GATT_PERM_WRITE, NULL, write_cmd, NULL),) | |
| int | ble_send (const void *data, uint16_t len) |
| int | ble_init (void) |
Variables | |
| static const struct bt_data | ad [] |
| static const struct bt_uuid_128 | svc_uuid = BT_UUID_INIT_128(LG_SVC_UUID) |
| static const struct bt_uuid_128 | tele_uuid = BT_UUID_INIT_128(LG_TELE_UUID) |
| static const struct bt_uuid_128 | cmd_uuid = BT_UUID_INIT_128(LG_CMD_UUID) |
Driver BLE.
advertising sous le nom CONFIG_BT_DEVICE_NAME et service GATT Le-Guily (télémétrie en notification, commandes en écriture).
Le-Guily - Robot auto-équilibré à deux roues - CESI A4, projet SPI
Définition dans le fichier ble.c.
| #define LG_CMD_UUID BT_UUID_128_ENCODE(0x4c470003, 0x0000, 0x1000, 0x8000, 0x00805f9b34fb) |
| #define LG_SVC_UUID BT_UUID_128_ENCODE(0x4c470001, 0x0000, 0x1000, 0x8000, 0x00805f9b34fb) |
| #define LG_TELE_UUID BT_UUID_128_ENCODE(0x4c470002, 0x0000, 0x1000, 0x8000, 0x00805f9b34fb) |
| BT_CONN_CB_DEFINE | ( | conn_callbacks | ) |
| BT_GATT_SERVICE_DEFINE | ( | lg_svc | , |
| BT_GATT_PRIMARY_SERVICE & | svc_uuid, | ||
| BT_GATT_CHARACTERISTIC &.,,,,, | NULL, | ||
| BT_GATT_CCC(NULL, BT_GATT_PERM_READ|BT_GATT_PERM_WRITE) | , | ||
| BT_GATT_CHARACTERISTIC &.,|,,,, | NULL ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |