modified locally to use with HRM1017
Fork of nRF51822 by
nordic/nrf-sdk/nordic_common.h@0:eff01767de02, 2014-03-26 (annotated)
- Committer:
- bogdanm
- Date:
- Wed Mar 26 14:38:17 2014 +0000
- Revision:
- 0:eff01767de02
- Child:
- 37:c29c330d942c
Initial import of the nRF51822 code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 0:eff01767de02 | 1 | /* Copyright (c) 2008 Nordic Semiconductor. All Rights Reserved. |
bogdanm | 0:eff01767de02 | 2 | * |
bogdanm | 0:eff01767de02 | 3 | * The information contained herein is property of Nordic Semiconductor ASA. |
bogdanm | 0:eff01767de02 | 4 | * Terms and conditions of usage are described in detail in NORDIC |
bogdanm | 0:eff01767de02 | 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. |
bogdanm | 0:eff01767de02 | 6 | * |
bogdanm | 0:eff01767de02 | 7 | * Licensees are granted free, non-transferable use of the information. NO |
bogdanm | 0:eff01767de02 | 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from |
bogdanm | 0:eff01767de02 | 9 | * the file. |
bogdanm | 0:eff01767de02 | 10 | */ |
bogdanm | 0:eff01767de02 | 11 | |
bogdanm | 0:eff01767de02 | 12 | /** @file |
bogdanm | 0:eff01767de02 | 13 | * @brief Common defines and macros for firmware developed by Nordic Semiconductor. |
bogdanm | 0:eff01767de02 | 14 | */ |
bogdanm | 0:eff01767de02 | 15 | |
bogdanm | 0:eff01767de02 | 16 | #ifndef NORDIC_COMMON_H__ |
bogdanm | 0:eff01767de02 | 17 | #define NORDIC_COMMON_H__ |
bogdanm | 0:eff01767de02 | 18 | |
bogdanm | 0:eff01767de02 | 19 | #include "nordic_global.h" |
bogdanm | 0:eff01767de02 | 20 | |
bogdanm | 0:eff01767de02 | 21 | /** Swaps the upper byte with the lower byte in a 16 bit variable */ |
bogdanm | 0:eff01767de02 | 22 | //lint -emacro((572),SWAP) // Suppress warning 572 "Excessive shift value" |
bogdanm | 0:eff01767de02 | 23 | #define SWAP(x) ((((x)&0xFF)<<8)|(((x)>>8)&0xFF)) |
bogdanm | 0:eff01767de02 | 24 | |
bogdanm | 0:eff01767de02 | 25 | /** The upper 8 bits of a 16 bit value */ |
bogdanm | 0:eff01767de02 | 26 | #define MSB(a) (((a) & 0xFF00) >> 8) |
bogdanm | 0:eff01767de02 | 27 | /** The lower 8 bits (of a 16 bit value) */ |
bogdanm | 0:eff01767de02 | 28 | #define LSB(a) ((a) & 0xFF) |
bogdanm | 0:eff01767de02 | 29 | |
bogdanm | 0:eff01767de02 | 30 | /** Leaves the minimum of the two arguments */ |
bogdanm | 0:eff01767de02 | 31 | /*lint -emacro(506, MIN) */ /* Suppress "Constant value Boolean */ |
bogdanm | 0:eff01767de02 | 32 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) |
bogdanm | 0:eff01767de02 | 33 | /** Leaves the maximum of the two arguments */ |
bogdanm | 0:eff01767de02 | 34 | /*lint -emacro(506, MAX) */ /* Suppress "Constant value Boolean */ |
bogdanm | 0:eff01767de02 | 35 | #define MAX(a, b) ((a) < (b) ? (b) : (a)) |
bogdanm | 0:eff01767de02 | 36 | |
bogdanm | 0:eff01767de02 | 37 | #define BIT_0 0x01 /**< The value of bit 0 */ |
bogdanm | 0:eff01767de02 | 38 | #define BIT_1 0x02 /**< The value of bit 1 */ |
bogdanm | 0:eff01767de02 | 39 | #define BIT_2 0x04 /**< The value of bit 2 */ |
bogdanm | 0:eff01767de02 | 40 | #define BIT_3 0x08 /**< The value of bit 3 */ |
bogdanm | 0:eff01767de02 | 41 | #define BIT_4 0x10 /**< The value of bit 4 */ |
bogdanm | 0:eff01767de02 | 42 | #define BIT_5 0x20 /**< The value of bit 5 */ |
bogdanm | 0:eff01767de02 | 43 | #define BIT_6 0x40 /**< The value of bit 6 */ |
bogdanm | 0:eff01767de02 | 44 | #define BIT_7 0x80 /**< The value of bit 7 */ |
bogdanm | 0:eff01767de02 | 45 | #define BIT_8 0x0100 /**< The value of bit 8 */ |
bogdanm | 0:eff01767de02 | 46 | #define BIT_9 0x0200 /**< The value of bit 9 */ |
bogdanm | 0:eff01767de02 | 47 | #define BIT_10 0x0400 /**< The value of bit 10 */ |
bogdanm | 0:eff01767de02 | 48 | #define BIT_11 0x0800 /**< The value of bit 11 */ |
bogdanm | 0:eff01767de02 | 49 | #define BIT_12 0x1000 /**< The value of bit 12 */ |
bogdanm | 0:eff01767de02 | 50 | #define BIT_13 0x2000 /**< The value of bit 13 */ |
bogdanm | 0:eff01767de02 | 51 | #define BIT_14 0x4000 /**< The value of bit 14 */ |
bogdanm | 0:eff01767de02 | 52 | #define BIT_15 0x8000 /**< The value of bit 15 */ |
bogdanm | 0:eff01767de02 | 53 | #define BIT_16 0x00010000 /**< The value of bit 16 */ |
bogdanm | 0:eff01767de02 | 54 | #define BIT_17 0x00020000 /**< The value of bit 17 */ |
bogdanm | 0:eff01767de02 | 55 | #define BIT_18 0x00040000 /**< The value of bit 18 */ |
bogdanm | 0:eff01767de02 | 56 | #define BIT_19 0x00080000 /**< The value of bit 19 */ |
bogdanm | 0:eff01767de02 | 57 | #define BIT_20 0x00100000 /**< The value of bit 20 */ |
bogdanm | 0:eff01767de02 | 58 | #define BIT_21 0x00200000 /**< The value of bit 21 */ |
bogdanm | 0:eff01767de02 | 59 | #define BIT_22 0x00400000 /**< The value of bit 22 */ |
bogdanm | 0:eff01767de02 | 60 | #define BIT_23 0x00800000 /**< The value of bit 23 */ |
bogdanm | 0:eff01767de02 | 61 | #define BIT_24 0x01000000 /**< The value of bit 24 */ |
bogdanm | 0:eff01767de02 | 62 | #define BIT_25 0x02000000 /**< The value of bit 25 */ |
bogdanm | 0:eff01767de02 | 63 | #define BIT_26 0x04000000 /**< The value of bit 26 */ |
bogdanm | 0:eff01767de02 | 64 | #define BIT_27 0x08000000 /**< The value of bit 27 */ |
bogdanm | 0:eff01767de02 | 65 | #define BIT_28 0x10000000 /**< The value of bit 28 */ |
bogdanm | 0:eff01767de02 | 66 | #define BIT_29 0x20000000 /**< The value of bit 29 */ |
bogdanm | 0:eff01767de02 | 67 | #define BIT_30 0x40000000 /**< The value of bit 30 */ |
bogdanm | 0:eff01767de02 | 68 | #define BIT_31 0x80000000 /**< The value of bit 31 */ |
bogdanm | 0:eff01767de02 | 69 | |
bogdanm | 0:eff01767de02 | 70 | #define UNUSED_VARIABLE(X) ((void)(X)) |
bogdanm | 0:eff01767de02 | 71 | #define UNUSED_PARAMETER(X) UNUSED_VARIABLE(X) |
bogdanm | 0:eff01767de02 | 72 | |
bogdanm | 0:eff01767de02 | 73 | #endif // NORDIC_COMMON_H__ |