mbed.org local branch of microbit-dal. The real version lives in git at https://github.com/lancaster-university/microbit-dal

Dependencies:   BLE_API nRF51822 mbed-dev-bin

Dependents:   microbit Microbit IoTChallenge1 microbit ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ErrorNo.h Source File

ErrorNo.h

00001 /*
00002 The MIT License (MIT)
00003 
00004 Copyright (c) 2016 British Broadcasting Corporation.
00005 This software is provided by Lancaster University by arrangement with the BBC.
00006 
00007 Permission is hereby granted, free of charge, to any person obtaining a
00008 copy of this software and associated documentation files (the "Software"),
00009 to deal in the Software without restriction, including without limitation
00010 the rights to use, copy, modify, merge, publish, distribute, sublicense,
00011 and/or sell copies of the Software, and to permit persons to whom the
00012 Software is furnished to do so, subject to the following conditions:
00013 
00014 The above copyright notice and this permission notice shall be included in
00015 all copies or substantial portions of the Software.
00016 
00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00018 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00020 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00021 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00022 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00023 DEALINGS IN THE SOFTWARE.
00024 */
00025 
00026 #ifndef ERROR_NO_H
00027 #define ERROR_NO_H
00028 
00029 #include "MicroBitConfig.h"
00030 
00031 /**
00032   * Error codes used in the micro:bit runtime.
00033   * These may be returned from functions implemented in the micro:bit runtime.
00034   */
00035 enum ErrorCode{
00036 
00037     // No error occurred.
00038     MICROBIT_OK = 0,
00039 
00040     // Invalid parameter given.
00041     MICROBIT_INVALID_PARAMETER = -1001,
00042 
00043     // Requested operation is unsupported.
00044     MICROBIT_NOT_SUPPORTED = -1002,
00045 
00046     // Device calibration errors
00047     MICROBIT_CALIBRATION_IN_PROGRESS = -1003,
00048     MICROBIT_CALIBRATION_REQUIRED = -1004,
00049 
00050     // The requested operation could not be performed as the device has run out of some essential resource (e.g. allocated memory)
00051     MICROBIT_NO_RESOURCES = -1005,
00052 
00053     // The requested operation could not be performed as some essential resource is busy (e.g. the display)
00054     MICROBIT_BUSY = -1006,
00055 
00056     // The requested operation was cancelled before it completed.
00057     MICROBIT_CANCELLED = -1007,
00058 
00059     // I2C Communication error occured (typically I2C module on processor has locked up.)
00060     MICROBIT_I2C_ERROR = -1010,
00061 
00062     // The serial bus is currently in use by another fiber.
00063     MICROBIT_SERIAL_IN_USE = -1011,
00064 
00065     // The requested operation had no data to return.
00066     MICROBIT_NO_DATA = -1012
00067 };
00068 
00069 /**
00070   * Error codes used in the micro:bit runtime.
00071   */
00072 enum PanicCode{
00073     // PANIC Codes. These are not return codes, but are terminal conditions.
00074     // These induce a panic operation, where all code stops executing, and a panic state is
00075     // entered where the panic code is diplayed.
00076 
00077     // Out out memory error. Heap storage was requested, but is not available.
00078     MICROBIT_OOM = 20,
00079 
00080     // Corruption detected in the micro:bit heap space
00081     MICROBIT_HEAP_ERROR = 30,
00082 
00083     // Dereference of a NULL pointer through the ManagedType class,
00084     MICROBIT_NULL_DEREFERENCE = 40,
00085 };
00086 #endif