To get started with Seeed Tiny BLE, include detecting motion, button and battery level.

Dependencies:   BLE_API eMPL_MPU6050 mbed nRF51822

Committer:
yihui
Date:
Wed Apr 22 07:47:17 2015 +0000
Revision:
1:fc2f9d636751
update libraries; ; delete nRF51822/nordic-sdk/components/gpiote/app_gpiote.c to solve GPIOTE_IRQHandler multiply defined issue. temperarily change nRF51822 library to folder

Who changed what in which revision?

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