diff options
| author | Dan Halbert <halbert@halwitz.org> | 2019-01-07 22:46:20 -0500 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2019-01-07 22:46:20 -0500 |
| commit | f66f55b4ed4a008fd328a377acbf731e5f22d6de (patch) | |
| tree | e87692ea07561b067850df00434c1b083a62ee4d /ports/nrf/bluetooth | |
| parent | a77b2363eff14ae5b19c50a7d25b3db4ef6b200c (diff) | |
add CharacteristicBuffer; UART seems to work!
Diffstat (limited to 'ports/nrf/bluetooth')
| -rw-r--r-- | ports/nrf/bluetooth/ble_drv.c | 14 | ||||
| -rw-r--r-- | ports/nrf/bluetooth/ble_drv.h | 1 | ||||
| -rwxr-xr-x | ports/nrf/bluetooth/download_ble_stack.sh | 32 |
3 files changed, 15 insertions, 32 deletions
diff --git a/ports/nrf/bluetooth/ble_drv.c b/ports/nrf/bluetooth/ble_drv.c index 7082b1e59..cdc56319b 100644 --- a/ports/nrf/bluetooth/ble_drv.c +++ b/ports/nrf/bluetooth/ble_drv.c @@ -71,6 +71,20 @@ void ble_drv_add_event_handler(ble_drv_evt_handler_t func, void *param) { m_event_handlers = handler; } +void ble_drv_remove_event_handler(ble_drv_evt_handler_t func, void *param) { + event_handler_t *it = m_event_handlers; + event_handler_t **prev = &m_event_handlers; + while (it != NULL) { + if ((it->func == func) && (it->param == param)) { + // Splice out the matching handler. + *prev = it->next; + return; + } + prev = &(it->next); + it = it->next; + } +} + void SD_EVT_IRQHandler(void) { uint32_t evt_id; while (sd_evt_get(&evt_id) != NRF_ERROR_NOT_FOUND) { diff --git a/ports/nrf/bluetooth/ble_drv.h b/ports/nrf/bluetooth/ble_drv.h index 696aff1da..3d1f551c5 100644 --- a/ports/nrf/bluetooth/ble_drv.h +++ b/ports/nrf/bluetooth/ble_drv.h @@ -52,5 +52,6 @@ typedef void (*ble_drv_evt_handler_t)(ble_evt_t*, void*); void ble_drv_reset(); void ble_drv_add_event_handler(ble_drv_evt_handler_t func, void *param); +void ble_drv_remove_event_handler(ble_drv_evt_handler_t func, void *param); #endif // MICROPY_INCLUDED_NRF_BLUETOOTH_BLE_DRV_H diff --git a/ports/nrf/bluetooth/download_ble_stack.sh b/ports/nrf/bluetooth/download_ble_stack.sh deleted file mode 100755 index 7e35c0680..000000000 --- a/ports/nrf/bluetooth/download_ble_stack.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -function download_s132_nrf52_2_0_1 -{ - echo "" - echo "####################################" - echo "### Downloading s132_nrf52_2.0.1 ###" - echo "####################################" - echo "" - - mkdir -p "${1}/s132_nrf52_2.0.1" - cd "${1}/s132_nrf52_2.0.1" - wget https://www.nordicsemi.com/api/sitecore/Products/MedialibraryZipDownload2 --post-data="ids=863031714A574444AADFE444EBE5BA9B|&fileName=DeviceDownload" -O temp.zip - unzip -u temp.zip - unzip -u s132nrf52201.zip - rm temp.zip s132nrf52201.zip - cd - -} - -SCRIPT_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -if [ $# -eq 0 ]; then - echo "No Bluetooth LE stack defined, downloading all." - download_s132_nrf52_2_0_1 "${SCRIPT_DIR}" -else - case $1 in - "s132_nrf52_2_0_1" ) - download_s132_nrf52_2_0_1 "${SCRIPT_DIR}" ;; - esac -fi - -exit 0 |
