customized mbed library sources for nrf51822

Dependents:   Grove_Node Potentiometer BLE_Beacon I2C_Scanner

Committer:
yihui
Date:
Tue Nov 04 07:38:53 2014 +0000
Revision:
0:700cadd8b708
customized mbed-src library for nrf51822

Who changed what in which revision?

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