mbed os with nrf51 internal bandgap enabled to read battery level

Dependents:   BLE_file_test BLE_Blink ExternalEncoder

Committer:
elessair
Date:
Sun Oct 23 15:10:02 2016 +0000
Revision:
0:f269e3021894
Initial commit

Who changed what in which revision?

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