BLE_Nano nRF51 Central heart rate
Embed:
(wiki syntax)
Show/hide line numbers
nordic_common.h
Go to the documentation of this file.
00001 /* Copyright (c) 2008 Nordic Semiconductor. All Rights Reserved. 00002 * 00003 * The information contained herein is property of Nordic Semiconductor ASA. 00004 * Terms and conditions of usage are described in detail in NORDIC 00005 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 00006 * 00007 * Licensees are granted free, non-transferable use of the information. NO 00008 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 00009 * the file. 00010 */ 00011 00012 /** @file 00013 * @brief Common defines and macros for firmware developed by Nordic Semiconductor. 00014 */ 00015 00016 #ifndef NORDIC_COMMON_H__ 00017 #define NORDIC_COMMON_H__ 00018 00019 /** The upper 8 bits of a 32 bit value */ 00020 //lint -emacro(572,MSB) // Suppress warning 572 "Excessive shift value" 00021 #define MSB_32(a) (((a) & 0xFF000000) >> 24) 00022 /** The lower 8 bits (of a 32 bit value) */ 00023 #define LSB_32(a) ((a) & 0x000000FF) 00024 00025 /** The upper 8 bits of a 16 bit value */ 00026 //lint -emacro(572,MSB_16) // Suppress warning 572 "Excessive shift value" 00027 #define MSB_16(a) (((a) & 0xFF00) >> 8) 00028 /** The lower 8 bits (of a 16 bit value) */ 00029 #define LSB_16(a) ((a) & 0x00FF) 00030 00031 /** Leaves the minimum of the two 32-bit arguments */ 00032 /*lint -emacro(506, MIN) */ /* Suppress "Constant value Boolean */ 00033 #define MIN(a, b) ((a) < (b) ? (a) : (b)) 00034 /** Leaves the maximum of the two 32-bit arguments */ 00035 /*lint -emacro(506, MAX) */ /* Suppress "Constant value Boolean */ 00036 #define MAX(a, b) ((a) < (b) ? (b) : (a)) 00037 00038 /** Concatenates two parameters. Useful as a second level of indirection, 00039 * when a parameter can be macro itself. */ 00040 #define CONCAT_2(p1, p2) p1##p2 00041 /** Concatenates three parameters. Useful as a second level of indirection, 00042 * when a parameter can be macro itself. */ 00043 #define CONCAT_3(p1, p2, p3) p1##p2##p3 00044 00045 /**@brief Set a bit in the uint32 word. 00046 * 00047 * @param[in] W Word whose bit is being set. 00048 * @param[in] B Bit number in the word to be set. 00049 */ 00050 #define SET_BIT(W,B) ((W) |= (uint32_t)(1U << (B))) 00051 00052 00053 /**@brief Clears a bit in the uint32 word. 00054 * 00055 * @param[in] W Word whose bit is to be cleared. 00056 * @param[in] B Bit number in the word to be cleared. 00057 */ 00058 #define CLR_BIT(W, B) ((W) &= (~((uint32_t)1 << (B)))) 00059 00060 00061 /**@brief Checks if a bit is set. 00062 * 00063 * @param[in] W Word whose bit is to be checked. 00064 * @param[in] B Bit number in the word to be checked. 00065 * 00066 * @retval 1 if bit is set. 00067 * @retval 0 if bit is not set. 00068 */ 00069 #define IS_SET(W,B) (((W) >> (B)) & 1) 00070 00071 #define BIT_0 0x01 /**< The value of bit 0 */ 00072 #define BIT_1 0x02 /**< The value of bit 1 */ 00073 #define BIT_2 0x04 /**< The value of bit 2 */ 00074 #define BIT_3 0x08 /**< The value of bit 3 */ 00075 #define BIT_4 0x10 /**< The value of bit 4 */ 00076 #define BIT_5 0x20 /**< The value of bit 5 */ 00077 #define BIT_6 0x40 /**< The value of bit 6 */ 00078 #define BIT_7 0x80 /**< The value of bit 7 */ 00079 #define BIT_8 0x0100 /**< The value of bit 8 */ 00080 #define BIT_9 0x0200 /**< The value of bit 9 */ 00081 #define BIT_10 0x0400 /**< The value of bit 10 */ 00082 #define BIT_11 0x0800 /**< The value of bit 11 */ 00083 #define BIT_12 0x1000 /**< The value of bit 12 */ 00084 #define BIT_13 0x2000 /**< The value of bit 13 */ 00085 #define BIT_14 0x4000 /**< The value of bit 14 */ 00086 #define BIT_15 0x8000 /**< The value of bit 15 */ 00087 #define BIT_16 0x00010000 /**< The value of bit 16 */ 00088 #define BIT_17 0x00020000 /**< The value of bit 17 */ 00089 #define BIT_18 0x00040000 /**< The value of bit 18 */ 00090 #define BIT_19 0x00080000 /**< The value of bit 19 */ 00091 #define BIT_20 0x00100000 /**< The value of bit 20 */ 00092 #define BIT_21 0x00200000 /**< The value of bit 21 */ 00093 #define BIT_22 0x00400000 /**< The value of bit 22 */ 00094 #define BIT_23 0x00800000 /**< The value of bit 23 */ 00095 #define BIT_24 0x01000000 /**< The value of bit 24 */ 00096 #define BIT_25 0x02000000 /**< The value of bit 25 */ 00097 #define BIT_26 0x04000000 /**< The value of bit 26 */ 00098 #define BIT_27 0x08000000 /**< The value of bit 27 */ 00099 #define BIT_28 0x10000000 /**< The value of bit 28 */ 00100 #define BIT_29 0x20000000 /**< The value of bit 29 */ 00101 #define BIT_30 0x40000000 /**< The value of bit 30 */ 00102 #define BIT_31 0x80000000 /**< The value of bit 31 */ 00103 00104 #define UNUSED_VARIABLE(X) ((void)(X)) 00105 #define UNUSED_PARAMETER(X) UNUSED_VARIABLE(X) 00106 #define UNUSED_RETURN_VALUE(X) UNUSED_VARIABLE(X) 00107 00108 #endif // NORDIC_COMMON_H__ 00109
Generated on Wed Jul 13 2022 07:07:19 by 1.7.2