Patched version of nrf51822 FOTA compatible driver, with GPTIO disabled, as it clashed with the mbed definitions...
Fork of nRF51822 by
nRF51Gap.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef __NRF51822_GAP_H__ 00018 #define __NRF51822_GAP_H__ 00019 00020 #include "mbed.h" 00021 #include "blecommon.h" 00022 #include "ble.h" 00023 #include "GapAdvertisingParams.h" 00024 #include "GapAdvertisingData.h" 00025 #include "public/Gap.h" 00026 00027 #include "nrf_soc.h" 00028 #include "ble_radio_notification.h " 00029 00030 /**************************************************************************/ 00031 /*! 00032 \brief 00033 00034 */ 00035 /**************************************************************************/ 00036 class nRF51Gap : public Gap 00037 { 00038 public: 00039 static nRF51Gap &getInstance() { 00040 static nRF51Gap m_instance; 00041 return m_instance; 00042 } 00043 00044 /* Functions that must be implemented from Gap */ 00045 virtual ble_error_t setAddress(addr_type_t type, const address_t address); 00046 virtual ble_error_t getAddress(addr_type_t *typeP, address_t address); 00047 virtual ble_error_t setAdvertisingData(const GapAdvertisingData &, const GapAdvertisingData &); 00048 00049 virtual uint16_t getMinAdvertisingInterval(void) const {return GAP_DURATION_UNITS_TO_MS(BLE_GAP_ADV_INTERVAL_MIN);} 00050 virtual uint16_t getMinNonConnectableAdvertisingInterval(void) const {return GAP_DURATION_UNITS_TO_MS(BLE_GAP_ADV_NONCON_INTERVAL_MIN);} 00051 virtual uint16_t getMaxAdvertisingInterval(void) const {return GAP_DURATION_UNITS_TO_MS(BLE_GAP_ADV_INTERVAL_MAX);} 00052 00053 virtual ble_error_t startAdvertising(const GapAdvertisingParams &); 00054 virtual ble_error_t stopAdvertising(void); 00055 virtual ble_error_t disconnect(DisconnectionReason_t reason); 00056 00057 virtual ble_error_t setDeviceName(const uint8_t *deviceName); 00058 virtual ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP); 00059 virtual ble_error_t setAppearance(uint16_t appearance); 00060 virtual ble_error_t getAppearance(uint16_t *appearanceP); 00061 00062 void setConnectionHandle(uint16_t con_handle); 00063 uint16_t getConnectionHandle(void); 00064 00065 virtual ble_error_t getPreferredConnectionParams(ConnectionParams_t *params); 00066 virtual ble_error_t setPreferredConnectionParams(const ConnectionParams_t *params); 00067 virtual ble_error_t updateConnectionParams(Handle_t handle, const ConnectionParams_t *params); 00068 00069 virtual void setOnRadioNotification(RadioNotificationEventCallback_t callback) { 00070 Gap::setOnRadioNotification(callback); 00071 ble_radio_notification_init(NRF_APP_PRIORITY_HIGH, NRF_RADIO_NOTIFICATION_DISTANCE_800US, onRadioNotification); 00072 } 00073 00074 private: 00075 uint16_t m_connectionHandle; 00076 nRF51Gap() { 00077 m_connectionHandle = BLE_CONN_HANDLE_INVALID; 00078 } 00079 00080 nRF51Gap(nRF51Gap const &); 00081 void operator=(nRF51Gap const &); 00082 }; 00083 00084 #endif // ifndef __NRF51822_GAP_H__
Generated on Tue Jul 12 2022 17:56:13 by 1.7.2