The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
Anna Bridge
Date:
Fri Jun 22 15:38:59 2018 +0100
Revision:
169:a7c7b631e539
Parent:
161:aa5281ff4a02
Child:
172:65be27845400
mbed library. Release version 162

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 130:d75b3fe1f5cb 1 /** \addtogroup platform */
<> 130:d75b3fe1f5cb 2 /** @{*/
AnnaBridge 158:1c57384330a6 3 /**
AnnaBridge 158:1c57384330a6 4 * \defgroup platform_preprocessor preprocessor macros
AnnaBridge 158:1c57384330a6 5 * @{
AnnaBridge 158:1c57384330a6 6 */
AnnaBridge 158:1c57384330a6 7
<> 130:d75b3fe1f5cb 8 /* mbed Microcontroller Library
<> 130:d75b3fe1f5cb 9 * Copyright (c) 2006-2013 ARM Limited
<> 130:d75b3fe1f5cb 10 *
<> 130:d75b3fe1f5cb 11 * Licensed under the Apache License, Version 2.0 (the "License");
<> 130:d75b3fe1f5cb 12 * you may not use this file except in compliance with the License.
<> 130:d75b3fe1f5cb 13 * You may obtain a copy of the License at
<> 130:d75b3fe1f5cb 14 *
<> 130:d75b3fe1f5cb 15 * http://www.apache.org/licenses/LICENSE-2.0
<> 130:d75b3fe1f5cb 16 *
<> 130:d75b3fe1f5cb 17 * Unless required by applicable law or agreed to in writing, software
<> 130:d75b3fe1f5cb 18 * distributed under the License is distributed on an "AS IS" BASIS,
<> 130:d75b3fe1f5cb 19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 130:d75b3fe1f5cb 20 * See the License for the specific language governing permissions and
<> 130:d75b3fe1f5cb 21 * limitations under the License.
<> 130:d75b3fe1f5cb 22 */
<> 130:d75b3fe1f5cb 23 #ifndef MBED_PREPROCESSOR_H
<> 130:d75b3fe1f5cb 24 #define MBED_PREPROCESSOR_H
<> 130:d75b3fe1f5cb 25
<> 130:d75b3fe1f5cb 26
<> 130:d75b3fe1f5cb 27 /** MBED_CONCAT
<> 130:d75b3fe1f5cb 28 * Concatenate tokens together
<> 130:d75b3fe1f5cb 29 *
<> 130:d75b3fe1f5cb 30 * @note
<> 130:d75b3fe1f5cb 31 * Expands tokens before concatenation
<> 130:d75b3fe1f5cb 32 *
<> 130:d75b3fe1f5cb 33 * @code
<> 130:d75b3fe1f5cb 34 * // Creates a unique label based on the line number
<> 130:d75b3fe1f5cb 35 * int MBED_CONCAT(UNIQUE_LABEL_, __LINE__) = 1;
<> 130:d75b3fe1f5cb 36 * @endcode
<> 130:d75b3fe1f5cb 37 */
<> 130:d75b3fe1f5cb 38 #define MBED_CONCAT(a, b) MBED_CONCAT_(a, b)
<> 130:d75b3fe1f5cb 39 #define MBED_CONCAT_(a, b) a##b
<> 130:d75b3fe1f5cb 40
<> 130:d75b3fe1f5cb 41 /** MBED_STRINGIFY
<> 130:d75b3fe1f5cb 42 * Converts tokens into strings
<> 130:d75b3fe1f5cb 43 *
<> 130:d75b3fe1f5cb 44 * @note
<> 130:d75b3fe1f5cb 45 * Expands tokens before stringification
<> 130:d75b3fe1f5cb 46 *
<> 130:d75b3fe1f5cb 47 * @code
<> 130:d75b3fe1f5cb 48 * // Creates a string based on the parameters
<> 130:d75b3fe1f5cb 49 * const char *c = MBED_STRINGIFY(This is a ridiculous way to create a string)
<> 130:d75b3fe1f5cb 50 * @endcode
<> 130:d75b3fe1f5cb 51 */
<> 130:d75b3fe1f5cb 52 #define MBED_STRINGIFY(a) MBED_STRINGIFY_(a)
<> 130:d75b3fe1f5cb 53 #define MBED_STRINGIFY_(a) #a
<> 130:d75b3fe1f5cb 54
AnnaBridge 161:aa5281ff4a02 55 /** MBED_STRLEN
AnnaBridge 161:aa5281ff4a02 56 * Reports string token length
AnnaBridge 161:aa5281ff4a02 57 *
AnnaBridge 161:aa5281ff4a02 58 * @note
AnnaBridge 161:aa5281ff4a02 59 * Expands tokens before calculating length
AnnaBridge 161:aa5281ff4a02 60 *
AnnaBridge 161:aa5281ff4a02 61 * @code
AnnaBridge 161:aa5281ff4a02 62 * // Get string length
AnnaBridge 161:aa5281ff4a02 63 * const int len = MBED_STRLEN("Get the length")
AnnaBridge 161:aa5281ff4a02 64 * @endcode
AnnaBridge 161:aa5281ff4a02 65 */
AnnaBridge 161:aa5281ff4a02 66 #define MBED_STRLEN(a) MBED_STRLEN_(a)
AnnaBridge 161:aa5281ff4a02 67 #define MBED_STRLEN_(a) (sizeof(a) - 1)
AnnaBridge 161:aa5281ff4a02 68
AnnaBridge 161:aa5281ff4a02 69 /** MBED_COUNT_VA_ARGS(...)
AnnaBridge 161:aa5281ff4a02 70 * Reports number of tokens passed
AnnaBridge 161:aa5281ff4a02 71 *
AnnaBridge 161:aa5281ff4a02 72 * @note
AnnaBridge 161:aa5281ff4a02 73 * Token limit is 16
AnnaBridge 161:aa5281ff4a02 74 *
AnnaBridge 161:aa5281ff4a02 75 * @code
AnnaBridge 161:aa5281ff4a02 76 * // Get number of arguments
AnnaBridge 161:aa5281ff4a02 77 * const int count = MBED_COUNT_VA_ARGS("Address 0x%x, Data[0] = %d Data[1] = %d", 0x20001234, 10, 20)
AnnaBridge 161:aa5281ff4a02 78 * @endcode
AnnaBridge 161:aa5281ff4a02 79 */
AnnaBridge 161:aa5281ff4a02 80 #define MBED_COUNT_VA_ARGS(...) GET_NTH_ARG_(__VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
AnnaBridge 161:aa5281ff4a02 81 #define GET_NTH_ARG_(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, N, ...) N
<> 130:d75b3fe1f5cb 82
<> 130:d75b3fe1f5cb 83 #endif
<> 130:d75b3fe1f5cb 84
<> 130:d75b3fe1f5cb 85 /** @}*/
AnnaBridge 158:1c57384330a6 86 /** @}*/