Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510
features/FEATURE_BLE/targets/TARGET_Maxim/MaximGap.h@1:f30bdcd2b33b, 2017-02-27 (annotated)
- Committer:
- jacobjohnson
- Date:
- Mon Feb 27 17:45:05 2017 +0000
- Revision:
- 1:f30bdcd2b33b
- Parent:
- 0:098463de4c5d
changed the inputscale from 1 to 7 in analogin_api.c. This will need to be changed later, and accessed from the main level, but for now this allows the adc to read a value from 0 to 3.7V, instead of just up to 1V.;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| group-onsemi | 0:098463de4c5d | 1 | /******************************************************************************* |
| group-onsemi | 0:098463de4c5d | 2 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
| group-onsemi | 0:098463de4c5d | 3 | * |
| group-onsemi | 0:098463de4c5d | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| group-onsemi | 0:098463de4c5d | 5 | * copy of this software and associated documentation files (the "Software"), |
| group-onsemi | 0:098463de4c5d | 6 | * to deal in the Software without restriction, including without limitation |
| group-onsemi | 0:098463de4c5d | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| group-onsemi | 0:098463de4c5d | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| group-onsemi | 0:098463de4c5d | 9 | * Software is furnished to do so, subject to the following conditions: |
| group-onsemi | 0:098463de4c5d | 10 | * |
| group-onsemi | 0:098463de4c5d | 11 | * The above copyright notice and this permission notice shall be included |
| group-onsemi | 0:098463de4c5d | 12 | * in all copies or substantial portions of the Software. |
| group-onsemi | 0:098463de4c5d | 13 | * |
| group-onsemi | 0:098463de4c5d | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| group-onsemi | 0:098463de4c5d | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| group-onsemi | 0:098463de4c5d | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| group-onsemi | 0:098463de4c5d | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
| group-onsemi | 0:098463de4c5d | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| group-onsemi | 0:098463de4c5d | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| group-onsemi | 0:098463de4c5d | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
| group-onsemi | 0:098463de4c5d | 21 | * |
| group-onsemi | 0:098463de4c5d | 22 | * Except as contained in this notice, the name of Maxim Integrated |
| group-onsemi | 0:098463de4c5d | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
| group-onsemi | 0:098463de4c5d | 24 | * Products, Inc. Branding Policy. |
| group-onsemi | 0:098463de4c5d | 25 | * |
| group-onsemi | 0:098463de4c5d | 26 | * The mere transfer of this software does not imply any licenses |
| group-onsemi | 0:098463de4c5d | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
| group-onsemi | 0:098463de4c5d | 28 | * trademarks, maskwork rights, or any other form of intellectual |
| group-onsemi | 0:098463de4c5d | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
| group-onsemi | 0:098463de4c5d | 30 | * ownership rights. |
| group-onsemi | 0:098463de4c5d | 31 | ******************************************************************************* |
| group-onsemi | 0:098463de4c5d | 32 | */ |
| group-onsemi | 0:098463de4c5d | 33 | |
| group-onsemi | 0:098463de4c5d | 34 | #ifndef _MAXIM_GAP_H_ |
| group-onsemi | 0:098463de4c5d | 35 | #define _MAXIM_GAP_H_ |
| group-onsemi | 0:098463de4c5d | 36 | |
| group-onsemi | 0:098463de4c5d | 37 | #include "mbed.h" |
| group-onsemi | 0:098463de4c5d | 38 | #include "ble/blecommon.h" |
| group-onsemi | 0:098463de4c5d | 39 | #include "ble/GapAdvertisingParams.h" |
| group-onsemi | 0:098463de4c5d | 40 | #include "ble/GapAdvertisingData.h" |
| group-onsemi | 0:098463de4c5d | 41 | #include "ble/Gap.h" |
| group-onsemi | 0:098463de4c5d | 42 | #include "ble/GapScanningParams.h" |
| group-onsemi | 0:098463de4c5d | 43 | #include "dm_api.h" |
| group-onsemi | 0:098463de4c5d | 44 | #include "att_api.h" |
| group-onsemi | 0:098463de4c5d | 45 | |
| group-onsemi | 0:098463de4c5d | 46 | /**************************************************************************/ |
| group-onsemi | 0:098463de4c5d | 47 | /*! |
| group-onsemi | 0:098463de4c5d | 48 | \brief |
| group-onsemi | 0:098463de4c5d | 49 | |
| group-onsemi | 0:098463de4c5d | 50 | */ |
| group-onsemi | 0:098463de4c5d | 51 | /**************************************************************************/ |
| group-onsemi | 0:098463de4c5d | 52 | class MaximGap : public Gap |
| group-onsemi | 0:098463de4c5d | 53 | { |
| group-onsemi | 0:098463de4c5d | 54 | public: |
| group-onsemi | 0:098463de4c5d | 55 | static MaximGap &getInstance(); |
| group-onsemi | 0:098463de4c5d | 56 | |
| group-onsemi | 0:098463de4c5d | 57 | /* Functions that must be implemented from Gap */ |
| group-onsemi | 0:098463de4c5d | 58 | virtual ble_error_t setAddress(AddressType_t type, const Address_t address); |
| group-onsemi | 0:098463de4c5d | 59 | virtual ble_error_t getAddress(AddressType_t *typeP, Address_t address); |
| group-onsemi | 0:098463de4c5d | 60 | virtual ble_error_t setAdvertisingData(const GapAdvertisingData &, const GapAdvertisingData &); |
| group-onsemi | 0:098463de4c5d | 61 | |
| group-onsemi | 0:098463de4c5d | 62 | #define BLE_GAP_ADV_INTERVAL_MIN 0x0020 /**< Minimum Advertising interval in 625 us units, i.e. 20 ms. */ |
| group-onsemi | 0:098463de4c5d | 63 | #define BLE_GAP_ADV_NONCON_INTERVAL_MIN 0x00A0 /**< Minimum Advertising interval in 625 us units for non connectable mode, i.e. 100 ms. */ |
| group-onsemi | 0:098463de4c5d | 64 | #define BLE_GAP_ADV_INTERVAL_MAX 0x4000 /**< Maximum Advertising interval in 625 us units, i.e. 10.24 s. */ |
| group-onsemi | 0:098463de4c5d | 65 | |
| group-onsemi | 0:098463de4c5d | 66 | virtual uint16_t getMinAdvertisingInterval(void) const { return BLE_GAP_ADV_INTERVAL_MIN; } |
| group-onsemi | 0:098463de4c5d | 67 | virtual uint16_t getMinNonConnectableAdvertisingInterval(void) const { return BLE_GAP_ADV_NONCON_INTERVAL_MIN; } |
| group-onsemi | 0:098463de4c5d | 68 | virtual uint16_t getMaxAdvertisingInterval(void) const { return BLE_GAP_ADV_INTERVAL_MAX; } |
| group-onsemi | 0:098463de4c5d | 69 | |
| group-onsemi | 0:098463de4c5d | 70 | virtual ble_error_t startAdvertising(const GapAdvertisingParams &); |
| group-onsemi | 0:098463de4c5d | 71 | virtual ble_error_t stopAdvertising(void); |
| group-onsemi | 0:098463de4c5d | 72 | virtual ble_error_t disconnect(Handle_t connectionHandle, DisconnectionReason_t reason); |
| group-onsemi | 0:098463de4c5d | 73 | virtual ble_error_t disconnect(DisconnectionReason_t reason); |
| group-onsemi | 0:098463de4c5d | 74 | |
| group-onsemi | 0:098463de4c5d | 75 | virtual ble_error_t setDeviceName(const uint8_t *deviceName); |
| group-onsemi | 0:098463de4c5d | 76 | virtual ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP); |
| group-onsemi | 0:098463de4c5d | 77 | virtual ble_error_t setAppearance(GapAdvertisingData::Appearance appearance); |
| group-onsemi | 0:098463de4c5d | 78 | virtual ble_error_t getAppearance(GapAdvertisingData::Appearance *appearanceP); |
| group-onsemi | 0:098463de4c5d | 79 | |
| group-onsemi | 0:098463de4c5d | 80 | virtual ble_error_t setTxPower(int8_t txPower); |
| group-onsemi | 0:098463de4c5d | 81 | virtual void getPermittedTxPowerValues(const int8_t **valueArrayPP, size_t *countP); |
| group-onsemi | 0:098463de4c5d | 82 | |
| group-onsemi | 0:098463de4c5d | 83 | void setConnectionHandle(uint16_t m_connectionHandle); |
| group-onsemi | 0:098463de4c5d | 84 | uint16_t getConnectionHandle(void); |
| group-onsemi | 0:098463de4c5d | 85 | |
| group-onsemi | 0:098463de4c5d | 86 | virtual ble_error_t getPreferredConnectionParams(ConnectionParams_t *params); |
| group-onsemi | 0:098463de4c5d | 87 | virtual ble_error_t setPreferredConnectionParams(const ConnectionParams_t *params); |
| group-onsemi | 0:098463de4c5d | 88 | virtual ble_error_t updateConnectionParams(Handle_t handle, const ConnectionParams_t *params); |
| group-onsemi | 0:098463de4c5d | 89 | |
| group-onsemi | 0:098463de4c5d | 90 | virtual ble_error_t startRadioScan(const GapScanningParams &scanningParams); |
| group-onsemi | 0:098463de4c5d | 91 | virtual ble_error_t stopScan(void); |
| group-onsemi | 0:098463de4c5d | 92 | |
| group-onsemi | 0:098463de4c5d | 93 | void advertisingStopped(void); |
| group-onsemi | 0:098463de4c5d | 94 | |
| group-onsemi | 0:098463de4c5d | 95 | private: |
| group-onsemi | 0:098463de4c5d | 96 | uint16_t m_connectionHandle; |
| group-onsemi | 0:098463de4c5d | 97 | addr_type_t m_type; |
| group-onsemi | 0:098463de4c5d | 98 | MaximGap() { |
| group-onsemi | 0:098463de4c5d | 99 | m_connectionHandle = DM_CONN_ID_NONE; |
| group-onsemi | 0:098463de4c5d | 100 | m_type = BLEProtocol::AddressType::RANDOM_STATIC; |
| group-onsemi | 0:098463de4c5d | 101 | } |
| group-onsemi | 0:098463de4c5d | 102 | |
| group-onsemi | 0:098463de4c5d | 103 | MaximGap(MaximGap const &); |
| group-onsemi | 0:098463de4c5d | 104 | void operator=(MaximGap const &); |
| group-onsemi | 0:098463de4c5d | 105 | |
| group-onsemi | 0:098463de4c5d | 106 | uint8_t advDataCache[HCI_LEN_LE_SET_ADV_DATA]; |
| group-onsemi | 0:098463de4c5d | 107 | uint8_t scanResponseCache[HCI_LEN_LE_SET_SCAN_RESP_DATA]; |
| group-onsemi | 0:098463de4c5d | 108 | int advDataLen; |
| group-onsemi | 0:098463de4c5d | 109 | int scanResponseLen; |
| group-onsemi | 0:098463de4c5d | 110 | }; |
| group-onsemi | 0:098463de4c5d | 111 | |
| group-onsemi | 0:098463de4c5d | 112 | #endif /* _MAXIM_GAP_H_ */ |