Modified version of the official mbed-src lib. Provides some tiny but rather intrusive addons in the i2c-api.h for the mbed-RtosI2cDriver lib.

Fork of mbed-src by mbed official

Committer:
emilmont
Date:
Mon Feb 18 11:44:18 2013 +0000
Revision:
2:143cac498751
Parent:
1:62685faffa05
Update mbed sources to Rev 59

Who changed what in which revision?

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