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

Dependencies:   BLE_API mbed

Fork of BLE_RCBController2 by Junichi Katsu

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

Committer:
jksoft
Date:
Wed Aug 20 13:24:20 2014 +0000
Revision:
1:48f6e08a3ac2
2014.08.20?????BLE?????????????; ???mbed?????????????????; mbed HRM1017; Nordic nRF51822

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 1:48f6e08a3ac2 1 /* mbed Microcontroller Library
jksoft 1:48f6e08a3ac2 2 * Copyright (c) 2006-2013 ARM Limited
jksoft 1:48f6e08a3ac2 3 *
jksoft 1:48f6e08a3ac2 4 * Licensed under the Apache License, Version 2.0 (the "License");
jksoft 1:48f6e08a3ac2 5 * you may not use this file except in compliance with the License.
jksoft 1:48f6e08a3ac2 6 * You may obtain a copy of the License at
jksoft 1:48f6e08a3ac2 7 *
jksoft 1:48f6e08a3ac2 8 * http://www.apache.org/licenses/LICENSE-2.0
jksoft 1:48f6e08a3ac2 9 *
jksoft 1:48f6e08a3ac2 10 * Unless required by applicable law or agreed to in writing, software
jksoft 1:48f6e08a3ac2 11 * distributed under the License is distributed on an "AS IS" BASIS,
jksoft 1:48f6e08a3ac2 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
jksoft 1:48f6e08a3ac2 13 * See the License for the specific language governing permissions and
jksoft 1:48f6e08a3ac2 14 * limitations under the License.
jksoft 1:48f6e08a3ac2 15 */
jksoft 1:48f6e08a3ac2 16
jksoft 1:48f6e08a3ac2 17 #ifndef __NRF51822_GATT_SERVER_H__
jksoft 1:48f6e08a3ac2 18 #define __NRF51822_GATT_SERVER_H__
jksoft 1:48f6e08a3ac2 19
jksoft 1:48f6e08a3ac2 20 #include "mbed.h"
jksoft 1:48f6e08a3ac2 21 #include "blecommon.h"
jksoft 1:48f6e08a3ac2 22 #include "ble.h" /* nordic ble */
jksoft 1:48f6e08a3ac2 23 #include "GattService.h"
jksoft 1:48f6e08a3ac2 24 #include "public/GattServer.h"
jksoft 1:48f6e08a3ac2 25
jksoft 1:48f6e08a3ac2 26 #define BLE_TOTAL_CHARACTERISTICS 10
jksoft 1:48f6e08a3ac2 27
jksoft 1:48f6e08a3ac2 28 class nRF51GattServer : public GattServer
jksoft 1:48f6e08a3ac2 29 {
jksoft 1:48f6e08a3ac2 30 public:
jksoft 1:48f6e08a3ac2 31 static nRF51GattServer &getInstance() {
jksoft 1:48f6e08a3ac2 32 static nRF51GattServer m_instance;
jksoft 1:48f6e08a3ac2 33 return m_instance;
jksoft 1:48f6e08a3ac2 34 }
jksoft 1:48f6e08a3ac2 35
jksoft 1:48f6e08a3ac2 36 /* Functions that must be implemented from GattServer */
jksoft 1:48f6e08a3ac2 37 virtual ble_error_t addService(GattService &);
jksoft 1:48f6e08a3ac2 38 virtual ble_error_t readValue(uint16_t handle, uint8_t buffer[], uint16_t *const lengthP);
jksoft 1:48f6e08a3ac2 39 virtual ble_error_t updateValue(uint16_t, uint8_t[], uint16_t, bool localOnly = false);
jksoft 1:48f6e08a3ac2 40
jksoft 1:48f6e08a3ac2 41 virtual ble_error_t setDeviceName(const uint8_t *deviceName);
jksoft 1:48f6e08a3ac2 42 virtual ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP);
jksoft 1:48f6e08a3ac2 43 virtual ble_error_t setAppearance(uint16_t appearance);
jksoft 1:48f6e08a3ac2 44 virtual ble_error_t getAppearance(uint16_t *appearanceP);
jksoft 1:48f6e08a3ac2 45
jksoft 1:48f6e08a3ac2 46 /* nRF51 Functions */
jksoft 1:48f6e08a3ac2 47 void eventCallback(void);
jksoft 1:48f6e08a3ac2 48 void hwCallback(ble_evt_t *p_ble_evt);
jksoft 1:48f6e08a3ac2 49
jksoft 1:48f6e08a3ac2 50 private:
jksoft 1:48f6e08a3ac2 51 GattCharacteristic *p_characteristics[BLE_TOTAL_CHARACTERISTICS];
jksoft 1:48f6e08a3ac2 52 ble_gatts_char_handles_t nrfCharacteristicHandles[BLE_TOTAL_CHARACTERISTICS];
jksoft 1:48f6e08a3ac2 53
jksoft 1:48f6e08a3ac2 54 nRF51GattServer() {
jksoft 1:48f6e08a3ac2 55 serviceCount = 0;
jksoft 1:48f6e08a3ac2 56 characteristicCount = 0;
jksoft 1:48f6e08a3ac2 57 };
jksoft 1:48f6e08a3ac2 58
jksoft 1:48f6e08a3ac2 59 nRF51GattServer(nRF51GattServer const &);
jksoft 1:48f6e08a3ac2 60 void operator=(nRF51GattServer const &);
jksoft 1:48f6e08a3ac2 61 };
jksoft 1:48f6e08a3ac2 62
jksoft 1:48f6e08a3ac2 63 #endif