AndroidのBLEラジコンプロポアプリ「BLEPropo」と接続し、RCサーボとDCモータを制御するプログラムです。 BLE Nanoで動作を確認しています。 BLEPropo → https://github.com/lipoyang/BLEPropo

Dependencies:   BLE_API mbed

BLEを使ったAndroid用ラジコンプロポアプリ「BLEPropo」に対応するBLE Nano用ファームウェアです。
BLEPropoは、GitHubにて公開中。
https://github.com/lipoyang/BLEPropo
/media/uploads/lipoyang/blepropo_ui.png
ラジコンは、mbed HRM1017とRCサーボやDCモータを組み合わせて作ります。
/media/uploads/lipoyang/ministeer3.jpg
回路図
/media/uploads/lipoyang/ministeer3.pdf

Committer:
lipoyang
Date:
Sat Mar 14 12:02:48 2015 +0000
Revision:
5:7f89fca19a9e
-convert nRF51822 library to a folder

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lipoyang 5:7f89fca19a9e 1 /* mbed Microcontroller Library
lipoyang 5:7f89fca19a9e 2 * Copyright (c) 2006-2013 ARM Limited
lipoyang 5:7f89fca19a9e 3 *
lipoyang 5:7f89fca19a9e 4 * Licensed under the Apache License, Version 2.0 (the "License");
lipoyang 5:7f89fca19a9e 5 * you may not use this file except in compliance with the License.
lipoyang 5:7f89fca19a9e 6 * You may obtain a copy of the License at
lipoyang 5:7f89fca19a9e 7 *
lipoyang 5:7f89fca19a9e 8 * http://www.apache.org/licenses/LICENSE-2.0
lipoyang 5:7f89fca19a9e 9 *
lipoyang 5:7f89fca19a9e 10 * Unless required by applicable law or agreed to in writing, software
lipoyang 5:7f89fca19a9e 11 * distributed under the License is distributed on an "AS IS" BASIS,
lipoyang 5:7f89fca19a9e 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
lipoyang 5:7f89fca19a9e 13 * See the License for the specific language governing permissions and
lipoyang 5:7f89fca19a9e 14 * limitations under the License.
lipoyang 5:7f89fca19a9e 15 */
lipoyang 5:7f89fca19a9e 16
lipoyang 5:7f89fca19a9e 17 #ifndef __NRF51822_GAP_H__
lipoyang 5:7f89fca19a9e 18 #define __NRF51822_GAP_H__
lipoyang 5:7f89fca19a9e 19
lipoyang 5:7f89fca19a9e 20 #include "mbed.h"
lipoyang 5:7f89fca19a9e 21 #include "blecommon.h"
lipoyang 5:7f89fca19a9e 22 #include "ble.h"
lipoyang 5:7f89fca19a9e 23 #include "GapAdvertisingParams.h"
lipoyang 5:7f89fca19a9e 24 #include "GapAdvertisingData.h"
lipoyang 5:7f89fca19a9e 25 #include "public/Gap.h"
lipoyang 5:7f89fca19a9e 26
lipoyang 5:7f89fca19a9e 27 /**************************************************************************/
lipoyang 5:7f89fca19a9e 28 /*!
lipoyang 5:7f89fca19a9e 29 \brief
lipoyang 5:7f89fca19a9e 30
lipoyang 5:7f89fca19a9e 31 */
lipoyang 5:7f89fca19a9e 32 /**************************************************************************/
lipoyang 5:7f89fca19a9e 33 class nRF51Gap : public Gap
lipoyang 5:7f89fca19a9e 34 {
lipoyang 5:7f89fca19a9e 35 public:
lipoyang 5:7f89fca19a9e 36 static nRF51Gap &getInstance() {
lipoyang 5:7f89fca19a9e 37 static nRF51Gap m_instance;
lipoyang 5:7f89fca19a9e 38 return m_instance;
lipoyang 5:7f89fca19a9e 39 }
lipoyang 5:7f89fca19a9e 40
lipoyang 5:7f89fca19a9e 41 /* Functions that must be implemented from Gap */
lipoyang 5:7f89fca19a9e 42 virtual ble_error_t setAddress(addr_type_t type, const address_t address);
lipoyang 5:7f89fca19a9e 43 virtual ble_error_t getAddress(addr_type_t *typeP, address_t address);
lipoyang 5:7f89fca19a9e 44 virtual ble_error_t setAdvertisingData(const GapAdvertisingData &, const GapAdvertisingData &);
lipoyang 5:7f89fca19a9e 45 virtual ble_error_t startAdvertising(const GapAdvertisingParams &);
lipoyang 5:7f89fca19a9e 46 virtual ble_error_t stopAdvertising(void);
lipoyang 5:7f89fca19a9e 47 virtual ble_error_t disconnect(DisconnectionReason_t reason);
lipoyang 5:7f89fca19a9e 48
lipoyang 5:7f89fca19a9e 49 virtual ble_error_t setDeviceName(const uint8_t *deviceName);
lipoyang 5:7f89fca19a9e 50 virtual ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP);
lipoyang 5:7f89fca19a9e 51 virtual ble_error_t setAppearance(uint16_t appearance);
lipoyang 5:7f89fca19a9e 52 virtual ble_error_t getAppearance(uint16_t *appearanceP);
lipoyang 5:7f89fca19a9e 53
lipoyang 5:7f89fca19a9e 54 void setConnectionHandle(uint16_t con_handle);
lipoyang 5:7f89fca19a9e 55 uint16_t getConnectionHandle(void);
lipoyang 5:7f89fca19a9e 56
lipoyang 5:7f89fca19a9e 57 virtual ble_error_t getPreferredConnectionParams(ConnectionParams_t *params);
lipoyang 5:7f89fca19a9e 58 virtual ble_error_t setPreferredConnectionParams(const ConnectionParams_t *params);
lipoyang 5:7f89fca19a9e 59 virtual ble_error_t updateConnectionParams(Handle_t handle, const ConnectionParams_t *params);
lipoyang 5:7f89fca19a9e 60
lipoyang 5:7f89fca19a9e 61 private:
lipoyang 5:7f89fca19a9e 62 uint16_t m_connectionHandle;
lipoyang 5:7f89fca19a9e 63 nRF51Gap() {
lipoyang 5:7f89fca19a9e 64 m_connectionHandle = BLE_CONN_HANDLE_INVALID;
lipoyang 5:7f89fca19a9e 65 }
lipoyang 5:7f89fca19a9e 66
lipoyang 5:7f89fca19a9e 67 nRF51Gap(nRF51Gap const &);
lipoyang 5:7f89fca19a9e 68 void operator=(nRF51Gap const &);
lipoyang 5:7f89fca19a9e 69 };
lipoyang 5:7f89fca19a9e 70
lipoyang 5:7f89fca19a9e 71 #endif // ifndef __NRF51822_GAP_H__