Bluetooth UART support for the Adafruit BluefruitLE SPI, for the University of York Engineering Stage 1 project

Committer:
ajp109
Date:
Sat Feb 06 20:58:22 2021 +0000
Revision:
0:a80552d32b80
Initial commit (not working)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ajp109 0:a80552d32b80 1 /******************************************************************************/
ajp109 0:a80552d32b80 2 /*!
ajp109 0:a80552d32b80 3 @file errors.h
ajp109 0:a80552d32b80 4
ajp109 0:a80552d32b80 5 @section LICENSE
ajp109 0:a80552d32b80 6
ajp109 0:a80552d32b80 7 Software License Agreement (BSD License)
ajp109 0:a80552d32b80 8
ajp109 0:a80552d32b80 9 Copyright (c) 2014, Adafruit Industries (adafruit.com)
ajp109 0:a80552d32b80 10 All rights reserved.
ajp109 0:a80552d32b80 11
ajp109 0:a80552d32b80 12 Redistribution and use in source and binary forms, with or without
ajp109 0:a80552d32b80 13 modification, are permitted provided that the following conditions are met:
ajp109 0:a80552d32b80 14 1. Redistributions of source code must retain the above copyright
ajp109 0:a80552d32b80 15 notice, this list of conditions and the following disclaimer.
ajp109 0:a80552d32b80 16 2. Redistributions in binary form must reproduce the above copyright
ajp109 0:a80552d32b80 17 notice, this list of conditions and the following disclaimer in the
ajp109 0:a80552d32b80 18 documentation and/or other materials provided with the distribution.
ajp109 0:a80552d32b80 19 3. Neither the name of the copyright holders nor the
ajp109 0:a80552d32b80 20 names of its contributors may be used to endorse or promote products
ajp109 0:a80552d32b80 21 derived from this software without specific prior written permission.
ajp109 0:a80552d32b80 22
ajp109 0:a80552d32b80 23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
ajp109 0:a80552d32b80 24 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
ajp109 0:a80552d32b80 25 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
ajp109 0:a80552d32b80 26 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
ajp109 0:a80552d32b80 27 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
ajp109 0:a80552d32b80 28 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
ajp109 0:a80552d32b80 29 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ajp109 0:a80552d32b80 30 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
ajp109 0:a80552d32b80 31 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
ajp109 0:a80552d32b80 32 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ajp109 0:a80552d32b80 33 */
ajp109 0:a80552d32b80 34 /******************************************************************************/
ajp109 0:a80552d32b80 35 #ifndef _ERRORS_H_
ajp109 0:a80552d32b80 36 #define _ERRORS_H_
ajp109 0:a80552d32b80 37
ajp109 0:a80552d32b80 38 #ifdef __cplusplus
ajp109 0:a80552d32b80 39 extern "C" {
ajp109 0:a80552d32b80 40 #endif
ajp109 0:a80552d32b80 41
ajp109 0:a80552d32b80 42 /******************************************************************************/
ajp109 0:a80552d32b80 43 /*!
ajp109 0:a80552d32b80 44 @brief Standard error codes used throughout this codebase
ajp109 0:a80552d32b80 45 */
ajp109 0:a80552d32b80 46 /******************************************************************************/
ajp109 0:a80552d32b80 47 typedef enum {
ajp109 0:a80552d32b80 48 /*=======================================================================
ajp109 0:a80552d32b80 49 CUSTOM GLOBAL ERRORS 0x8000 .. 0x801F
ajp109 0:a80552d32b80 50 -----------------------------------------------------------------------
ajp109 0:a80552d32b80 51 Custom global errors (not defined by Nordic)
ajp109 0:a80552d32b80 52 -----------------------------------------------------------------------*/
ajp109 0:a80552d32b80 53 ERROR_INITFAILED = 0x8001, ///< Function or driver initialisation failed
ajp109 0:a80552d32b80 54 ERROR_NOT_INITIALISED = 0x8002, ///< Attempted to call a function in an unitialised device/driver
ajp109 0:a80552d32b80 55 ERROR_I2C_XFER_FAILED = 0x8003, ///< I2C transfer failure
ajp109 0:a80552d32b80 56 /*=======================================================================*/
ajp109 0:a80552d32b80 57
ajp109 0:a80552d32b80 58
ajp109 0:a80552d32b80 59 /*=======================================================================
ajp109 0:a80552d32b80 60 SIMPLE BINARY PROTOCOL ERRORS 0x8020 .. 0x803F
ajp109 0:a80552d32b80 61 -----------------------------------------------------------------------
ajp109 0:a80552d32b80 62 Errors relating to the simple binary protocol
ajp109 0:a80552d32b80 63 -----------------------------------------------------------------------*/
ajp109 0:a80552d32b80 64 ERROR_SDEP_INVALIDMSGTYPE = 0x8021, ///< Unexpected msg type encountered
ajp109 0:a80552d32b80 65 ERROR_SDEP_INVALIDCOMMANDID = 0x8022, ///< Unknown or out of range command ID
ajp109 0:a80552d32b80 66 ERROR_SDEP_INVALIDPAYLOAD = 0x8023, ///< Message payload has a problem (invalid len, etc.)
ajp109 0:a80552d32b80 67 /*=======================================================================*/
ajp109 0:a80552d32b80 68
ajp109 0:a80552d32b80 69
ajp109 0:a80552d32b80 70 /*=======================================================================
ajp109 0:a80552d32b80 71 COMMAND LINE INTERFACE ERRORS 0x8040 .. 0x805F
ajp109 0:a80552d32b80 72 -----------------------------------------------------------------------
ajp109 0:a80552d32b80 73 Errors relating to the simple binary protocol
ajp109 0:a80552d32b80 74 -----------------------------------------------------------------------*/
ajp109 0:a80552d32b80 75 ERROR_CLI_UNKNOWN_COMMAND = 0x8041, ///< Unknown Command entered
ajp109 0:a80552d32b80 76 ERROR_CLI_TOO_FEW_ARGUMENTS = 0x8042, ///< Too Few Arguments
ajp109 0:a80552d32b80 77 ERROR_CLI_TOO_MANY_ARGUMENTS = 0x8043, ///< Too Few Arguments
ajp109 0:a80552d32b80 78 /*=======================================================================*/
ajp109 0:a80552d32b80 79
ajp109 0:a80552d32b80 80 /*=======================================================================
ajp109 0:a80552d32b80 81 AT PARSER ERRORS 0x8060 .. 0x807F
ajp109 0:a80552d32b80 82 -----------------------------------------------------------------------
ajp109 0:a80552d32b80 83 Errors relating to AT Command
ajp109 0:a80552d32b80 84 -----------------------------------------------------------------------*/
ajp109 0:a80552d32b80 85 ERROR_AT_INVALID_INPUT = 0x8060,
ajp109 0:a80552d32b80 86 ERROR_AT_UNKNOWN_COMMAND = 0x8061,
ajp109 0:a80552d32b80 87 ERROR_AT_INVALID_PARAMETER = 0x8062,
ajp109 0:a80552d32b80 88 /*=======================================================================*/
ajp109 0:a80552d32b80 89
ajp109 0:a80552d32b80 90 /*=======================================================================
ajp109 0:a80552d32b80 91 NVM ERRORS 0x8080 .. 0x809F
ajp109 0:a80552d32b80 92 -----------------------------------------------------------------------
ajp109 0:a80552d32b80 93 Errors relating to the NVM
ajp109 0:a80552d32b80 94 -----------------------------------------------------------------------*/
ajp109 0:a80552d32b80 95 ERROR_NVM_BUSY = 0x8060,
ajp109 0:a80552d32b80 96 /*=======================================================================*/
ajp109 0:a80552d32b80 97
ajp109 0:a80552d32b80 98 /*=======================================================================
ajp109 0:a80552d32b80 99 OS Abstraction Layer 0x80A0 .. 0x80BF
ajp109 0:a80552d32b80 100 -----------------------------------------------------------------------
ajp109 0:a80552d32b80 101 Errors relating to the NVM
ajp109 0:a80552d32b80 102 -----------------------------------------------------------------------*/
ajp109 0:a80552d32b80 103 ERROR_OSAL_WAITING = 0x80A0,
ajp109 0:a80552d32b80 104 /*=======================================================================*/
ajp109 0:a80552d32b80 105
ajp109 0:a80552d32b80 106 /*=======================================================================
ajp109 0:a80552d32b80 107 NORDIC GLOBAL ERRORS 0x0000 .. 0x00FF
ajp109 0:a80552d32b80 108 -----------------------------------------------------------------------
ajp109 0:a80552d32b80 109 Errors mapped from nrf_error.h
ajp109 0:a80552d32b80 110 -----------------------------------------------------------------------*/
ajp109 0:a80552d32b80 111 ERROR_NONE = 0x0000, ///< Successful command
ajp109 0:a80552d32b80 112 ERROR_SVC_HANDLER_MISSING = 0x0001, ///< SVC handler is missing
ajp109 0:a80552d32b80 113 ERROR_SOFTDEVICE_NOT_ENABLED = 0x0002, ///< SoftDevice has not been enabled
ajp109 0:a80552d32b80 114 ERROR_INTERNAL = 0x0003, ///< Internal Error
ajp109 0:a80552d32b80 115 ERROR_NO_MEM = 0x0004, ///< No Memory for operation
ajp109 0:a80552d32b80 116 ERROR_NOT_FOUND = 0x0005, ///< Not found
ajp109 0:a80552d32b80 117 ERROR_NOT_SUPPORTED = 0x0006, ///< Not supported
ajp109 0:a80552d32b80 118 ERROR_INVALID_PARAM = 0x0007, ///< Invalid Parameter
ajp109 0:a80552d32b80 119 ERROR_INVALID_STATE = 0x0008, ///< Invalid state, operation disallowed in this state
ajp109 0:a80552d32b80 120 ERROR_INVALID_LENGTH = 0x0009, ///< Invalid Length
ajp109 0:a80552d32b80 121 ERROR_INVALID_FLAGS = 0x000A, ///< Invalid Flags
ajp109 0:a80552d32b80 122 ERROR_INVALID_DATA = 0x000B, ///< Invalid Data
ajp109 0:a80552d32b80 123 ERROR_DATA_SIZE = 0x000C, ///< Data size exceeds limit
ajp109 0:a80552d32b80 124 ERROR_TIMEOUT = 0x000D, ///< Operation timed out
ajp109 0:a80552d32b80 125 ERROR_NULL = 0x000E, ///< Null Pointer
ajp109 0:a80552d32b80 126 ERROR_FORBIDDEN = 0x000F, ///< Forbidden Operation
ajp109 0:a80552d32b80 127 ERROR_INVALID_ADDR = 0x0010, ///< Bad Memory Address
ajp109 0:a80552d32b80 128 ERROR_BUSY = 0x0011, ///< Busy
ajp109 0:a80552d32b80 129 /*=======================================================================*/
ajp109 0:a80552d32b80 130
ajp109 0:a80552d32b80 131
ajp109 0:a80552d32b80 132 /*=======================================================================
ajp109 0:a80552d32b80 133 NORDIC SDM ERRORS 0x1000 .. 0x1FFF
ajp109 0:a80552d32b80 134 -----------------------------------------------------------------------
ajp109 0:a80552d32b80 135 Errors based on Nordic's SDM nrf_error_sdm.h
ajp109 0:a80552d32b80 136 -----------------------------------------------------------------------*/
ajp109 0:a80552d32b80 137 ERROR_SDM_LFCLK_SOURCE_UNKNOWN = 0x1000, ///< Unknown lfclk source
ajp109 0:a80552d32b80 138 ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION = 0x1001, ///< Incorrect interrupt configuration (can be caused by using illegal priority levels, or having enabled SoftDevice interrupts)
ajp109 0:a80552d32b80 139 ERROR_SDM_INCORRECT_CLENR0 = 0x1002, ///< Incorrect CLENR0 (can be caused by erronous SoftDevice flashing)
ajp109 0:a80552d32b80 140 /*=======================================================================*/
ajp109 0:a80552d32b80 141
ajp109 0:a80552d32b80 142
ajp109 0:a80552d32b80 143 /*=======================================================================
ajp109 0:a80552d32b80 144 NORDIC SOC ERRORS 0x2000 .. 0x2FFF
ajp109 0:a80552d32b80 145 -----------------------------------------------------------------------
ajp109 0:a80552d32b80 146 Errors based on Nordic's nrf_error_soc.h
ajp109 0:a80552d32b80 147 -----------------------------------------------------------------------*/
ajp109 0:a80552d32b80 148 /* Mutex Errors */
ajp109 0:a80552d32b80 149 ERROR_SOC_MUTEX_ALREADY_TAKEN = 0x2000, ///< Mutex already taken
ajp109 0:a80552d32b80 150
ajp109 0:a80552d32b80 151 /* NVIC errors */
ajp109 0:a80552d32b80 152 ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE = 0x2001, ///< NVIC interrupt not available
ajp109 0:a80552d32b80 153 ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED = 0x2002, ///< NVIC interrupt priority not allowed
ajp109 0:a80552d32b80 154 ERROR_SOC_NVIC_SHOULD_NOT_RETURN = 0x2003, ///< NVIC should not return
ajp109 0:a80552d32b80 155
ajp109 0:a80552d32b80 156 /* Power errors */
ajp109 0:a80552d32b80 157 ERROR_SOC_POWER_MODE_UNKNOWN = 0x2004, ///< Power mode unknown
ajp109 0:a80552d32b80 158 ERROR_SOC_POWER_POF_THRESHOLD_UNKNOWN = 0x2005, ///< Power POF threshold unknown
ajp109 0:a80552d32b80 159 ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN = 0x2006, ///< Power off should not return
ajp109 0:a80552d32b80 160
ajp109 0:a80552d32b80 161 /* Rand errors */
ajp109 0:a80552d32b80 162 ERROR_SOC_RAND_NOT_ENOUGH_VALUES = 0x2007, ///< RAND not enough values
ajp109 0:a80552d32b80 163
ajp109 0:a80552d32b80 164 /* PPI errors */
ajp109 0:a80552d32b80 165 ERROR_SOC_PPI_INVALID_CHANNEL = 0x2008, ///< Invalid PPI Channel
ajp109 0:a80552d32b80 166 ERROR_SOC_PPI_INVALID_GROUP = 0x2009, ///< Invalid PPI Group
ajp109 0:a80552d32b80 167 /*=======================================================================*/
ajp109 0:a80552d32b80 168
ajp109 0:a80552d32b80 169
ajp109 0:a80552d32b80 170 /*=======================================================================
ajp109 0:a80552d32b80 171 NORDIC BLE ERRORS 0x3000 .. 0x3FFF
ajp109 0:a80552d32b80 172 -----------------------------------------------------------------------
ajp109 0:a80552d32b80 173 Errors based on Nordic's ble_err.h
ajp109 0:a80552d32b80 174 -----------------------------------------------------------------------*/
ajp109 0:a80552d32b80 175 ERROR_BLE_NOT_ENABLED = 0x3001,
ajp109 0:a80552d32b80 176 ERROR_BLE_INVALID_CONN_HANDLE = 0x3002, ///< Invalid connection handle.
ajp109 0:a80552d32b80 177 ERROR_BLE_INVALID_ATTR_HANDLE = 0x3003, ///< Invalid attribute handle.
ajp109 0:a80552d32b80 178 ERROR_BLE_NO_TX_BUFFERS = 0x3004, ///< Buffer capacity exceeded.
ajp109 0:a80552d32b80 179
ajp109 0:a80552d32b80 180 /* L2CAP */
ajp109 0:a80552d32b80 181 ERROR_BLE_L2CAP_CID_IN_USE = 0x3100, ///< CID already in use.
ajp109 0:a80552d32b80 182
ajp109 0:a80552d32b80 183 /* GAP */
ajp109 0:a80552d32b80 184 ERROR_BLE_GAP_UUID_LIST_MISMATCH = 0x3200, ///< UUID list does not contain an integral number of UUIDs.
ajp109 0:a80552d32b80 185 ERROR_BLE_GAP_DISCOVERABLE_WITH_WHITELIST = 0x3201, ///< Use of Whitelist not permitted with discoverable advertising.
ajp109 0:a80552d32b80 186 ERROR_BLE_GAP_INVALID_BLE_ADDR = 0x3202, ///< The upper two bits of the address do not correspond to the specified address type.
ajp109 0:a80552d32b80 187
ajp109 0:a80552d32b80 188 /* GATTC */
ajp109 0:a80552d32b80 189 ERROR_BLE_GATTC_PROC_NOT_PERMITTED = 0x3300,
ajp109 0:a80552d32b80 190
ajp109 0:a80552d32b80 191 /* GATTS */
ajp109 0:a80552d32b80 192 ERROR_BLEGATTS_INVALID_ATTR_TYPE = 0x3400, ///< Invalid attribute type.
ajp109 0:a80552d32b80 193 ERROR_BLEGATTS_SYS_ATTR_MISSING = 0x3401, ///< System Attributes missing.
ajp109 0:a80552d32b80 194 /*=======================================================================*/
ajp109 0:a80552d32b80 195 } err_t;
ajp109 0:a80552d32b80 196
ajp109 0:a80552d32b80 197 #ifdef __cplusplus
ajp109 0:a80552d32b80 198 }
ajp109 0:a80552d32b80 199 #endif
ajp109 0:a80552d32b80 200
ajp109 0:a80552d32b80 201 #endif /* _ERROR_H_ */