【これは旧バージョンです】 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:
lipoyang
Date:
Thu Sep 18 04:47:00 2014 +0000
Revision:
13:2075c4878557
Parent:
6:1b978b32118c
Servo????????

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 _PROJECTCONFIG_H_
jksoft 1:48f6e08a3ac2 18 #define _PROJECTCONFIG_H_
jksoft 1:48f6e08a3ac2 19
jksoft 1:48f6e08a3ac2 20 #include "blecommon.h"
jksoft 1:48f6e08a3ac2 21
jksoft 1:48f6e08a3ac2 22 /*=========================================================================
jksoft 1:48f6e08a3ac2 23 MCU & BOARD SELCTION
jksoft 1:48f6e08a3ac2 24
jksoft 1:48f6e08a3ac2 25 CFG_BOARD is one of the value defined in board.h
jksoft 1:48f6e08a3ac2 26 -----------------------------------------------------------------------*/
jksoft 1:48f6e08a3ac2 27 #define CFG_BOARD BOARD_PCA10001
jksoft 1:48f6e08a3ac2 28 #define CFG_MCU_STRING "nRF51822"
jksoft 1:48f6e08a3ac2 29 /*=========================================================================*/
jksoft 1:48f6e08a3ac2 30
jksoft 1:48f6e08a3ac2 31
jksoft 1:48f6e08a3ac2 32 /*=========================================================================
jksoft 1:48f6e08a3ac2 33 CODE BASE VERSION SETTINGS
jksoft 1:48f6e08a3ac2 34
jksoft 1:48f6e08a3ac2 35 Please do not modify this version number. To set a version number
jksoft 1:48f6e08a3ac2 36 for your project or firmware, change the values in your 'boards/'
jksoft 1:48f6e08a3ac2 37 config file.
jksoft 1:48f6e08a3ac2 38 -----------------------------------------------------------------------*/
jksoft 1:48f6e08a3ac2 39 #define CFG_CODEBASE_VERSION_MAJOR 0
jksoft 1:48f6e08a3ac2 40 #define CFG_CODEBASE_VERSION_MINOR 1
jksoft 1:48f6e08a3ac2 41 #define CFG_CODEBASE_VERSION_REVISION 0
jksoft 1:48f6e08a3ac2 42 /*=========================================================================*/
jksoft 1:48f6e08a3ac2 43
jksoft 1:48f6e08a3ac2 44
jksoft 1:48f6e08a3ac2 45 /*=========================================================================
jksoft 1:48f6e08a3ac2 46 FIRMWARE VERSION SETTINGS
jksoft 1:48f6e08a3ac2 47 -----------------------------------------------------------------------*/
jksoft 1:48f6e08a3ac2 48 #define CFG_FIRMWARE_VERSION_MAJOR 0
jksoft 1:48f6e08a3ac2 49 #define CFG_FIRMWARE_VERSION_MINOR 0
jksoft 1:48f6e08a3ac2 50 #define CFG_FIRMWARE_VERSION_REVISION 0
jksoft 1:48f6e08a3ac2 51 /*=========================================================================*/
jksoft 1:48f6e08a3ac2 52
jksoft 1:48f6e08a3ac2 53
jksoft 1:48f6e08a3ac2 54 /*=========================================================================
jksoft 1:48f6e08a3ac2 55 DEBUG LEVEL
jksoft 1:48f6e08a3ac2 56 -----------------------------------------------------------------------
jksoft 1:48f6e08a3ac2 57
jksoft 1:48f6e08a3ac2 58 CFG_DEBUG Level 3: Full debug output, any failed assert
jksoft 1:48f6e08a3ac2 59 will produce a breakpoint for the
jksoft 1:48f6e08a3ac2 60 debugger
jksoft 1:48f6e08a3ac2 61 Level 2: ATTR_ALWAYS_INLINE is null, ASSERT
jksoft 1:48f6e08a3ac2 62 has text
jksoft 1:48f6e08a3ac2 63 Level 1: ATTR_ALWAYS_INLINE is an attribute,
jksoft 1:48f6e08a3ac2 64 ASSERT has no text
jksoft 1:48f6e08a3ac2 65 Level 0: No debug information generated
jksoft 1:48f6e08a3ac2 66
jksoft 1:48f6e08a3ac2 67 -----------------------------------------------------------------------*/
jksoft 1:48f6e08a3ac2 68 #define CFG_DEBUG (1)
jksoft 1:48f6e08a3ac2 69
jksoft 1:48f6e08a3ac2 70 #if (CFG_DEBUG > 3) || (CFG_DEBUG < 0)
jksoft 1:48f6e08a3ac2 71 #error "CFG_DEBUG must be a value between 0 (no debug) and 3"
jksoft 1:48f6e08a3ac2 72 #endif
jksoft 1:48f6e08a3ac2 73 /*=========================================================================*/
jksoft 1:48f6e08a3ac2 74
jksoft 1:48f6e08a3ac2 75
jksoft 1:48f6e08a3ac2 76 /*=========================================================================
jksoft 1:48f6e08a3ac2 77 GENERAL NRF51 PERIPHERAL SETTINGS
jksoft 1:48f6e08a3ac2 78 -----------------------------------------------------------------------
jksoft 1:48f6e08a3ac2 79
jksoft 1:48f6e08a3ac2 80 CFG_SCHEDULER_ENABLE Set this to 'true' or 'false' depending on
jksoft 1:48f6e08a3ac2 81 if you use the event scheduler or not
jksoft 1:48f6e08a3ac2 82
jksoft 1:48f6e08a3ac2 83 -----------------------------------------------------------------------*/
jksoft 1:48f6e08a3ac2 84 #define CFG_SCHEDULER_ENABLE false
jksoft 1:48f6e08a3ac2 85
jksoft 1:48f6e08a3ac2 86 /*------------------------------- GPIOTE ------------------------------*/
jksoft 1:48f6e08a3ac2 87 #define CFG_GPIOTE_MAX_USERS 1 /**< Maximum number of users of the GPIOTE handler. */
jksoft 1:48f6e08a3ac2 88
jksoft 1:48f6e08a3ac2 89 /*-------------------------------- TIMER ------------------------------*/
jksoft 1:48f6e08a3ac2 90 #define CFG_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. freq = (32768/(PRESCALER+1)) */
jksoft 1:48f6e08a3ac2 91 #define CFG_TIMER_MAX_INSTANCE 8 /**< Maximum number of simultaneously created timers. */
jksoft 1:48f6e08a3ac2 92 #define CFG_TIMER_OPERATION_QUEUE_SIZE 5 /**< Size of timer operation queues. */
jksoft 1:48f6e08a3ac2 93 /*=========================================================================*/
jksoft 1:48f6e08a3ac2 94
jksoft 1:48f6e08a3ac2 95
jksoft 1:48f6e08a3ac2 96 /*=========================================================================
jksoft 1:48f6e08a3ac2 97 BTLE SETTINGS
jksoft 1:48f6e08a3ac2 98 -----------------------------------------------------------------------*/
jksoft 1:48f6e08a3ac2 99
jksoft 1:48f6e08a3ac2 100 #define CFG_BLE_TX_POWER_LEVEL 4 /**< in dBm (Valid values are -40, -20, -16, -12, -8, -4, 0, 4) */
jksoft 1:48f6e08a3ac2 101
jksoft 1:48f6e08a3ac2 102 /*---------------------------- BOND MANAGER ---------------------------*/
jksoft 1:48f6e08a3ac2 103 #define CFG_BLE_BOND_FLASH_PAGE_BOND (BLE_FLASH_PAGE_END-1) /**< Flash page used for bond manager bonding information.*/
jksoft 1:48f6e08a3ac2 104 #define CFG_BLE_BOND_FLASH_PAGE_SYS_ATTR (BLE_FLASH_PAGE_END-3) /**< Flash page used for bond manager system attribute information. TODO check if we can use BLE_FLASH_PAGE_END-2*/
jksoft 1:48f6e08a3ac2 105 #define CFG_BLE_BOND_DELETE_BUTTON_NUM 0 /**< Button to press to delete bond details during init */
jksoft 1:48f6e08a3ac2 106
jksoft 1:48f6e08a3ac2 107 /*------------------------------ SECURITY -----------------------------*/
jksoft 1:48f6e08a3ac2 108 #define CFG_BLE_SEC_PARAM_MITM 0 /**< Man In The Middle protection not required. */
jksoft 1:48f6e08a3ac2 109 #define CFG_BLE_SEC_PARAM_IO_CAPABILITIES BLE_GAP_IO_CAPS_NONE /**< No I/O capabilities. */
jksoft 1:48f6e08a3ac2 110 #define CFG_BLE_SEC_PARAM_OOB 0 /**< Out Of Band data not available. */
jksoft 1:48f6e08a3ac2 111 #define CFG_BLE_SEC_PARAM_MIN_KEY_SIZE 7 /**< Minimum encryption key size. */
jksoft 1:48f6e08a3ac2 112 #define CFG_BLE_SEC_PARAM_MAX_KEY_SIZE 16
jksoft 1:48f6e08a3ac2 113
jksoft 1:48f6e08a3ac2 114 /*--------------------------------- GAP -------------------------------*/
jksoft 1:48f6e08a3ac2 115 #define CFG_GAP_APPEARANCE BLE_APPEARANCE_GENERIC_TAG
jksoft 1:48f6e08a3ac2 116 #define CFG_GAP_LOCAL_NAME "mbed HRM1017"
jksoft 1:48f6e08a3ac2 117
lipoyang 6:1b978b32118c 118 #define CFG_GAP_CONNECTION_MIN_INTERVAL_MS 30//500 /**< Minimum acceptable connection interval */
lipoyang 6:1b978b32118c 119 #define CFG_GAP_CONNECTION_MAX_INTERVAL_MS 50//1000 /**< Maximum acceptable connection interval */
jksoft 1:48f6e08a3ac2 120 #define CFG_GAP_CONNECTION_SUPERVISION_TIMEOUT_MS 4000 /**< Connection supervisory timeout */
jksoft 1:48f6e08a3ac2 121 #define CFG_GAP_CONNECTION_SLAVE_LATENCY 0 /**< Slave Latency in number of connection events. */
jksoft 1:48f6e08a3ac2 122
jksoft 1:48f6e08a3ac2 123 #define CFG_GAP_ADV_INTERVAL_MS 25 /**< The advertising interval in miliseconds, should be multiply of 0.625 */
jksoft 1:48f6e08a3ac2 124 #define CFG_GAP_ADV_TIMEOUT_S 180 /**< The advertising timeout in units of seconds. */
jksoft 1:48f6e08a3ac2 125 /*=========================================================================*/
jksoft 1:48f6e08a3ac2 126
jksoft 1:48f6e08a3ac2 127
jksoft 1:48f6e08a3ac2 128 /*=========================================================================
jksoft 1:48f6e08a3ac2 129 VALIDATION
jksoft 1:48f6e08a3ac2 130 -----------------------------------------------------------------------*/
jksoft 1:48f6e08a3ac2 131 #if CFG_BLE_TX_POWER_LEVEL != -40 && CFG_BLE_TX_POWER_LEVEL != -20 && CFG_BLE_TX_POWER_LEVEL != -16 && CFG_BLE_TX_POWER_LEVEL != -12 && CFG_BLE_TX_POWER_LEVEL != -8 && CFG_BLE_TX_POWER_LEVEL != -4 && CFG_BLE_TX_POWER_LEVEL != 0 && CFG_BLE_TX_POWER_LEVEL != 4
jksoft 1:48f6e08a3ac2 132 #error "CFG_BLE_TX_POWER_LEVEL must be -40, -20, -16, -12, -8, -4, 0 or 4"
jksoft 1:48f6e08a3ac2 133 #endif
jksoft 1:48f6e08a3ac2 134 /*=========================================================================*/
jksoft 1:48f6e08a3ac2 135
jksoft 1:48f6e08a3ac2 136 #endif /* _PROJECTCONFIG_H_ */