summaryrefslogtreecommitdiff
path: root/ports/nrf/bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'ports/nrf/bluetooth')
-rw-r--r--ports/nrf/bluetooth/ble_drv.c12
-rw-r--r--ports/nrf/bluetooth/ble_drv.h2
-rw-r--r--ports/nrf/bluetooth/ble_uart.c4
3 files changed, 12 insertions, 6 deletions
diff --git a/ports/nrf/bluetooth/ble_drv.c b/ports/nrf/bluetooth/ble_drv.c
index 16475e4b3..7dbb31582 100644
--- a/ports/nrf/bluetooth/ble_drv.c
+++ b/ports/nrf/bluetooth/ble_drv.c
@@ -43,7 +43,7 @@
nrf_nvic_state_t nrf_nvic_state = { 0 };
// Flag indicating progress of internal flash operation.
-sd_flash_operation_status_t sd_flash_operation_status;
+volatile sd_flash_operation_status_t sd_flash_operation_status;
__attribute__((aligned(4)))
static uint8_t m_ble_evt_buf[sizeof(ble_evt_t) + (BLE_GATT_ATT_MTU_DEFAULT)];
@@ -134,6 +134,9 @@ void SD_EVT_IRQHandler(void) {
}
ble_evt_t* event = (ble_evt_t *)m_ble_evt_buf;
+ #if CIRCUITPY_VERBOSE_BLE
+ mp_printf(&mp_plat_print, "BLE event: 0x%04x\n", event->header.evt_id);
+ #endif
if (supervisor_bluetooth_hook(event)) {
continue;
@@ -145,8 +148,11 @@ void SD_EVT_IRQHandler(void) {
done = it->func(event, it->param) || done;
it = it->next;
}
- if (!done) {
- //mp_printf(&mp_plat_print, "Unhandled ble event: 0x%04x\n", event->header.evt_id);
+ #if CIRCUITPY_VERBOSE_BLE
+ if (event->header.evt_id == BLE_GATTS_EVT_WRITE) {
+ ble_gatts_evt_write_t* write_evt = &event->evt.gatts_evt.params.write;
+ mp_printf(&mp_plat_print, "Write to: UUID(0x%04x) handle %x of length %d auth %x\n", write_evt->uuid.uuid, write_evt->handle, write_evt->len, write_evt->auth_required);
}
+ #endif
}
}
diff --git a/ports/nrf/bluetooth/ble_drv.h b/ports/nrf/bluetooth/ble_drv.h
index 7716cab8b..91990da6d 100644
--- a/ports/nrf/bluetooth/ble_drv.h
+++ b/ports/nrf/bluetooth/ble_drv.h
@@ -59,7 +59,7 @@ typedef enum {
} sd_flash_operation_status_t;
// Flag indicating progress of internal flash operation.
-extern sd_flash_operation_status_t sd_flash_operation_status;
+extern volatile sd_flash_operation_status_t sd_flash_operation_status;
typedef struct ble_drv_evt_handler_entry {
struct ble_drv_evt_handler_entry *next;
diff --git a/ports/nrf/bluetooth/ble_uart.c b/ports/nrf/bluetooth/ble_uart.c
index 787a2a117..1e7a319bd 100644
--- a/ports/nrf/bluetooth/ble_uart.c
+++ b/ports/nrf/bluetooth/ble_uart.c
@@ -40,7 +40,7 @@
#include "shared-bindings/_bleio/Service.h"
#include "shared-bindings/_bleio/UUID.h"
-#if (MICROPY_PY_BLE_NUS == 1)
+#if CIRCUITPY_SERIAL_BLE
static const char default_name[] = "CP-REPL"; // max 8 chars or uuid won't fit in adv data
static const char NUS_UUID[] = "6e400001-b5a3-f393-e0a9-e50e24dcca9e";
@@ -190,4 +190,4 @@ void mp_hal_stdout_tx_strn(const char *str, size_t len) {
}
}
-#endif // MICROPY_PY_BLE_NUS
+#endif // CIRCUITPY_SERIAL_BLE