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