summaryrefslogtreecommitdiffstatshomepage
path: root/extmod/nimble/modbluetooth_nimble.c
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2020-05-11 21:20:07 +1000
committerDamien George <damien.p.george@gmail.com>2020-06-05 14:04:20 +1000
commite6881f08292d03f089185718c131f543d095089b (patch)
tree1819a0b92c14bdeb3289e49c799454ba3d6cf43c /extmod/nimble/modbluetooth_nimble.c
parent02cc4462b70729a42cb127c840fee891dd08a0d4 (diff)
downloadmicropython-e6881f08292d03f089185718c131f543d095089b.tar.gz
micropython-e6881f08292d03f089185718c131f543d095089b.zip
extmod/modbluetooth: Make modbluetooth event not a bitfield.
There doesn't appear to be any use for only triggering on specific events, so it's just easier to number them sequentially. This makes them smaller values so they take up only 1 byte in the ringbuf, only 1 byte for the opcode in the bytecode, and makes room for more events. Also add a couple of new event types that need to be implemented (to avoid re-numbering later). And rename _COMPLETE and _STATUS to _DONE for consistency. In the future the "trigger" keyword argument can be reinstated by requiring the user to compute the bitmask, eg: ble.irq(handler, 1 << _IRQ_SCAN_RESULT | 1 << _IRQ_SCAN_DONE)
Diffstat (limited to 'extmod/nimble/modbluetooth_nimble.c')
-rw-r--r--extmod/nimble/modbluetooth_nimble.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/extmod/nimble/modbluetooth_nimble.c b/extmod/nimble/modbluetooth_nimble.c
index e2e95aa74e..656b99a564 100644
--- a/extmod/nimble/modbluetooth_nimble.c
+++ b/extmod/nimble/modbluetooth_nimble.c
@@ -4,7 +4,7 @@
* The MIT License (MIT)
*
* Copyright (c) 2019 Damien P. George
- * Copyright (c) 2019 Jim Mussared
+ * Copyright (c) 2019-2020 Jim Mussared
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -612,7 +612,7 @@ int mp_bluetooth_gatts_set_buffer(uint16_t value_handle, size_t len, bool append
#if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
-STATIC void gattc_on_data_available(uint16_t event, uint16_t conn_handle, uint16_t value_handle, const struct os_mbuf *om) {
+STATIC void gattc_on_data_available(uint8_t event, uint16_t conn_handle, uint16_t value_handle, const struct os_mbuf *om) {
size_t len = OS_MBUF_PKTLEN(om);
mp_uint_t atomic_state;
len = mp_bluetooth_gattc_on_data_available_start(event, conn_handle, value_handle, len, &atomic_state);