Nordic nrf51 sdk sources. Mirrored from https://github.com/ARMmbed/nrf51-sdk.
source/nordic_sdk/components/libraries/util/common.h@29:286940b7ee5a, 2016-04-07 (annotated)
- Committer:
- vcoubard
- Date:
- Thu Apr 07 17:38:01 2016 +0100
- Revision:
- 29:286940b7ee5a
- Parent:
- 28:041dac1366b2
Synchronized with git rev 22c7454f
Author: Liyou Zhou
Add copyright license headers.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vcoubard | 29:286940b7ee5a | 1 | /* |
vcoubard | 29:286940b7ee5a | 2 | * Copyright (c) Nordic Semiconductor ASA |
vcoubard | 29:286940b7ee5a | 3 | * All rights reserved. |
vcoubard | 29:286940b7ee5a | 4 | * |
vcoubard | 29:286940b7ee5a | 5 | * Redistribution and use in source and binary forms, with or without modification, |
vcoubard | 29:286940b7ee5a | 6 | * are permitted provided that the following conditions are met: |
vcoubard | 29:286940b7ee5a | 7 | * |
vcoubard | 29:286940b7ee5a | 8 | * 1. Redistributions of source code must retain the above copyright notice, this |
vcoubard | 29:286940b7ee5a | 9 | * list of conditions and the following disclaimer. |
vcoubard | 29:286940b7ee5a | 10 | * |
vcoubard | 29:286940b7ee5a | 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this |
vcoubard | 29:286940b7ee5a | 12 | * list of conditions and the following disclaimer in the documentation and/or |
vcoubard | 29:286940b7ee5a | 13 | * other materials provided with the distribution. |
vcoubard | 29:286940b7ee5a | 14 | * |
vcoubard | 29:286940b7ee5a | 15 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of other |
vcoubard | 29:286940b7ee5a | 16 | * contributors to this software may be used to endorse or promote products |
vcoubard | 29:286940b7ee5a | 17 | * derived from this software without specific prior written permission. |
vcoubard | 29:286940b7ee5a | 18 | * |
vcoubard | 29:286940b7ee5a | 19 | * |
vcoubard | 29:286940b7ee5a | 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
vcoubard | 29:286940b7ee5a | 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
vcoubard | 29:286940b7ee5a | 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
vcoubard | 29:286940b7ee5a | 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
vcoubard | 29:286940b7ee5a | 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
vcoubard | 29:286940b7ee5a | 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
vcoubard | 29:286940b7ee5a | 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
vcoubard | 29:286940b7ee5a | 27 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
vcoubard | 29:286940b7ee5a | 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
vcoubard | 29:286940b7ee5a | 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
vcoubard | 29:286940b7ee5a | 30 | * |
Vincent Coubard |
0:f2542974c862 | 31 | */ |
Vincent Coubard |
0:f2542974c862 | 32 | |
Vincent Coubard |
0:f2542974c862 | 33 | #ifndef COMMON_H |
Vincent Coubard |
0:f2542974c862 | 34 | #define COMMON_H |
Vincent Coubard |
0:f2542974c862 | 35 | |
Vincent Coubard |
0:f2542974c862 | 36 | /*lint ++flb "Enter library region" */ |
Vincent Coubard |
0:f2542974c862 | 37 | |
Vincent Coubard |
0:f2542974c862 | 38 | #include <stdbool.h> |
Vincent Coubard |
0:f2542974c862 | 39 | #include <stdint.h> |
Vincent Coubard |
0:f2542974c862 | 40 | |
Vincent Coubard |
0:f2542974c862 | 41 | /* @file |
Vincent Coubard |
0:f2542974c862 | 42 | * @brief Common header file for generic macros and definitions |
Vincent Coubard |
0:f2542974c862 | 43 | * |
Vincent Coubard |
0:f2542974c862 | 44 | */ |
Vincent Coubard |
0:f2542974c862 | 45 | |
Vincent Coubard |
0:f2542974c862 | 46 | /* |
Vincent Coubard |
0:f2542974c862 | 47 | * GPIO glue macros, this can be used to define a pin number in source/header file and use that macro for pin |
Vincent Coubard |
0:f2542974c862 | 48 | * configuration using this expansion. |
Vincent Coubard |
0:f2542974c862 | 49 | * example: |
Vincent Coubard |
0:f2542974c862 | 50 | * #define RESET_PIN 8 |
Vincent Coubard |
0:f2542974c862 | 51 | * NRF_GPIO->PINCNF(RESET_PIN) = XXX ; // Expanded NRF_GPIO->PIN_CNF[8] = XXX |
Vincent Coubard |
0:f2542974c862 | 52 | */ |
Vincent Coubard |
0:f2542974c862 | 53 | #define PINX_GLUE(x, y, z) x##y##_##z /*!< first level glue for pin macros */ |
Vincent Coubard |
0:f2542974c862 | 54 | #define PINCNF(p) PINX_GLUE(PIN,p,CNF) /*!< gpio configure pin number 'p' */ |
Vincent Coubard |
0:f2542974c862 | 55 | #define PINOUT(p) PINX_GLUE(PIN,p,OUT) /*!< gpio out pin number 'p' */ |
Vincent Coubard |
0:f2542974c862 | 56 | |
Vincent Coubard |
0:f2542974c862 | 57 | /*lint --flb "Leave library region" */ |
vcoubard | 1:ebc0e0ef0a11 | 58 | #endif |