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 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
lipoyang 5:7f89fca19a9e 2 *
lipoyang 5:7f89fca19a9e 3 * The information contained herein is confidential property of Nordic Semiconductor. The use,
lipoyang 5:7f89fca19a9e 4 * copying, transfer or disclosure of such information is prohibited except by express written
lipoyang 5:7f89fca19a9e 5 * agreement with Nordic Semiconductor.
lipoyang 5:7f89fca19a9e 6 *
lipoyang 5:7f89fca19a9e 7 */
lipoyang 5:7f89fca19a9e 8 /**
lipoyang 5:7f89fca19a9e 9 @addtogroup BLE_GATT Generic Attribute Profile (GATT) Common
lipoyang 5:7f89fca19a9e 10 @{
lipoyang 5:7f89fca19a9e 11 @brief Common definitions and prototypes for the GATT interfaces.
lipoyang 5:7f89fca19a9e 12 */
lipoyang 5:7f89fca19a9e 13
lipoyang 5:7f89fca19a9e 14 #ifndef BLE_GATT_H__
lipoyang 5:7f89fca19a9e 15 #define BLE_GATT_H__
lipoyang 5:7f89fca19a9e 16
lipoyang 5:7f89fca19a9e 17 #include "ble_types.h"
lipoyang 5:7f89fca19a9e 18 #include "ble_ranges.h"
lipoyang 5:7f89fca19a9e 19
lipoyang 5:7f89fca19a9e 20
lipoyang 5:7f89fca19a9e 21 /** @addtogroup BLE_GATT_DEFINES Defines
lipoyang 5:7f89fca19a9e 22 * @{ */
lipoyang 5:7f89fca19a9e 23
lipoyang 5:7f89fca19a9e 24 /** @brief Default MTU size. */
lipoyang 5:7f89fca19a9e 25 #define GATT_MTU_SIZE_DEFAULT 23
lipoyang 5:7f89fca19a9e 26
lipoyang 5:7f89fca19a9e 27 /** @brief Only the default MTU size of 23 is currently supported. */
lipoyang 5:7f89fca19a9e 28 #define GATT_RX_MTU 23
lipoyang 5:7f89fca19a9e 29
lipoyang 5:7f89fca19a9e 30
lipoyang 5:7f89fca19a9e 31 /**@brief Invalid Attribute Handle. */
lipoyang 5:7f89fca19a9e 32 #define BLE_GATT_HANDLE_INVALID 0x0000
lipoyang 5:7f89fca19a9e 33
lipoyang 5:7f89fca19a9e 34 /** @defgroup BLE_GATT_TIMEOUT_SOURCES GATT Timeout sources
lipoyang 5:7f89fca19a9e 35 * @{ */
lipoyang 5:7f89fca19a9e 36 #define BLE_GATT_TIMEOUT_SRC_PROTOCOL 0x00 /**< ATT Protocol timeout. */
lipoyang 5:7f89fca19a9e 37 /** @} */
lipoyang 5:7f89fca19a9e 38
lipoyang 5:7f89fca19a9e 39 /** @defgroup BLE_GATT_WRITE_OPS GATT Write operations
lipoyang 5:7f89fca19a9e 40 * @{ */
lipoyang 5:7f89fca19a9e 41 #define BLE_GATT_OP_INVALID 0x00 /**< Invalid Operation. */
lipoyang 5:7f89fca19a9e 42 #define BLE_GATT_OP_WRITE_REQ 0x01 /**< Write Request. */
lipoyang 5:7f89fca19a9e 43 #define BLE_GATT_OP_WRITE_CMD 0x02 /**< Write Command. */
lipoyang 5:7f89fca19a9e 44 #define BLE_GATT_OP_SIGN_WRITE_CMD 0x03 /**< Signed Write Command. */
lipoyang 5:7f89fca19a9e 45 #define BLE_GATT_OP_PREP_WRITE_REQ 0x04 /**< Prepare Write Request. */
lipoyang 5:7f89fca19a9e 46 #define BLE_GATT_OP_EXEC_WRITE_REQ 0x05 /**< Execute Write Request. */
lipoyang 5:7f89fca19a9e 47 /** @} */
lipoyang 5:7f89fca19a9e 48
lipoyang 5:7f89fca19a9e 49 /** @defgroup BLE_GATT_EXEC_WRITE_FLAGS GATT Execute Write flags
lipoyang 5:7f89fca19a9e 50 * @{ */
lipoyang 5:7f89fca19a9e 51 #define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_CANCEL 0x00
lipoyang 5:7f89fca19a9e 52 #define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_WRITE 0x01
lipoyang 5:7f89fca19a9e 53 /** @} */
lipoyang 5:7f89fca19a9e 54
lipoyang 5:7f89fca19a9e 55 /** @defgroup BLE_GATT_HVX_TYPES GATT Handle Value operations
lipoyang 5:7f89fca19a9e 56 * @{ */
lipoyang 5:7f89fca19a9e 57 #define BLE_GATT_HVX_INVALID 0x00 /**< Invalid Operation. */
lipoyang 5:7f89fca19a9e 58 #define BLE_GATT_HVX_NOTIFICATION 0x01 /**< Handle Value Notification. */
lipoyang 5:7f89fca19a9e 59 #define BLE_GATT_HVX_INDICATION 0x02 /**< Handle Value Indication. */
lipoyang 5:7f89fca19a9e 60 /** @} */
lipoyang 5:7f89fca19a9e 61
lipoyang 5:7f89fca19a9e 62 /** @defgroup BLE_GATT_STATUS_CODES GATT Status Codes
lipoyang 5:7f89fca19a9e 63 * @{ */
lipoyang 5:7f89fca19a9e 64 #define BLE_GATT_STATUS_SUCCESS 0x0000 /**< Success. */
lipoyang 5:7f89fca19a9e 65 #define BLE_GATT_STATUS_UNKNOWN 0x0001 /**< Unknown or not applicable status. */
lipoyang 5:7f89fca19a9e 66 #define BLE_GATT_STATUS_ATTERR_INVALID 0x0100 /**< ATT Error: Invalid Error Code. */
lipoyang 5:7f89fca19a9e 67 #define BLE_GATT_STATUS_ATTERR_INVALID_HANDLE 0x0101 /**< ATT Error: Invalid Attribute Handle. */
lipoyang 5:7f89fca19a9e 68 #define BLE_GATT_STATUS_ATTERR_READ_NOT_PERMITTED 0x0102 /**< ATT Error: Read not permitted. */
lipoyang 5:7f89fca19a9e 69 #define BLE_GATT_STATUS_ATTERR_WRITE_NOT_PERMITTED 0x0103 /**< ATT Error: Write not permitted. */
lipoyang 5:7f89fca19a9e 70 #define BLE_GATT_STATUS_ATTERR_INVALID_PDU 0x0104 /**< ATT Error: Used in ATT as Invalid PDU. */
lipoyang 5:7f89fca19a9e 71 #define BLE_GATT_STATUS_ATTERR_INSUF_AUTHENTICATION 0x0105 /**< ATT Error: Authenticated link required. */
lipoyang 5:7f89fca19a9e 72 #define BLE_GATT_STATUS_ATTERR_REQUEST_NOT_SUPPORTED 0x0106 /**< ATT Error: Used in ATT as Request Not Supported. */
lipoyang 5:7f89fca19a9e 73 #define BLE_GATT_STATUS_ATTERR_INVALID_OFFSET 0x0107 /**< ATT Error: Offset specified was past the end of the attribute. */
lipoyang 5:7f89fca19a9e 74 #define BLE_GATT_STATUS_ATTERR_INSUF_AUTHORIZATION 0x0108 /**< ATT Error: Used in ATT as Insufficient Authorisation. */
lipoyang 5:7f89fca19a9e 75 #define BLE_GATT_STATUS_ATTERR_PREPARE_QUEUE_FULL 0x0109 /**< ATT Error: Used in ATT as Prepare Queue Full. */
lipoyang 5:7f89fca19a9e 76 #define BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND 0x010A /**< ATT Error: Used in ATT as Attribute not found. */
lipoyang 5:7f89fca19a9e 77 #define BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_LONG 0x010B /**< ATT Error: Attribute cannot be read or written using read/write blob requests. */
lipoyang 5:7f89fca19a9e 78 #define BLE_GATT_STATUS_ATTERR_INSUF_ENC_KEY_SIZE 0x010C /**< ATT Error: Encryption key size used is insufficient. */
lipoyang 5:7f89fca19a9e 79 #define BLE_GATT_STATUS_ATTERR_INVALID_ATT_VAL_LENGTH 0x010D /**< ATT Error: Invalid value size. */
lipoyang 5:7f89fca19a9e 80 #define BLE_GATT_STATUS_ATTERR_UNLIKELY_ERROR 0x010E /**< ATT Error: Very unlikely error. */
lipoyang 5:7f89fca19a9e 81 #define BLE_GATT_STATUS_ATTERR_INSUF_ENCRYPTION 0x010F /**< ATT Error: Encrypted link required. */
lipoyang 5:7f89fca19a9e 82 #define BLE_GATT_STATUS_ATTERR_UNSUPPORTED_GROUP_TYPE 0x0110 /**< ATT Error: Attribute type is not a supported grouping attribute. */
lipoyang 5:7f89fca19a9e 83 #define BLE_GATT_STATUS_ATTERR_INSUF_RESOURCES 0x0111 /**< ATT Error: Encrypted link required. */
lipoyang 5:7f89fca19a9e 84 #define BLE_GATT_STATUS_ATTERR_RFU_RANGE1_BEGIN 0x0112 /**< ATT Error: Reserved for Future Use range #1 begin. */
lipoyang 5:7f89fca19a9e 85 #define BLE_GATT_STATUS_ATTERR_RFU_RANGE1_END 0x017F /**< ATT Error: Reserved for Future Use range #1 end. */
lipoyang 5:7f89fca19a9e 86 #define BLE_GATT_STATUS_ATTERR_APP_BEGIN 0x0180 /**< ATT Error: Application range begin. */
lipoyang 5:7f89fca19a9e 87 #define BLE_GATT_STATUS_ATTERR_APP_END 0x019F /**< ATT Error: Application range end. */
lipoyang 5:7f89fca19a9e 88 #define BLE_GATT_STATUS_ATTERR_RFU_RANGE2_BEGIN 0x01A0 /**< ATT Error: Reserved for Future Use range #2 begin. */
lipoyang 5:7f89fca19a9e 89 #define BLE_GATT_STATUS_ATTERR_RFU_RANGE2_END 0x01DF /**< ATT Error: Reserved for Future Use range #2 end. */
lipoyang 5:7f89fca19a9e 90 #define BLE_GATT_STATUS_ATTERR_RFU_RANGE3_BEGIN 0x01E0 /**< ATT Error: Reserved for Future Use range #3 begin. */
lipoyang 5:7f89fca19a9e 91 #define BLE_GATT_STATUS_ATTERR_RFU_RANGE3_END 0x01FC /**< ATT Error: Reserved for Future Use range #3 end. */
lipoyang 5:7f89fca19a9e 92 #define BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR 0x01FD /**< ATT Common Profile and Service Error: Client Characteristic Configuration Descriptor improperly configured. */
lipoyang 5:7f89fca19a9e 93 #define BLE_GATT_STATUS_ATTERR_CPS_PROC_ALR_IN_PROG 0x01FE /**< ATT Common Profile and Service Error: Procedure Already in Progress. */
lipoyang 5:7f89fca19a9e 94 #define BLE_GATT_STATUS_ATTERR_CPS_OUT_OF_RANGE 0x01FF /**< ATT Common Profile and Service Error: Out Of Range. */
lipoyang 5:7f89fca19a9e 95 /** @} */
lipoyang 5:7f89fca19a9e 96
lipoyang 5:7f89fca19a9e 97
lipoyang 5:7f89fca19a9e 98 /** @defgroup BLE_GATT_CPF_FORMATS Characteristic Presentation Formats
lipoyang 5:7f89fca19a9e 99 * @note Found at http://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorViewer.aspx?u=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml
lipoyang 5:7f89fca19a9e 100 * @{ */
lipoyang 5:7f89fca19a9e 101 #define BLE_GATT_CPF_FORMAT_RFU 0x00 /**< Reserved For Future Use. */
lipoyang 5:7f89fca19a9e 102 #define BLE_GATT_CPF_FORMAT_BOOLEAN 0x01 /**< Boolean. */
lipoyang 5:7f89fca19a9e 103 #define BLE_GATT_CPF_FORMAT_2BIT 0x02 /**< Unsigned 2-bit integer. */
lipoyang 5:7f89fca19a9e 104 #define BLE_GATT_CPF_FORMAT_NIBBLE 0x03 /**< Unsigned 4-bit integer. */
lipoyang 5:7f89fca19a9e 105 #define BLE_GATT_CPF_FORMAT_UINT8 0x04 /**< Unsigned 8-bit integer. */
lipoyang 5:7f89fca19a9e 106 #define BLE_GATT_CPF_FORMAT_UINT12 0x05 /**< Unsigned 12-bit integer. */
lipoyang 5:7f89fca19a9e 107 #define BLE_GATT_CPF_FORMAT_UINT16 0x06 /**< Unsigned 16-bit integer. */
lipoyang 5:7f89fca19a9e 108 #define BLE_GATT_CPF_FORMAT_UINT24 0x07 /**< Unsigned 24-bit integer. */
lipoyang 5:7f89fca19a9e 109 #define BLE_GATT_CPF_FORMAT_UINT32 0x08 /**< Unsigned 32-bit integer. */
lipoyang 5:7f89fca19a9e 110 #define BLE_GATT_CPF_FORMAT_UINT48 0x09 /**< Unsigned 48-bit integer. */
lipoyang 5:7f89fca19a9e 111 #define BLE_GATT_CPF_FORMAT_UINT64 0x0A /**< Unsigned 64-bit integer. */
lipoyang 5:7f89fca19a9e 112 #define BLE_GATT_CPF_FORMAT_UINT128 0x0B /**< Unsigned 128-bit integer. */
lipoyang 5:7f89fca19a9e 113 #define BLE_GATT_CPF_FORMAT_SINT8 0x0C /**< Signed 2-bit integer. */
lipoyang 5:7f89fca19a9e 114 #define BLE_GATT_CPF_FORMAT_SINT12 0x0D /**< Signed 12-bit integer. */
lipoyang 5:7f89fca19a9e 115 #define BLE_GATT_CPF_FORMAT_SINT16 0x0E /**< Signed 16-bit integer. */
lipoyang 5:7f89fca19a9e 116 #define BLE_GATT_CPF_FORMAT_SINT24 0x0F /**< Signed 24-bit integer. */
lipoyang 5:7f89fca19a9e 117 #define BLE_GATT_CPF_FORMAT_SINT32 0x10 /**< Signed 32-bit integer. */
lipoyang 5:7f89fca19a9e 118 #define BLE_GATT_CPF_FORMAT_SINT48 0x11 /**< Signed 48-bit integer. */
lipoyang 5:7f89fca19a9e 119 #define BLE_GATT_CPF_FORMAT_SINT64 0x12 /**< Signed 64-bit integer. */
lipoyang 5:7f89fca19a9e 120 #define BLE_GATT_CPF_FORMAT_SINT128 0x13 /**< Signed 128-bit integer. */
lipoyang 5:7f89fca19a9e 121 #define BLE_GATT_CPF_FORMAT_FLOAT32 0x14 /**< IEEE-754 32-bit floating point. */
lipoyang 5:7f89fca19a9e 122 #define BLE_GATT_CPF_FORMAT_FLOAT64 0x15 /**< IEEE-754 64-bit floating point. */
lipoyang 5:7f89fca19a9e 123 #define BLE_GATT_CPF_FORMAT_SFLOAT 0x16 /**< IEEE-11073 16-bit SFLOAT. */
lipoyang 5:7f89fca19a9e 124 #define BLE_GATT_CPF_FORMAT_FLOAT 0x17 /**< IEEE-11073 32-bit FLOAT. */
lipoyang 5:7f89fca19a9e 125 #define BLE_GATT_CPF_FORMAT_DUINT16 0x18 /**< IEEE-20601 format. */
lipoyang 5:7f89fca19a9e 126 #define BLE_GATT_CPF_FORMAT_UTF8S 0x19 /**< UTF-8 string. */
lipoyang 5:7f89fca19a9e 127 #define BLE_GATT_CPF_FORMAT_UTF16S 0x1A /**< UTF-16 string. */
lipoyang 5:7f89fca19a9e 128 #define BLE_GATT_CPF_FORMAT_STRUCT 0x1B /**< Opaque Structure. */
lipoyang 5:7f89fca19a9e 129 /** @} */
lipoyang 5:7f89fca19a9e 130
lipoyang 5:7f89fca19a9e 131 /** @defgroup BLE_GATT_CPF_NAMESPACES GATT Bluetooth Namespaces
lipoyang 5:7f89fca19a9e 132 * @{
lipoyang 5:7f89fca19a9e 133 */
lipoyang 5:7f89fca19a9e 134 #define BLE_GATT_CPF_NAMESPACE_BTSIG 0x01
lipoyang 5:7f89fca19a9e 135 #define BLE_GATT_CPF_NAMESPACE_DESCRIPTION_UNKNOWN 0x0000
lipoyang 5:7f89fca19a9e 136 /** @} */
lipoyang 5:7f89fca19a9e 137
lipoyang 5:7f89fca19a9e 138 /** @} */
lipoyang 5:7f89fca19a9e 139
lipoyang 5:7f89fca19a9e 140 /** @addtogroup BLE_GATT_STRUCTURES Structures
lipoyang 5:7f89fca19a9e 141 * @{ */
lipoyang 5:7f89fca19a9e 142
lipoyang 5:7f89fca19a9e 143 /**@brief GATT Characteristic Properties. */
lipoyang 5:7f89fca19a9e 144 typedef struct
lipoyang 5:7f89fca19a9e 145 {
lipoyang 5:7f89fca19a9e 146 /* Standard properties */
lipoyang 5:7f89fca19a9e 147 uint8_t broadcast :1; /**< Broadcasting of value permitted. */
lipoyang 5:7f89fca19a9e 148 uint8_t read :1; /**< Reading value permitted. */
lipoyang 5:7f89fca19a9e 149 uint8_t write_wo_resp :1; /**< Writing value with Write Command permitted. */
lipoyang 5:7f89fca19a9e 150 uint8_t write :1; /**< Writing value with Write Request permitted. */
lipoyang 5:7f89fca19a9e 151 uint8_t notify :1; /**< Notications of value permitted. */
lipoyang 5:7f89fca19a9e 152 uint8_t indicate :1; /**< Indications of value permitted. */
lipoyang 5:7f89fca19a9e 153 uint8_t auth_signed_wr :1; /**< Writing value with Signed Write Command permitted. */
lipoyang 5:7f89fca19a9e 154 } ble_gatt_char_props_t;
lipoyang 5:7f89fca19a9e 155
lipoyang 5:7f89fca19a9e 156 /**@brief GATT Characteristic Extended Properties. */
lipoyang 5:7f89fca19a9e 157 typedef struct
lipoyang 5:7f89fca19a9e 158 {
lipoyang 5:7f89fca19a9e 159 /* Extended properties */
lipoyang 5:7f89fca19a9e 160 uint8_t reliable_wr :1; /**< Writing value with Queued Write Request permitted. */
lipoyang 5:7f89fca19a9e 161 uint8_t wr_aux :1; /**< Writing the Characteristic User Description permitted. */
lipoyang 5:7f89fca19a9e 162 } ble_gatt_char_ext_props_t;
lipoyang 5:7f89fca19a9e 163
lipoyang 5:7f89fca19a9e 164 #endif // BLE_GATT_H__
lipoyang 5:7f89fca19a9e 165
lipoyang 5:7f89fca19a9e 166 /** @} */
lipoyang 5:7f89fca19a9e 167
lipoyang 5:7f89fca19a9e 168 /**
lipoyang 5:7f89fca19a9e 169 @}
lipoyang 5:7f89fca19a9e 170 @}
lipoyang 5:7f89fca19a9e 171 */