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