fork
Fork of nRF51822 by
Embed:
(wiki syntax)
Show/hide line numbers
nordic_common.h
Go to the documentation of this file.
00001 /* 00002 * Copyright (c) Nordic Semiconductor ASA 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without modification, 00006 * are permitted provided that the following conditions are met: 00007 * 00008 * 1. Redistributions of source code must retain the above copyright notice, this 00009 * list of conditions and the following disclaimer. 00010 * 00011 * 2. Redistributions in binary form must reproduce the above copyright notice, this 00012 * list of conditions and the following disclaimer in the documentation and/or 00013 * other materials provided with the distribution. 00014 * 00015 * 3. Neither the name of Nordic Semiconductor ASA nor the names of other 00016 * contributors to this software may be used to endorse or promote products 00017 * derived from this software without specific prior written permission. 00018 * 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00021 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00022 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00023 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 00024 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00025 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00026 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00027 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00028 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00029 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 * 00031 */ 00032 00033 /** @file 00034 * @brief Common defines and macros for firmware developed by Nordic Semiconductor. 00035 */ 00036 00037 #ifndef NORDIC_COMMON_H__ 00038 #define NORDIC_COMMON_H__ 00039 00040 /** Swaps the upper byte with the lower byte in a 16 bit variable */ 00041 //lint -emacro((572),SWAP) // Suppress warning 572 "Excessive shift value" 00042 #define SWAP(x) ((((x)&0xFF)<<8)|(((x)>>8)&0xFF)) 00043 00044 /** The upper 8 bits of a 16 bit value */ 00045 //lint -emacro(572,MSB) // Suppress warning 572 "Excessive shift value" 00046 #define MSB(a) (((a) & 0xFF00) >> 8) 00047 /** The lower 8 bits (of a 16 bit value) */ 00048 #define LSB(a) ((a) & 0xFF) 00049 00050 /** Leaves the minimum of the two arguments */ 00051 /*lint -emacro(506, MIN) */ /* Suppress "Constant value Boolean */ 00052 #define MIN(a, b) ((a) < (b) ? (a) : (b)) 00053 /** Leaves the maximum of the two arguments */ 00054 /*lint -emacro(506, MAX) */ /* Suppress "Constant value Boolean */ 00055 #define MAX(a, b) ((a) < (b) ? (b) : (a)) 00056 00057 #define BIT_0 0x01 /**< The value of bit 0 */ 00058 #define BIT_1 0x02 /**< The value of bit 1 */ 00059 #define BIT_2 0x04 /**< The value of bit 2 */ 00060 #define BIT_3 0x08 /**< The value of bit 3 */ 00061 #define BIT_4 0x10 /**< The value of bit 4 */ 00062 #define BIT_5 0x20 /**< The value of bit 5 */ 00063 #define BIT_6 0x40 /**< The value of bit 6 */ 00064 #define BIT_7 0x80 /**< The value of bit 7 */ 00065 #define BIT_8 0x0100 /**< The value of bit 8 */ 00066 #define BIT_9 0x0200 /**< The value of bit 9 */ 00067 #define BIT_10 0x0400 /**< The value of bit 10 */ 00068 #define BIT_11 0x0800 /**< The value of bit 11 */ 00069 #define BIT_12 0x1000 /**< The value of bit 12 */ 00070 #define BIT_13 0x2000 /**< The value of bit 13 */ 00071 #define BIT_14 0x4000 /**< The value of bit 14 */ 00072 #define BIT_15 0x8000 /**< The value of bit 15 */ 00073 #define BIT_16 0x00010000 /**< The value of bit 16 */ 00074 #define BIT_17 0x00020000 /**< The value of bit 17 */ 00075 #define BIT_18 0x00040000 /**< The value of bit 18 */ 00076 #define BIT_19 0x00080000 /**< The value of bit 19 */ 00077 #define BIT_20 0x00100000 /**< The value of bit 20 */ 00078 #define BIT_21 0x00200000 /**< The value of bit 21 */ 00079 #define BIT_22 0x00400000 /**< The value of bit 22 */ 00080 #define BIT_23 0x00800000 /**< The value of bit 23 */ 00081 #define BIT_24 0x01000000 /**< The value of bit 24 */ 00082 #define BIT_25 0x02000000 /**< The value of bit 25 */ 00083 #define BIT_26 0x04000000 /**< The value of bit 26 */ 00084 #define BIT_27 0x08000000 /**< The value of bit 27 */ 00085 #define BIT_28 0x10000000 /**< The value of bit 28 */ 00086 #define BIT_29 0x20000000 /**< The value of bit 29 */ 00087 #define BIT_30 0x40000000 /**< The value of bit 30 */ 00088 #define BIT_31 0x80000000 /**< The value of bit 31 */ 00089 00090 #define UNUSED_VARIABLE(X) ((void)(X)) 00091 #define UNUSED_PARAMETER(X) UNUSED_VARIABLE(X) 00092 00093 #endif // NORDIC_COMMON_H__
Generated on Tue Jul 12 2022 18:08:54 by 1.7.2