The prosthetic control(MIT)

Committer:
ganlikun
Date:
Thu Jun 23 05:23:34 2022 +0000
Revision:
0:20e0c61e0684
01

Who changed what in which revision?

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