Biomimetics MBED Library w/ Added Support for CAN3
Dependents: CAN_TEST SPIne_Plus_DYNO_SENSORS SPIne_Plus_v2 SPIne_Plus_Dyno_v2
platform/mbed_error.h@0:083111ae2a11, 2020-11-26 (annotated)
- Committer:
- saloutos
- Date:
- Thu Nov 26 04:08:56 2020 +0000
- Revision:
- 0:083111ae2a11
first commit of leaned mbed dev lib
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
saloutos | 0:083111ae2a11 | 1 | |
saloutos | 0:083111ae2a11 | 2 | /** \addtogroup platform */ |
saloutos | 0:083111ae2a11 | 3 | /** @{*/ |
saloutos | 0:083111ae2a11 | 4 | /* mbed Microcontroller Library |
saloutos | 0:083111ae2a11 | 5 | * Copyright (c) 2006-2013 ARM Limited |
saloutos | 0:083111ae2a11 | 6 | * |
saloutos | 0:083111ae2a11 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
saloutos | 0:083111ae2a11 | 8 | * you may not use this file except in compliance with the License. |
saloutos | 0:083111ae2a11 | 9 | * You may obtain a copy of the License at |
saloutos | 0:083111ae2a11 | 10 | * |
saloutos | 0:083111ae2a11 | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
saloutos | 0:083111ae2a11 | 12 | * |
saloutos | 0:083111ae2a11 | 13 | * Unless required by applicable law or agreed to in writing, software |
saloutos | 0:083111ae2a11 | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
saloutos | 0:083111ae2a11 | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
saloutos | 0:083111ae2a11 | 16 | * See the License for the specific language governing permissions and |
saloutos | 0:083111ae2a11 | 17 | * limitations under the License. |
saloutos | 0:083111ae2a11 | 18 | */ |
saloutos | 0:083111ae2a11 | 19 | #ifndef MBED_ERROR_H |
saloutos | 0:083111ae2a11 | 20 | #define MBED_ERROR_H |
saloutos | 0:083111ae2a11 | 21 | |
saloutos | 0:083111ae2a11 | 22 | |
saloutos | 0:083111ae2a11 | 23 | |
saloutos | 0:083111ae2a11 | 24 | /** To generate a fatal compile-time error, you can use the pre-processor #error directive. |
saloutos | 0:083111ae2a11 | 25 | * |
saloutos | 0:083111ae2a11 | 26 | * @param format C string that contains data stream to be printed. |
saloutos | 0:083111ae2a11 | 27 | * Code snippets below show valid format. |
saloutos | 0:083111ae2a11 | 28 | * |
saloutos | 0:083111ae2a11 | 29 | * @code |
saloutos | 0:083111ae2a11 | 30 | * #error "That shouldn't have happened!" |
saloutos | 0:083111ae2a11 | 31 | * @endcode |
saloutos | 0:083111ae2a11 | 32 | * |
saloutos | 0:083111ae2a11 | 33 | * If the compiler evaluates this line, it will report the error and stop the compile. |
saloutos | 0:083111ae2a11 | 34 | * |
saloutos | 0:083111ae2a11 | 35 | * For example, you could use this to check some user-defined compile-time variables: |
saloutos | 0:083111ae2a11 | 36 | * |
saloutos | 0:083111ae2a11 | 37 | * @code |
saloutos | 0:083111ae2a11 | 38 | * #define NUM_PORTS 7 |
saloutos | 0:083111ae2a11 | 39 | * #if (NUM_PORTS > 4) |
saloutos | 0:083111ae2a11 | 40 | * #error "NUM_PORTS must be less than 4" |
saloutos | 0:083111ae2a11 | 41 | * #endif |
saloutos | 0:083111ae2a11 | 42 | * @endcode |
saloutos | 0:083111ae2a11 | 43 | * |
saloutos | 0:083111ae2a11 | 44 | * Reporting Run-Time Errors: |
saloutos | 0:083111ae2a11 | 45 | * To generate a fatal run-time error, you can use the mbed error() function. |
saloutos | 0:083111ae2a11 | 46 | * |
saloutos | 0:083111ae2a11 | 47 | * @code |
saloutos | 0:083111ae2a11 | 48 | * error("That shouldn't have happened!"); |
saloutos | 0:083111ae2a11 | 49 | * @endcode |
saloutos | 0:083111ae2a11 | 50 | * |
saloutos | 0:083111ae2a11 | 51 | * If the mbed running the program executes this function, it will print the |
saloutos | 0:083111ae2a11 | 52 | * message via the USB serial port, and then die with the blue lights of death! |
saloutos | 0:083111ae2a11 | 53 | * |
saloutos | 0:083111ae2a11 | 54 | * The message can use printf-style formatting, so you can report variables in the |
saloutos | 0:083111ae2a11 | 55 | * message too. For example, you could use this to check a run-time condition: |
saloutos | 0:083111ae2a11 | 56 | * |
saloutos | 0:083111ae2a11 | 57 | * @code |
saloutos | 0:083111ae2a11 | 58 | * if(x >= 5) { |
saloutos | 0:083111ae2a11 | 59 | * error("expected x to be less than 5, but got %d", x); |
saloutos | 0:083111ae2a11 | 60 | * } |
saloutos | 0:083111ae2a11 | 61 | * @endcode |
saloutos | 0:083111ae2a11 | 62 | * |
saloutos | 0:083111ae2a11 | 63 | * |
saloutos | 0:083111ae2a11 | 64 | */ |
saloutos | 0:083111ae2a11 | 65 | |
saloutos | 0:083111ae2a11 | 66 | #ifdef __cplusplus |
saloutos | 0:083111ae2a11 | 67 | extern "C" { |
saloutos | 0:083111ae2a11 | 68 | #endif |
saloutos | 0:083111ae2a11 | 69 | void error(const char* format, ...); |
saloutos | 0:083111ae2a11 | 70 | |
saloutos | 0:083111ae2a11 | 71 | #ifdef __cplusplus |
saloutos | 0:083111ae2a11 | 72 | } |
saloutos | 0:083111ae2a11 | 73 | #endif |
saloutos | 0:083111ae2a11 | 74 | |
saloutos | 0:083111ae2a11 | 75 | #endif |
saloutos | 0:083111ae2a11 | 76 | |
saloutos | 0:083111ae2a11 | 77 | /** @}*/ |