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