![](/media/cache/profiles/312e53ccba0b2ddfefd4a1f05b55bcdd.jpg.50x50_q85.jpg)
BLE FOTA APP
It doesn't work with the default FOTA bootloader. It use NVIC_SystemReset() to enter a bootloader.
nRF51822/nordic/nrf-sdk/s110/ble_types.h@1:a607cd9655d7, 2014-10-10 (annotated)
- Committer:
- yihui
- Date:
- Fri Oct 10 03:36:28 2014 +0000
- Revision:
- 1:a607cd9655d7
use NVIC_SystemReset() to run bootloader
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yihui | 1:a607cd9655d7 | 1 | /* Copyright (c) 2011 Nordic Semiconductor. All Rights Reserved. |
yihui | 1:a607cd9655d7 | 2 | * |
yihui | 1:a607cd9655d7 | 3 | * The information contained herein is confidential property of Nordic Semiconductor. The use, |
yihui | 1:a607cd9655d7 | 4 | * copying, transfer or disclosure of such information is prohibited except by express written |
yihui | 1:a607cd9655d7 | 5 | * agreement with Nordic Semiconductor. |
yihui | 1:a607cd9655d7 | 6 | * |
yihui | 1:a607cd9655d7 | 7 | */ |
yihui | 1:a607cd9655d7 | 8 | /** |
yihui | 1:a607cd9655d7 | 9 | @addtogroup BLE_COMMON |
yihui | 1:a607cd9655d7 | 10 | @{ |
yihui | 1:a607cd9655d7 | 11 | @defgroup ble_types Common types and macro definitions |
yihui | 1:a607cd9655d7 | 12 | @{ |
yihui | 1:a607cd9655d7 | 13 | |
yihui | 1:a607cd9655d7 | 14 | @brief Common types and macro definitions for the S110 SoftDevice. |
yihui | 1:a607cd9655d7 | 15 | */ |
yihui | 1:a607cd9655d7 | 16 | |
yihui | 1:a607cd9655d7 | 17 | #ifndef BLE_TYPES_H__ |
yihui | 1:a607cd9655d7 | 18 | #define BLE_TYPES_H__ |
yihui | 1:a607cd9655d7 | 19 | |
yihui | 1:a607cd9655d7 | 20 | #include <stdint.h> |
yihui | 1:a607cd9655d7 | 21 | |
yihui | 1:a607cd9655d7 | 22 | /** @addtogroup BLE_COMMON_DEFINES Defines |
yihui | 1:a607cd9655d7 | 23 | * @{ */ |
yihui | 1:a607cd9655d7 | 24 | |
yihui | 1:a607cd9655d7 | 25 | /** @defgroup BLE_CONN_HANDLES BLE Connection Handles |
yihui | 1:a607cd9655d7 | 26 | * @{ */ |
yihui | 1:a607cd9655d7 | 27 | #define BLE_CONN_HANDLE_INVALID 0xFFFF /**< Invalid Connection Handle. */ |
yihui | 1:a607cd9655d7 | 28 | #define BLE_CONN_HANDLE_ALL 0xFFFE /**< Applies to all Connection Handles. */ |
yihui | 1:a607cd9655d7 | 29 | /** @} */ |
yihui | 1:a607cd9655d7 | 30 | |
yihui | 1:a607cd9655d7 | 31 | |
yihui | 1:a607cd9655d7 | 32 | /** @defgroup BLE_UUID_VALUES Assigned Values for BLE UUIDs |
yihui | 1:a607cd9655d7 | 33 | * @{ */ |
yihui | 1:a607cd9655d7 | 34 | /* Generic UUIDs, applicable to all services */ |
yihui | 1:a607cd9655d7 | 35 | #define BLE_UUID_UNKNOWN 0x0000 /**< Reserved UUID. */ |
yihui | 1:a607cd9655d7 | 36 | #define BLE_UUID_SERVICE_PRIMARY 0x2800 /**< Primary Service. */ |
yihui | 1:a607cd9655d7 | 37 | #define BLE_UUID_SERVICE_SECONDARY 0x2801 /**< Secondary Service. */ |
yihui | 1:a607cd9655d7 | 38 | #define BLE_UUID_SERVICE_INCLUDE 0x2802 /**< Include. */ |
yihui | 1:a607cd9655d7 | 39 | #define BLE_UUID_CHARACTERISTIC 0x2803 /**< Characteristic. */ |
yihui | 1:a607cd9655d7 | 40 | #define BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP 0x2900 /**< Characteristic Extended Properties Descriptor. */ |
yihui | 1:a607cd9655d7 | 41 | #define BLE_UUID_DESCRIPTOR_CHAR_USER_DESC 0x2901 /**< Characteristic User Description Descriptor. */ |
yihui | 1:a607cd9655d7 | 42 | #define BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG 0x2902 /**< Client Characteristic Configuration Descriptor. */ |
yihui | 1:a607cd9655d7 | 43 | #define BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG 0x2903 /**< Server Characteristic Configuration Descriptor. */ |
yihui | 1:a607cd9655d7 | 44 | #define BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT 0x2904 /**< Characteristic Presentation Format Descriptor. */ |
yihui | 1:a607cd9655d7 | 45 | #define BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT 0x2905 /**< Characteristic Aggregate Format Descriptor. */ |
yihui | 1:a607cd9655d7 | 46 | /* GATT specific UUIDs */ |
yihui | 1:a607cd9655d7 | 47 | #define BLE_UUID_GATT 0x1801 /**< Generic Attribute Profile. */ |
yihui | 1:a607cd9655d7 | 48 | #define BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED 0x2A05 /**< Service Changed Characteristic. */ |
yihui | 1:a607cd9655d7 | 49 | /* GAP specific UUIDs */ |
yihui | 1:a607cd9655d7 | 50 | #define BLE_UUID_GAP 0x1800 /**< Generic Access Profile. */ |
yihui | 1:a607cd9655d7 | 51 | #define BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME 0x2A00 /**< Device Name Characteristic. */ |
yihui | 1:a607cd9655d7 | 52 | #define BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE 0x2A01 /**< Appearance Characteristic. */ |
yihui | 1:a607cd9655d7 | 53 | #define BLE_UUID_GAP_CHARACTERISTIC_PPF 0x2A02 /**< Peripheral Privacy Flag Characteristic. */ |
yihui | 1:a607cd9655d7 | 54 | #define BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR 0x2A03 /**< Reconnection Address Characteristic. */ |
yihui | 1:a607cd9655d7 | 55 | #define BLE_UUID_GAP_CHARACTERISTIC_PPCP 0x2A04 /**< Peripheral Preferred Connection Parameters Characteristic. */ |
yihui | 1:a607cd9655d7 | 56 | /** @} */ |
yihui | 1:a607cd9655d7 | 57 | |
yihui | 1:a607cd9655d7 | 58 | |
yihui | 1:a607cd9655d7 | 59 | /** @defgroup BLE_UUID_TYPES Types of UUID |
yihui | 1:a607cd9655d7 | 60 | * @{ */ |
yihui | 1:a607cd9655d7 | 61 | #define BLE_UUID_TYPE_UNKNOWN 0x00 /**< Invalid UUID type. */ |
yihui | 1:a607cd9655d7 | 62 | #define BLE_UUID_TYPE_BLE 0x01 /**< Bluetooth SIG UUID (16-bit). */ |
yihui | 1:a607cd9655d7 | 63 | #define BLE_UUID_TYPE_VENDOR_BEGIN 0x02 /**< Vendor UUID types start at this index (128-bit). */ |
yihui | 1:a607cd9655d7 | 64 | /** @} */ |
yihui | 1:a607cd9655d7 | 65 | |
yihui | 1:a607cd9655d7 | 66 | |
yihui | 1:a607cd9655d7 | 67 | /** @defgroup BLE_APPEARANCES Bluetooth Appearance values |
yihui | 1:a607cd9655d7 | 68 | * @note Retrieved from http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml |
yihui | 1:a607cd9655d7 | 69 | * @{ */ |
yihui | 1:a607cd9655d7 | 70 | #define BLE_APPEARANCE_UNKNOWN 0 /**< Unknown. */ |
yihui | 1:a607cd9655d7 | 71 | #define BLE_APPEARANCE_GENERIC_PHONE 64 /**< Generic Phone. */ |
yihui | 1:a607cd9655d7 | 72 | #define BLE_APPEARANCE_GENERIC_COMPUTER 128 /**< Generic Computer. */ |
yihui | 1:a607cd9655d7 | 73 | #define BLE_APPEARANCE_GENERIC_WATCH 192 /**< Generic Watch. */ |
yihui | 1:a607cd9655d7 | 74 | #define BLE_APPEARANCE_WATCH_SPORTS_WATCH 193 /**< Watch: Sports Watch. */ |
yihui | 1:a607cd9655d7 | 75 | #define BLE_APPEARANCE_GENERIC_CLOCK 256 /**< Generic Clock. */ |
yihui | 1:a607cd9655d7 | 76 | #define BLE_APPEARANCE_GENERIC_DISPLAY 320 /**< Generic Display. */ |
yihui | 1:a607cd9655d7 | 77 | #define BLE_APPEARANCE_GENERIC_REMOTE_CONTROL 384 /**< Generic Remote Control. */ |
yihui | 1:a607cd9655d7 | 78 | #define BLE_APPEARANCE_GENERIC_EYE_GLASSES 448 /**< Generic Eye-glasses. */ |
yihui | 1:a607cd9655d7 | 79 | #define BLE_APPEARANCE_GENERIC_TAG 512 /**< Generic Tag. */ |
yihui | 1:a607cd9655d7 | 80 | #define BLE_APPEARANCE_GENERIC_KEYRING 576 /**< Generic Keyring. */ |
yihui | 1:a607cd9655d7 | 81 | #define BLE_APPEARANCE_GENERIC_MEDIA_PLAYER 640 /**< Generic Media Player. */ |
yihui | 1:a607cd9655d7 | 82 | #define BLE_APPEARANCE_GENERIC_BARCODE_SCANNER 704 /**< Generic Barcode Scanner. */ |
yihui | 1:a607cd9655d7 | 83 | #define BLE_APPEARANCE_GENERIC_THERMOMETER 768 /**< Generic Thermometer. */ |
yihui | 1:a607cd9655d7 | 84 | #define BLE_APPEARANCE_THERMOMETER_EAR 769 /**< Thermometer: Ear. */ |
yihui | 1:a607cd9655d7 | 85 | #define BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR 832 /**< Generic Heart rate Sensor. */ |
yihui | 1:a607cd9655d7 | 86 | #define BLE_APPEARANCE_HEART_RATE_SENSOR_HEART_RATE_BELT 833 /**< Heart Rate Sensor: Heart Rate Belt. */ |
yihui | 1:a607cd9655d7 | 87 | #define BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE 896 /**< Generic Blood Pressure. */ |
yihui | 1:a607cd9655d7 | 88 | #define BLE_APPEARANCE_BLOOD_PRESSURE_ARM 897 /**< Blood Pressure: Arm. */ |
yihui | 1:a607cd9655d7 | 89 | #define BLE_APPEARANCE_BLOOD_PRESSURE_WRIST 898 /**< Blood Pressure: Wrist. */ |
yihui | 1:a607cd9655d7 | 90 | #define BLE_APPEARANCE_GENERIC_HID 960 /**< Human Interface Device (HID). */ |
yihui | 1:a607cd9655d7 | 91 | #define BLE_APPEARANCE_HID_KEYBOARD 961 /**< Keyboard (HID Subtype). */ |
yihui | 1:a607cd9655d7 | 92 | #define BLE_APPEARANCE_HID_MOUSE 962 /**< Mouse (HID Subtype). */ |
yihui | 1:a607cd9655d7 | 93 | #define BLE_APPEARANCE_HID_JOYSTICK 963 /**< Joystiq (HID Subtype). */ |
yihui | 1:a607cd9655d7 | 94 | #define BLE_APPEARANCE_HID_GAMEPAD 964 /**< Gamepad (HID Subtype). */ |
yihui | 1:a607cd9655d7 | 95 | #define BLE_APPEARANCE_HID_DIGITIZERSUBTYPE 965 /**< Digitizer Tablet (HID Subtype). */ |
yihui | 1:a607cd9655d7 | 96 | #define BLE_APPEARANCE_HID_CARD_READER 966 /**< Card Reader (HID Subtype). */ |
yihui | 1:a607cd9655d7 | 97 | #define BLE_APPEARANCE_HID_DIGITAL_PEN 967 /**< Digital Pen (HID Subtype). */ |
yihui | 1:a607cd9655d7 | 98 | #define BLE_APPEARANCE_HID_BARCODE 968 /**< Barcode Scanner (HID Subtype). */ |
yihui | 1:a607cd9655d7 | 99 | #define BLE_APPEARANCE_GENERIC_GLUCOSE_METER 1024 /**< Generic Glucose Meter. */ |
yihui | 1:a607cd9655d7 | 100 | #define BLE_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR 1088 /**< Generic Running Walking Sensor. */ |
yihui | 1:a607cd9655d7 | 101 | #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_IN_SHOE 1089 /**< Running Walking Sensor: In-Shoe. */ |
yihui | 1:a607cd9655d7 | 102 | #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_SHOE 1090 /**< Running Walking Sensor: On-Shoe. */ |
yihui | 1:a607cd9655d7 | 103 | #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_HIP 1091 /**< Running Walking Sensor: On-Hip. */ |
yihui | 1:a607cd9655d7 | 104 | #define BLE_APPEARANCE_GENERIC_CYCLING 1152 /**< Generic Cycling. */ |
yihui | 1:a607cd9655d7 | 105 | #define BLE_APPEARANCE_CYCLING_CYCLING_COMPUTER 1153 /**< Cycling: Cycling Computer. */ |
yihui | 1:a607cd9655d7 | 106 | #define BLE_APPEARANCE_CYCLING_SPEED_SENSOR 1154 /**< Cycling: Speed Sensor. */ |
yihui | 1:a607cd9655d7 | 107 | #define BLE_APPEARANCE_CYCLING_CADENCE_SENSOR 1155 /**< Cycling: Cadence Sensor. */ |
yihui | 1:a607cd9655d7 | 108 | #define BLE_APPEARANCE_CYCLING_POWER_SENSOR 1156 /**< Cycling: Power Sensor. */ |
yihui | 1:a607cd9655d7 | 109 | #define BLE_APPEARANCE_CYCLING_SPEED_CADENCE_SENSOR 1157 /**< Cycling: Speed and Cadence Sensor. */ |
yihui | 1:a607cd9655d7 | 110 | #define BLE_APPEARANCE_GENERIC_PULSE_OXIMETER 3136 /**< Generic Pulse Oximeter. */ |
yihui | 1:a607cd9655d7 | 111 | #define BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 3137 /**< Fingertip (Pulse Oximeter subtype). */ |
yihui | 1:a607cd9655d7 | 112 | #define BLE_APPEARANCE_PULSE_OXIMETER_WRIST_WORN 3138 /**< Wrist Worn(Pulse Oximeter subtype). */ |
yihui | 1:a607cd9655d7 | 113 | #define BLE_APPEARANCE_GENERIC_WEIGHT_SCALE 3200 /**< Generic Weight Scale. */ |
yihui | 1:a607cd9655d7 | 114 | #define BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS_ACT 5184 /**< Generic Outdoor Sports Activity. */ |
yihui | 1:a607cd9655d7 | 115 | #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_DISP 5185 /**< Location Display Device (Outdoor Sports Activity subtype). */ |
yihui | 1:a607cd9655d7 | 116 | #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_DISP 5186 /**< Location and Navigation Display Device (Outdoor Sports Activity subtype). */ |
yihui | 1:a607cd9655d7 | 117 | #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_POD 5187 /**< Location Pod (Outdoor Sports Activity subtype). */ |
yihui | 1:a607cd9655d7 | 118 | #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_POD 5188 /**< Location and Navigation Pod (Outdoor Sports Activity subtype). */ |
yihui | 1:a607cd9655d7 | 119 | /** @} */ |
yihui | 1:a607cd9655d7 | 120 | |
yihui | 1:a607cd9655d7 | 121 | /** @brief Set .type and .uuid fields of ble_uuid_struct to specified uuid value. */ |
yihui | 1:a607cd9655d7 | 122 | #define BLE_UUID_BLE_ASSIGN(instance, value) do {\ |
yihui | 1:a607cd9655d7 | 123 | instance.type = BLE_UUID_TYPE_BLE; \ |
yihui | 1:a607cd9655d7 | 124 | instance.uuid = value;} while(0) |
yihui | 1:a607cd9655d7 | 125 | |
yihui | 1:a607cd9655d7 | 126 | /** @brief Copy type and uuid members from src to dst ble_uuid_t pointer. Both pointers must be valid/non-null. */ |
yihui | 1:a607cd9655d7 | 127 | #define BLE_UUID_COPY_PTR(dst, src) do {\ |
yihui | 1:a607cd9655d7 | 128 | (dst)->type = (src)->type; \ |
yihui | 1:a607cd9655d7 | 129 | (dst)->uuid = (src)->uuid;} while(0) |
yihui | 1:a607cd9655d7 | 130 | |
yihui | 1:a607cd9655d7 | 131 | /** @brief Copy type and uuid members from src to dst ble_uuid_t struct. */ |
yihui | 1:a607cd9655d7 | 132 | #define BLE_UUID_COPY_INST(dst, src) do {\ |
yihui | 1:a607cd9655d7 | 133 | (dst).type = (src).type; \ |
yihui | 1:a607cd9655d7 | 134 | (dst).uuid = (src).uuid;} while(0) |
yihui | 1:a607cd9655d7 | 135 | |
yihui | 1:a607cd9655d7 | 136 | /** @brief Compare for equality both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */ |
yihui | 1:a607cd9655d7 | 137 | #define BLE_UUID_EQ(p_uuid1, p_uuid2) \ |
yihui | 1:a607cd9655d7 | 138 | (((p_uuid1)->type == (p_uuid2)->type) && ((p_uuid1)->uuid == (p_uuid2)->uuid)) |
yihui | 1:a607cd9655d7 | 139 | |
yihui | 1:a607cd9655d7 | 140 | /** @brief Compare for difference both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */ |
yihui | 1:a607cd9655d7 | 141 | #define BLE_UUID_NEQ(p_uuid1, p_uuid2) \ |
yihui | 1:a607cd9655d7 | 142 | (((p_uuid1)->type != (p_uuid2)->type) || ((p_uuid1)->uuid != (p_uuid2)->uuid)) |
yihui | 1:a607cd9655d7 | 143 | |
yihui | 1:a607cd9655d7 | 144 | /** @} */ |
yihui | 1:a607cd9655d7 | 145 | |
yihui | 1:a607cd9655d7 | 146 | /** @addtogroup BLE_TYPES_STRUCTURES Structures |
yihui | 1:a607cd9655d7 | 147 | * @{ */ |
yihui | 1:a607cd9655d7 | 148 | |
yihui | 1:a607cd9655d7 | 149 | /** @brief 128 bit UUID values. */ |
yihui | 1:a607cd9655d7 | 150 | typedef struct |
yihui | 1:a607cd9655d7 | 151 | { |
yihui | 1:a607cd9655d7 | 152 | unsigned char uuid128[16]; |
yihui | 1:a607cd9655d7 | 153 | } ble_uuid128_t; |
yihui | 1:a607cd9655d7 | 154 | |
yihui | 1:a607cd9655d7 | 155 | /** @brief Bluetooth Low Energy UUID type, encapsulates both 16-bit and 128-bit UUIDs. */ |
yihui | 1:a607cd9655d7 | 156 | typedef struct |
yihui | 1:a607cd9655d7 | 157 | { |
yihui | 1:a607cd9655d7 | 158 | uint16_t uuid; /**< 16-bit UUID value or octets 12-13 of 128-bit UUID. */ |
yihui | 1:a607cd9655d7 | 159 | uint8_t type; /**< UUID type, see @ref BLE_UUID_TYPES. If type is BLE_UUID_TYPE_UNKNOWN, the value of uuid is undefined. */ |
yihui | 1:a607cd9655d7 | 160 | } ble_uuid_t; |
yihui | 1:a607cd9655d7 | 161 | |
yihui | 1:a607cd9655d7 | 162 | /** @} */ |
yihui | 1:a607cd9655d7 | 163 | |
yihui | 1:a607cd9655d7 | 164 | #endif /* BLE_TYPES_H__ */ |
yihui | 1:a607cd9655d7 | 165 | |
yihui | 1:a607cd9655d7 | 166 | /** |
yihui | 1:a607cd9655d7 | 167 | @} |
yihui | 1:a607cd9655d7 | 168 | @} |
yihui | 1:a607cd9655d7 | 169 | */ |