【これは旧バージョンです】 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:
4:ebda47d22091
Servo????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 0:8c643bfe55b7 1 /**************************************************************************/
jksoft 0:8c643bfe55b7 2 /*!
jksoft 0:8c643bfe55b7 3 @file ble_error.h
jksoft 0:8c643bfe55b7 4 @author hathach (tinyusb.org)
jksoft 0:8c643bfe55b7 5
jksoft 0:8c643bfe55b7 6 @section LICENSE
jksoft 0:8c643bfe55b7 7
jksoft 0:8c643bfe55b7 8 Software License Agreement (BSD License)
jksoft 0:8c643bfe55b7 9
jksoft 0:8c643bfe55b7 10 Copyright (c) 2013, K. Townsend (microBuilder.eu)
jksoft 0:8c643bfe55b7 11 All rights reserved.
jksoft 0:8c643bfe55b7 12
jksoft 0:8c643bfe55b7 13 Redistribution and use in source and binary forms, with or without
jksoft 0:8c643bfe55b7 14 modification, are permitted provided that the following conditions are met:
jksoft 0:8c643bfe55b7 15 1. Redistributions of source code must retain the above copyright
jksoft 0:8c643bfe55b7 16 notice, this list of conditions and the following disclaimer.
jksoft 0:8c643bfe55b7 17 2. Redistributions in binary form must reproduce the above copyright
jksoft 0:8c643bfe55b7 18 notice, this list of conditions and the following disclaimer in the
jksoft 0:8c643bfe55b7 19 documentation and/or other materials provided with the distribution.
jksoft 0:8c643bfe55b7 20 3. Neither the name of the copyright holders nor the
jksoft 0:8c643bfe55b7 21 names of its contributors may be used to endorse or promote products
jksoft 0:8c643bfe55b7 22 derived from this software without specific prior written permission.
jksoft 0:8c643bfe55b7 23
jksoft 0:8c643bfe55b7 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
jksoft 0:8c643bfe55b7 25 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
jksoft 0:8c643bfe55b7 26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
jksoft 0:8c643bfe55b7 27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
jksoft 0:8c643bfe55b7 28 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
jksoft 0:8c643bfe55b7 29 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
jksoft 0:8c643bfe55b7 30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
jksoft 0:8c643bfe55b7 31 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
jksoft 0:8c643bfe55b7 32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
jksoft 0:8c643bfe55b7 33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
jksoft 0:8c643bfe55b7 34 */
jksoft 0:8c643bfe55b7 35 /**************************************************************************/
jksoft 0:8c643bfe55b7 36
jksoft 0:8c643bfe55b7 37 /** \file
jksoft 0:8c643bfe55b7 38 * \brief Error Header
jksoft 0:8c643bfe55b7 39 *
jksoft 0:8c643bfe55b7 40 * \note TBD
jksoft 0:8c643bfe55b7 41 */
jksoft 0:8c643bfe55b7 42
jksoft 0:8c643bfe55b7 43 /** \ingroup Group_Common
jksoft 0:8c643bfe55b7 44 * \defgroup Group_Error Error Codes
jksoft 0:8c643bfe55b7 45 * @{
jksoft 0:8c643bfe55b7 46 */
jksoft 0:8c643bfe55b7 47
jksoft 0:8c643bfe55b7 48 #ifndef _BLE_ERROR_H_
jksoft 0:8c643bfe55b7 49 #define _BLE_ERROR_H_
jksoft 0:8c643bfe55b7 50
jksoft 0:8c643bfe55b7 51 #include "projectconfig.h"
jksoft 0:8c643bfe55b7 52
jksoft 0:8c643bfe55b7 53 #ifdef __cplusplus
jksoft 0:8c643bfe55b7 54 extern "C" {
jksoft 0:8c643bfe55b7 55 #endif
jksoft 0:8c643bfe55b7 56
jksoft 0:8c643bfe55b7 57 typedef enum
jksoft 0:8c643bfe55b7 58 {
jksoft 0:8c643bfe55b7 59 /*=======================================================================
jksoft 0:8c643bfe55b7 60 NORDIC GLOBAL ERRORS 0x0000 .. 0x00FF
jksoft 0:8c643bfe55b7 61 -----------------------------------------------------------------------
jksoft 0:8c643bfe55b7 62 Errors mapped from nrf_error.h
jksoft 0:8c643bfe55b7 63 -----------------------------------------------------------------------*/
jksoft 0:8c643bfe55b7 64 ERROR_NONE = 0x0000 , ///< Successful command
jksoft 0:8c643bfe55b7 65 ERROR_SVC_HANDLER_MISSING = 0x0001 , ///< SVC handler is missing
jksoft 0:8c643bfe55b7 66 ERROR_SOFTDEVICE_NOT_ENABLED = 0x0002 , ///< SoftDevice has not been enabled
jksoft 0:8c643bfe55b7 67 ERROR_INTERNAL = 0x0003 , ///< Internal Error
jksoft 0:8c643bfe55b7 68 ERROR_NO_MEM = 0x0004 , ///< No Memory for operation
jksoft 0:8c643bfe55b7 69 ERROR_NOT_FOUND = 0x0005 , ///< Not found
jksoft 0:8c643bfe55b7 70 ERROR_NOT_SUPPORTED = 0x0006 , ///< Not supported
jksoft 0:8c643bfe55b7 71 ERROR_INVALID_PARAM = 0x0007 , ///< Invalid Parameter
jksoft 0:8c643bfe55b7 72 ERROR_INVALID_STATE = 0x0008 , ///< Invalid state, operation disallowed in this state
jksoft 0:8c643bfe55b7 73 ERROR_INVALID_LENGTH = 0x0009 , ///< Invalid Length
jksoft 0:8c643bfe55b7 74 ERROR_INVALID_FLAGS = 0x000A , ///< Invalid Flags
jksoft 0:8c643bfe55b7 75 ERROR_INVALID_DATA = 0x000B , ///< Invalid Data
jksoft 0:8c643bfe55b7 76 ERROR_DATA_SIZE = 0x000C , ///< Data size exceeds limit
jksoft 0:8c643bfe55b7 77 ERROR_TIMEOUT = 0x000D , ///< Operation timed out
jksoft 0:8c643bfe55b7 78 ERROR_NULL = 0x000E , ///< Null Pointer
jksoft 0:8c643bfe55b7 79 ERROR_FORBIDDEN = 0x000F , ///< Forbidden Operation
jksoft 0:8c643bfe55b7 80 ERROR_INVALID_ADDR = 0x0010 , ///< Bad Memory Address
jksoft 0:8c643bfe55b7 81 ERROR_BUSY = 0x0011 , ///< Busy
jksoft 0:8c643bfe55b7 82 /*=======================================================================*/
jksoft 0:8c643bfe55b7 83
jksoft 0:8c643bfe55b7 84 ERROR_INVALIDPARAMETER = 0x0100 , /**< An invalid parameter value was provided */
jksoft 0:8c643bfe55b7 85 ERROR_I2C_XFER_FAILED = 0x0101 , /**< an failed attempt to make I2C transfer */
jksoft 0:8c643bfe55b7 86
jksoft 0:8c643bfe55b7 87 /*=======================================================================
jksoft 0:8c643bfe55b7 88 SIMPLE BINARY PROTOCOL ERRORS 0x0120 .. 0x013F
jksoft 0:8c643bfe55b7 89 -----------------------------------------------------------------------
jksoft 0:8c643bfe55b7 90 Errors relating to the simple binary protocol (/src//protocol)
jksoft 0:8c643bfe55b7 91 -----------------------------------------------------------------------*/
jksoft 0:8c643bfe55b7 92 ERROR_PROT_INVALIDMSGTYPE = 0x121, /**< Unexpected msg type encountered */
jksoft 0:8c643bfe55b7 93 ERROR_PROT_INVALIDCOMMANDID = 0x122, /**< Unknown or out of range command ID */
jksoft 0:8c643bfe55b7 94 ERROR_PROT_INVALIDPAYLOAD = 0x123, /**< Message payload has a problem (invalid len, etc.) */
jksoft 0:8c643bfe55b7 95 /*=======================================================================*/
jksoft 0:8c643bfe55b7 96
jksoft 0:8c643bfe55b7 97 //------------- based on Nordic SDM nrf_error_sdm.h -------------//
jksoft 0:8c643bfe55b7 98 ERROR_SDM_LFCLK_SOURCE_UNKNOWN = 0x1000 , ///< Unknown lfclk source
jksoft 0:8c643bfe55b7 99 ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION = 0x1001 , ///< Incorrect interrupt configuration (can be caused by using illegal priority levels, or having enabled SoftDevice interrupts)
jksoft 0:8c643bfe55b7 100 ERROR_SDM_INCORRECT_CLENR0 = 0x1002 , ///< Incorrect CLENR0 (can be caused by erronous SoftDevice flashing)
jksoft 0:8c643bfe55b7 101
jksoft 0:8c643bfe55b7 102 //------------- based on Nordic SOC nrf_error_soc.h -------------//
jksoft 0:8c643bfe55b7 103 /* Mutex Errors */
jksoft 0:8c643bfe55b7 104 ERROR_SOC_MUTEX_ALREADY_TAKEN = 0x2000 , ///< Mutex already taken
jksoft 0:8c643bfe55b7 105
jksoft 0:8c643bfe55b7 106 /* NVIC errors */
jksoft 0:8c643bfe55b7 107 ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE = 0x2001 , ///< NVIC interrupt not available
jksoft 0:8c643bfe55b7 108 ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED = 0x2002 , ///< NVIC interrupt priority not allowed
jksoft 0:8c643bfe55b7 109 ERROR_SOC_NVIC_SHOULD_NOT_RETURN = 0x2003 , ///< NVIC should not return
jksoft 0:8c643bfe55b7 110
jksoft 0:8c643bfe55b7 111 /* Power errors */
jksoft 0:8c643bfe55b7 112 ERROR_SOC_POWER_MODE_UNKNOWN = 0x2004 , ///< Power mode unknown
jksoft 0:8c643bfe55b7 113 ERROR_SOC_POWER_POF_THRESHOLD_UNKNOWN = 0x2005 , ///< Power POF threshold unknown
jksoft 0:8c643bfe55b7 114 ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN = 0x2006 , ///< Power off should not return
jksoft 0:8c643bfe55b7 115
jksoft 0:8c643bfe55b7 116 /* Rand errors */
jksoft 0:8c643bfe55b7 117 ERROR_SOC_RAND_NOT_ENOUGH_VALUES = 0x2007 , ///< RAND not enough values
jksoft 0:8c643bfe55b7 118
jksoft 0:8c643bfe55b7 119 /* PPI errors */
jksoft 0:8c643bfe55b7 120 ERROR_SOC_PPI_INVALID_CHANNEL = 0x2008 , ///< Invalid PPI Channel
jksoft 0:8c643bfe55b7 121 ERROR_SOC_PPI_INVALID_GROUP = 0x2009 , ///< Invalid PPI Group
jksoft 0:8c643bfe55b7 122
jksoft 0:8c643bfe55b7 123 //------------- based on Nordic STK (ble) ble_err.h -------------//
jksoft 0:8c643bfe55b7 124 ERROR_BLE_INVALID_CONN_HANDLE = 0x3001 , /**< Invalid connection handle. */
jksoft 0:8c643bfe55b7 125 ERROR_BLE_INVALID_ATTR_HANDLE = 0x3002 , /**< Invalid attribute handle. */
jksoft 0:8c643bfe55b7 126 ERROR_BLE_NO_TX_BUFFERS = 0x3003 , /**< Buffer capacity exceeded. */
jksoft 0:8c643bfe55b7 127
jksoft 0:8c643bfe55b7 128 // L2CAP
jksoft 0:8c643bfe55b7 129 ERROR_BLE_L2CAP_CID_IN_USE = 0x3100 , /**< CID already in use. */
jksoft 0:8c643bfe55b7 130
jksoft 0:8c643bfe55b7 131 // GAP
jksoft 0:8c643bfe55b7 132 ERROR_BLE_GAP_UUID_LIST_MISMATCH = 0x3200 , /**< UUID list does not contain an integral number of UUIDs. */
jksoft 0:8c643bfe55b7 133 ERROR_BLE_GAP_DISCOVERABLE_WITH_WHITELIST = 0x3201 , /**< Use of Whitelist not permitted with discoverable advertising. */
jksoft 0:8c643bfe55b7 134 ERROR_BLE_GAP_INVALID_BLE_ADDR = 0x3202 , /**< The upper two bits of the address do not correspond to the specified address type. */
jksoft 0:8c643bfe55b7 135
jksoft 0:8c643bfe55b7 136 // GATTC
jksoft 0:8c643bfe55b7 137 ERROR_BLE_GATTC_PROC_NOT_PERMITTED = 0x3300 ,
jksoft 0:8c643bfe55b7 138
jksoft 0:8c643bfe55b7 139 // GATTS
jksoft 0:8c643bfe55b7 140 ERROR_BLEGATTS_INVALID_ATTR_TYPE = 0x3400 , /**< Invalid attribute type. */
jksoft 0:8c643bfe55b7 141 ERROR_BLEGATTS_SYS_ATTR_MISSING = 0x3401 , /**< System Attributes missing. */
jksoft 0:8c643bfe55b7 142
jksoft 0:8c643bfe55b7 143 }error_t;
jksoft 0:8c643bfe55b7 144
jksoft 0:8c643bfe55b7 145 #ifdef __cplusplus
jksoft 0:8c643bfe55b7 146 }
jksoft 0:8c643bfe55b7 147 #endif
jksoft 0:8c643bfe55b7 148
jksoft 0:8c643bfe55b7 149 #endif /* _BLE_ERROR_H_ */
jksoft 0:8c643bfe55b7 150
jksoft 0:8c643bfe55b7 151 /** @} */