Official Sheffield ARMBand micro:bit program

Committer:
MrBedfordVan
Date:
Mon Oct 17 12:41:20 2016 +0000
Revision:
0:b9164b348919
Official Sheffield ARMBand Micro:bit program

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MrBedfordVan 0:b9164b348919 1 /* mbed Microcontroller Library
MrBedfordVan 0:b9164b348919 2 * Copyright (c) 2006-2013 ARM Limited
MrBedfordVan 0:b9164b348919 3 *
MrBedfordVan 0:b9164b348919 4 * Licensed under the Apache License, Version 2.0 (the "License");
MrBedfordVan 0:b9164b348919 5 * you may not use this file except in compliance with the License.
MrBedfordVan 0:b9164b348919 6 * You may obtain a copy of the License at
MrBedfordVan 0:b9164b348919 7 *
MrBedfordVan 0:b9164b348919 8 * http://www.apache.org/licenses/LICENSE-2.0
MrBedfordVan 0:b9164b348919 9 *
MrBedfordVan 0:b9164b348919 10 * Unless required by applicable law or agreed to in writing, software
MrBedfordVan 0:b9164b348919 11 * distributed under the License is distributed on an "AS IS" BASIS,
MrBedfordVan 0:b9164b348919 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MrBedfordVan 0:b9164b348919 13 * See the License for the specific language governing permissions and
MrBedfordVan 0:b9164b348919 14 * limitations under the License.
MrBedfordVan 0:b9164b348919 15 */
MrBedfordVan 0:b9164b348919 16
MrBedfordVan 0:b9164b348919 17 #ifndef __BLE_COMMON_H__
MrBedfordVan 0:b9164b348919 18 #define __BLE_COMMON_H__
MrBedfordVan 0:b9164b348919 19
MrBedfordVan 0:b9164b348919 20 #ifdef __cplusplus
MrBedfordVan 0:b9164b348919 21 extern "C" {
MrBedfordVan 0:b9164b348919 22 #endif
MrBedfordVan 0:b9164b348919 23
MrBedfordVan 0:b9164b348919 24
MrBedfordVan 0:b9164b348919 25 /*! @brief Assigned values for BLE UUIDs. */
MrBedfordVan 0:b9164b348919 26 enum {
MrBedfordVan 0:b9164b348919 27 BLE_UUID_UNKNOWN = 0x0000, /**< Reserved UUID. */
MrBedfordVan 0:b9164b348919 28 BLE_UUID_SERVICE_PRIMARY = 0x2800, /**< Primary Service. */
MrBedfordVan 0:b9164b348919 29 BLE_UUID_SERVICE_SECONDARY = 0x2801, /**< Secondary Service. */
MrBedfordVan 0:b9164b348919 30 BLE_UUID_SERVICE_INCLUDE = 0x2802, /**< Include. */
MrBedfordVan 0:b9164b348919 31 BLE_UUID_CHARACTERISTIC = 0x2803, /**< Characteristic. */
MrBedfordVan 0:b9164b348919 32 BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP = 0x2900, /**< Characteristic Extended Properties Descriptor. */
MrBedfordVan 0:b9164b348919 33 BLE_UUID_DESCRIPTOR_CHAR_USER_DESC = 0x2901, /**< Characteristic User Description Descriptor. */
MrBedfordVan 0:b9164b348919 34 BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG = 0x2902, /**< Client Characteristic Configuration Descriptor. */
MrBedfordVan 0:b9164b348919 35 BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG = 0x2903, /**< Server Characteristic Configuration Descriptor. */
MrBedfordVan 0:b9164b348919 36 BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT = 0x2904, /**< Characteristic Presentation Format Descriptor. */
MrBedfordVan 0:b9164b348919 37 BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT = 0x2905, /**< Characteristic Aggregate Format Descriptor. */
MrBedfordVan 0:b9164b348919 38
MrBedfordVan 0:b9164b348919 39 /* GATT specific UUIDs */
MrBedfordVan 0:b9164b348919 40 BLE_UUID_GATT = 0x1801, /**< Generic Attribute Profile. */
MrBedfordVan 0:b9164b348919 41 BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED = 0x2A05, /**< Service Changed Characteristic. */
MrBedfordVan 0:b9164b348919 42
MrBedfordVan 0:b9164b348919 43 /* GAP specific UUIDs */
MrBedfordVan 0:b9164b348919 44 BLE_UUID_GAP = 0x1800, /**< Generic Access Profile. */
MrBedfordVan 0:b9164b348919 45 BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME = 0x2A00, /**< Device Name Characteristic. */
MrBedfordVan 0:b9164b348919 46 BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE = 0x2A01, /**< Appearance Characteristic. */
MrBedfordVan 0:b9164b348919 47 BLE_UUID_GAP_CHARACTERISTIC_PPF = 0x2A02, /**< Peripheral Privacy Flag Characteristic. */
MrBedfordVan 0:b9164b348919 48 BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR = 0x2A03, /**< Reconnection Address Characteristic. */
MrBedfordVan 0:b9164b348919 49 BLE_UUID_GAP_CHARACTERISTIC_PPCP = 0x2A04, /**< Peripheral Preferred Connection Parameters Characteristic. */
MrBedfordVan 0:b9164b348919 50 };
MrBedfordVan 0:b9164b348919 51
MrBedfordVan 0:b9164b348919 52 /*! @brief Error codes for the BLE API. */
MrBedfordVan 0:b9164b348919 53 enum ble_error_t {
MrBedfordVan 0:b9164b348919 54 BLE_ERROR_NONE = 0, /**< No error. */
MrBedfordVan 0:b9164b348919 55 BLE_ERROR_BUFFER_OVERFLOW = 1, /**< The requested action would cause a buffer overflow and has been aborted. */
MrBedfordVan 0:b9164b348919 56 BLE_ERROR_NOT_IMPLEMENTED = 2, /**< Requested a feature that isn't yet implemented or isn't supported by the target HW. */
MrBedfordVan 0:b9164b348919 57 BLE_ERROR_PARAM_OUT_OF_RANGE = 3, /**< One of the supplied parameters is outside the valid range. */
MrBedfordVan 0:b9164b348919 58 BLE_ERROR_INVALID_PARAM = 4, /**< One of the supplied parameters is invalid. */
MrBedfordVan 0:b9164b348919 59 BLE_STACK_BUSY = 5, /**< The stack is busy. */
MrBedfordVan 0:b9164b348919 60 BLE_ERROR_INVALID_STATE = 6, /**< Invalid state. */
MrBedfordVan 0:b9164b348919 61 BLE_ERROR_NO_MEM = 7, /**< Out of memory */
MrBedfordVan 0:b9164b348919 62 BLE_ERROR_OPERATION_NOT_PERMITTED = 8,
MrBedfordVan 0:b9164b348919 63 BLE_ERROR_INITIALIZATION_INCOMPLETE = 9,
MrBedfordVan 0:b9164b348919 64 BLE_ERROR_ALREADY_INITIALIZED = 10,
MrBedfordVan 0:b9164b348919 65 BLE_ERROR_UNSPECIFIED = 11, /**< Unknown error. */
MrBedfordVan 0:b9164b348919 66 BLE_ERROR_INTERNAL_STACK_FAILURE = 12, /**< The platform-specific stack failed */
MrBedfordVan 0:b9164b348919 67 };
MrBedfordVan 0:b9164b348919 68
MrBedfordVan 0:b9164b348919 69 /** @brief Default MTU size. */
MrBedfordVan 0:b9164b348919 70 static const unsigned BLE_GATT_MTU_SIZE_DEFAULT = 23;
MrBedfordVan 0:b9164b348919 71
MrBedfordVan 0:b9164b348919 72 enum HVXType_t {
MrBedfordVan 0:b9164b348919 73 BLE_HVX_NOTIFICATION = 0x01, /**< Handle Value Notification. */
MrBedfordVan 0:b9164b348919 74 BLE_HVX_INDICATION = 0x02, /**< Handle Value Indication. */
MrBedfordVan 0:b9164b348919 75 };
MrBedfordVan 0:b9164b348919 76
MrBedfordVan 0:b9164b348919 77 #ifdef __cplusplus
MrBedfordVan 0:b9164b348919 78 }
MrBedfordVan 0:b9164b348919 79 #endif
MrBedfordVan 0:b9164b348919 80
MrBedfordVan 0:b9164b348919 81 #endif // ifndef __BLE_COMMON_H__