22 lines
498 B
Plaintext
22 lines
498 B
Plaintext
static void button_callback(const struct device *gpiob, struct gpio_callback *cb, uint32_t pins)
|
|
{
|
|
int err;
|
|
|
|
LOG_INF("Button pressed");
|
|
if (ble_conn) {
|
|
if (notify_enable) {
|
|
err = bt_gatt_notify(NULL, &stsensor_svc.attrs[4], &but_val, sizeof(but_val));
|
|
if (err) {
|
|
LOG_ERR("Notify error: %d", err);
|
|
} else {
|
|
LOG_INF("Send notify ok");
|
|
but_val = (but_val == 0) ? 0x100 : 0;
|
|
}
|
|
} else {
|
|
LOG_INF("Notify not enabled");
|
|
}
|
|
} else {
|
|
LOG_INF("BLE not connected");
|
|
}
|
|
}
|