from bbc microbit library

Dependencies:   BLE_API mbed-dev-bin nRF51822

Dependents:   microbit

Fork of microbit-dal by Lancaster University

Committer:
euxton
Date:
Thu Jan 11 21:54:30 2018 +0000
Revision:
75:c700add33ba5
Parent:
1:8aa5cdb4ab67
1st commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jonathan Austin 1:8aa5cdb4ab67 1 /*
Jonathan Austin 1:8aa5cdb4ab67 2 The MIT License (MIT)
Jonathan Austin 1:8aa5cdb4ab67 3
Jonathan Austin 1:8aa5cdb4ab67 4 Copyright (c) 2016 British Broadcasting Corporation.
Jonathan Austin 1:8aa5cdb4ab67 5 This software is provided by Lancaster University by arrangement with the BBC.
Jonathan Austin 1:8aa5cdb4ab67 6
Jonathan Austin 1:8aa5cdb4ab67 7 Permission is hereby granted, free of charge, to any person obtaining a
Jonathan Austin 1:8aa5cdb4ab67 8 copy of this software and associated documentation files (the "Software"),
Jonathan Austin 1:8aa5cdb4ab67 9 to deal in the Software without restriction, including without limitation
Jonathan Austin 1:8aa5cdb4ab67 10 the rights to use, copy, modify, merge, publish, distribute, sublicense,
Jonathan Austin 1:8aa5cdb4ab67 11 and/or sell copies of the Software, and to permit persons to whom the
Jonathan Austin 1:8aa5cdb4ab67 12 Software is furnished to do so, subject to the following conditions:
Jonathan Austin 1:8aa5cdb4ab67 13
Jonathan Austin 1:8aa5cdb4ab67 14 The above copyright notice and this permission notice shall be included in
Jonathan Austin 1:8aa5cdb4ab67 15 all copies or substantial portions of the Software.
Jonathan Austin 1:8aa5cdb4ab67 16
Jonathan Austin 1:8aa5cdb4ab67 17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Jonathan Austin 1:8aa5cdb4ab67 18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Jonathan Austin 1:8aa5cdb4ab67 19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
Jonathan Austin 1:8aa5cdb4ab67 20 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Jonathan Austin 1:8aa5cdb4ab67 21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
Jonathan Austin 1:8aa5cdb4ab67 22 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
Jonathan Austin 1:8aa5cdb4ab67 23 DEALINGS IN THE SOFTWARE.
Jonathan Austin 1:8aa5cdb4ab67 24 */
Jonathan Austin 1:8aa5cdb4ab67 25
Jonathan Austin 1:8aa5cdb4ab67 26 #ifndef ERROR_NO_H
Jonathan Austin 1:8aa5cdb4ab67 27 #define ERROR_NO_H
Jonathan Austin 1:8aa5cdb4ab67 28
Jonathan Austin 1:8aa5cdb4ab67 29 #include "MicroBitConfig.h"
Jonathan Austin 1:8aa5cdb4ab67 30
Jonathan Austin 1:8aa5cdb4ab67 31 /**
Jonathan Austin 1:8aa5cdb4ab67 32 * Error codes used in the micro:bit runtime.
Jonathan Austin 1:8aa5cdb4ab67 33 * These may be returned from functions implemented in the micro:bit runtime.
Jonathan Austin 1:8aa5cdb4ab67 34 */
Jonathan Austin 1:8aa5cdb4ab67 35 enum ErrorCode{
Jonathan Austin 1:8aa5cdb4ab67 36
Jonathan Austin 1:8aa5cdb4ab67 37 // No error occurred.
Jonathan Austin 1:8aa5cdb4ab67 38 MICROBIT_OK = 0,
Jonathan Austin 1:8aa5cdb4ab67 39
Jonathan Austin 1:8aa5cdb4ab67 40 // Invalid parameter given.
Jonathan Austin 1:8aa5cdb4ab67 41 MICROBIT_INVALID_PARAMETER = -1001,
Jonathan Austin 1:8aa5cdb4ab67 42
Jonathan Austin 1:8aa5cdb4ab67 43 // Requested operation is unsupported.
Jonathan Austin 1:8aa5cdb4ab67 44 MICROBIT_NOT_SUPPORTED = -1002,
Jonathan Austin 1:8aa5cdb4ab67 45
Jonathan Austin 1:8aa5cdb4ab67 46 // Device calibration errors
Jonathan Austin 1:8aa5cdb4ab67 47 MICROBIT_CALIBRATION_IN_PROGRESS = -1003,
Jonathan Austin 1:8aa5cdb4ab67 48 MICROBIT_CALIBRATION_REQUIRED = -1004,
Jonathan Austin 1:8aa5cdb4ab67 49
Jonathan Austin 1:8aa5cdb4ab67 50 // The requested operation could not be performed as the device has run out of some essential resource (e.g. allocated memory)
Jonathan Austin 1:8aa5cdb4ab67 51 MICROBIT_NO_RESOURCES = -1005,
Jonathan Austin 1:8aa5cdb4ab67 52
Jonathan Austin 1:8aa5cdb4ab67 53 // The requested operation could not be performed as some essential resource is busy (e.g. the display)
Jonathan Austin 1:8aa5cdb4ab67 54 MICROBIT_BUSY = -1006,
Jonathan Austin 1:8aa5cdb4ab67 55
Jonathan Austin 1:8aa5cdb4ab67 56 // The requested operation was cancelled before it completed.
Jonathan Austin 1:8aa5cdb4ab67 57 MICROBIT_CANCELLED = -1007,
Jonathan Austin 1:8aa5cdb4ab67 58
Jonathan Austin 1:8aa5cdb4ab67 59 // I2C Communication error occured (typically I2C module on processor has locked up.)
Jonathan Austin 1:8aa5cdb4ab67 60 MICROBIT_I2C_ERROR = -1010,
Jonathan Austin 1:8aa5cdb4ab67 61
Jonathan Austin 1:8aa5cdb4ab67 62 // The serial bus is currently in use by another fiber.
Jonathan Austin 1:8aa5cdb4ab67 63 MICROBIT_SERIAL_IN_USE = -1011,
Jonathan Austin 1:8aa5cdb4ab67 64
Jonathan Austin 1:8aa5cdb4ab67 65 // The requested operation had no data to return.
Jonathan Austin 1:8aa5cdb4ab67 66 MICROBIT_NO_DATA = -1012
Jonathan Austin 1:8aa5cdb4ab67 67 };
Jonathan Austin 1:8aa5cdb4ab67 68
Jonathan Austin 1:8aa5cdb4ab67 69 /**
Jonathan Austin 1:8aa5cdb4ab67 70 * Error codes used in the micro:bit runtime.
Jonathan Austin 1:8aa5cdb4ab67 71 */
Jonathan Austin 1:8aa5cdb4ab67 72 enum PanicCode{
Jonathan Austin 1:8aa5cdb4ab67 73 // PANIC Codes. These are not return codes, but are terminal conditions.
Jonathan Austin 1:8aa5cdb4ab67 74 // These induce a panic operation, where all code stops executing, and a panic state is
Jonathan Austin 1:8aa5cdb4ab67 75 // entered where the panic code is diplayed.
Jonathan Austin 1:8aa5cdb4ab67 76
Jonathan Austin 1:8aa5cdb4ab67 77 // Out out memory error. Heap storage was requested, but is not available.
Jonathan Austin 1:8aa5cdb4ab67 78 MICROBIT_OOM = 20,
Jonathan Austin 1:8aa5cdb4ab67 79
Jonathan Austin 1:8aa5cdb4ab67 80 // Corruption detected in the micro:bit heap space
Jonathan Austin 1:8aa5cdb4ab67 81 MICROBIT_HEAP_ERROR = 30,
Jonathan Austin 1:8aa5cdb4ab67 82
Jonathan Austin 1:8aa5cdb4ab67 83 // Dereference of a NULL pointer through the ManagedType class,
Jonathan Austin 1:8aa5cdb4ab67 84 MICROBIT_NULL_DEREFERENCE = 40,
Jonathan Austin 1:8aa5cdb4ab67 85 };
Jonathan Austin 1:8aa5cdb4ab67 86 #endif