test firmware for BLE Micro V1.3 1. test io, vcc and ble 2. act as a UART to BLE bridge
Dependencies: BLE_API Buffer mbed
Fork of BLE_LEDBlinker by
nRF51822/source/nRF5xn.h@12:c4090cb58976, 2015-12-08 (annotated)
- Committer:
- arch
- Date:
- Tue Dec 08 08:34:22 2015 +0000
- Revision:
- 12:c4090cb58976
- Parent:
- 11:c8cbc4bc2c17
fix USBTX/USBRX pins config
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
arch | 11:c8cbc4bc2c17 | 1 | /* mbed Microcontroller Library |
arch | 11:c8cbc4bc2c17 | 2 | * Copyright (c) 2006-2013 ARM Limited |
arch | 11:c8cbc4bc2c17 | 3 | * |
arch | 11:c8cbc4bc2c17 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
arch | 11:c8cbc4bc2c17 | 5 | * you may not use this file except in compliance with the License. |
arch | 11:c8cbc4bc2c17 | 6 | * You may obtain a copy of the License at |
arch | 11:c8cbc4bc2c17 | 7 | * |
arch | 11:c8cbc4bc2c17 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
arch | 11:c8cbc4bc2c17 | 9 | * |
arch | 11:c8cbc4bc2c17 | 10 | * Unless required by applicable law or agreed to in writing, software |
arch | 11:c8cbc4bc2c17 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
arch | 11:c8cbc4bc2c17 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
arch | 11:c8cbc4bc2c17 | 13 | * See the License for the specific language governing permissions and |
arch | 11:c8cbc4bc2c17 | 14 | * limitations under the License. |
arch | 11:c8cbc4bc2c17 | 15 | */ |
arch | 11:c8cbc4bc2c17 | 16 | |
arch | 11:c8cbc4bc2c17 | 17 | #ifndef __NRF51822_H__ |
arch | 11:c8cbc4bc2c17 | 18 | #define __NRF51822_H__ |
arch | 11:c8cbc4bc2c17 | 19 | |
arch | 11:c8cbc4bc2c17 | 20 | #include "ble/BLE.h" |
arch | 11:c8cbc4bc2c17 | 21 | #include "ble/blecommon.h" |
arch | 11:c8cbc4bc2c17 | 22 | #include "ble/BLEInstanceBase.h" |
arch | 11:c8cbc4bc2c17 | 23 | |
arch | 11:c8cbc4bc2c17 | 24 | #include "nRF5xGap.h" |
arch | 11:c8cbc4bc2c17 | 25 | #include "nRF5xGattServer.h" |
arch | 11:c8cbc4bc2c17 | 26 | #include "nRF5xGattClient.h" |
arch | 11:c8cbc4bc2c17 | 27 | #include "nRF5xSecurityManager.h" |
arch | 11:c8cbc4bc2c17 | 28 | |
arch | 11:c8cbc4bc2c17 | 29 | #include "btle.h" |
arch | 11:c8cbc4bc2c17 | 30 | |
arch | 11:c8cbc4bc2c17 | 31 | class nRF5xn : public BLEInstanceBase |
arch | 11:c8cbc4bc2c17 | 32 | { |
arch | 11:c8cbc4bc2c17 | 33 | public: |
arch | 11:c8cbc4bc2c17 | 34 | nRF5xn(void); |
arch | 11:c8cbc4bc2c17 | 35 | virtual ~nRF5xn(void); |
arch | 11:c8cbc4bc2c17 | 36 | |
arch | 11:c8cbc4bc2c17 | 37 | virtual ble_error_t init(BLE::InstanceID_t instanceID, FunctionPointerWithContext<BLE::InitializationCompleteCallbackContext *> callback); |
arch | 11:c8cbc4bc2c17 | 38 | virtual bool hasInitialized(void) const { |
arch | 11:c8cbc4bc2c17 | 39 | return initialized; |
arch | 11:c8cbc4bc2c17 | 40 | } |
arch | 11:c8cbc4bc2c17 | 41 | virtual ble_error_t shutdown(void); |
arch | 11:c8cbc4bc2c17 | 42 | virtual const char *getVersion(void); |
arch | 11:c8cbc4bc2c17 | 43 | |
arch | 11:c8cbc4bc2c17 | 44 | virtual Gap &getGap() { |
arch | 11:c8cbc4bc2c17 | 45 | return nRF5xGap::getInstance(); |
arch | 11:c8cbc4bc2c17 | 46 | }; |
arch | 11:c8cbc4bc2c17 | 47 | virtual const Gap &getGap() const { |
arch | 11:c8cbc4bc2c17 | 48 | return nRF5xGap::getInstance(); |
arch | 11:c8cbc4bc2c17 | 49 | }; |
arch | 11:c8cbc4bc2c17 | 50 | virtual GattServer &getGattServer() { |
arch | 11:c8cbc4bc2c17 | 51 | return nRF5xGattServer::getInstance(); |
arch | 11:c8cbc4bc2c17 | 52 | }; |
arch | 11:c8cbc4bc2c17 | 53 | virtual const GattServer &getGattServer() const { |
arch | 11:c8cbc4bc2c17 | 54 | return nRF5xGattServer::getInstance(); |
arch | 11:c8cbc4bc2c17 | 55 | }; |
arch | 11:c8cbc4bc2c17 | 56 | virtual GattClient &getGattClient() { |
arch | 11:c8cbc4bc2c17 | 57 | return nRF5xGattClient::getInstance(); |
arch | 11:c8cbc4bc2c17 | 58 | } |
arch | 11:c8cbc4bc2c17 | 59 | virtual const SecurityManager &getSecurityManager() const { |
arch | 11:c8cbc4bc2c17 | 60 | return nRF5xSecurityManager::getInstance(); |
arch | 11:c8cbc4bc2c17 | 61 | } |
arch | 11:c8cbc4bc2c17 | 62 | virtual SecurityManager &getSecurityManager() { |
arch | 11:c8cbc4bc2c17 | 63 | return nRF5xSecurityManager::getInstance(); |
arch | 11:c8cbc4bc2c17 | 64 | } |
arch | 11:c8cbc4bc2c17 | 65 | virtual void waitForEvent(void); |
arch | 11:c8cbc4bc2c17 | 66 | |
arch | 11:c8cbc4bc2c17 | 67 | private: |
arch | 11:c8cbc4bc2c17 | 68 | bool initialized; |
arch | 11:c8cbc4bc2c17 | 69 | BLE::InstanceID_t instanceID; |
arch | 11:c8cbc4bc2c17 | 70 | }; |
arch | 11:c8cbc4bc2c17 | 71 | |
arch | 11:c8cbc4bc2c17 | 72 | #endif |