1 /* 2 * Copyright (c) 2022 - 2023, Nordic Semiconductor ASA 3 * All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are met: 9 * 10 * 1. Redistributions of source code must retain the above copyright notice, this 11 * list of conditions and the following disclaimer. 12 * 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * 3. Neither the name of the copyright holder nor the names of its 18 * contributors may be used to endorse or promote products derived from this 19 * software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 * POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 #ifndef NRFX_EXAMPLE_H__ 35 #define NRFX_EXAMPLE_H__ 36 37 #if defined(__ZEPHYR__) 38 #include <zephyr/logging/log_ctrl.h> 39 #define NRFX_EXAMPLE_LOG_INIT() LOG_INIT() 40 #define NRFX_EXAMPLE_LOG_PROCESS() while (LOG_PROCESS()) 41 #else 42 #define NRFX_EXAMPLE_LOG_INIT() 43 #define NRFX_EXAMPLE_LOG_PROCESS() 44 #endif 45 46 #if defined(NRF52_SERIES) 47 #define LOOPBACK_PIN_1A 3 48 #define LOOPBACK_PIN_1B 31 49 #define LOOPBACK_PIN_2A 4 50 #define LOOPBACK_PIN_2B 30 51 #define LOOPBACK_PIN_3A 28 52 #define LOOPBACK_PIN_3B 29 53 #define LOOPBACK_PIN_4A 26 54 #define LOOPBACK_PIN_4B 27 55 #define ANALOG_INPUT_A0 1 56 #define ANALOG_INPUT_A1 2 57 #define ANALOG_INPUT_A2 4 58 #if defined(NRF52832_XXAA) || defined (NRF52832_XXAB) 59 #define LED1_PIN 17 60 #define LED2_PIN 18 61 #define LED3_PIN 19 62 #define LED4_PIN 20 63 #else 64 #define LED1_PIN 13 65 #define LED2_PIN 14 66 #define LED3_PIN 15 67 #define LED4_PIN 16 68 #endif 69 #elif defined(NRF53_SERIES) 70 #define LOOPBACK_PIN_1A 4 71 #define LOOPBACK_PIN_1B 26 72 #define LOOPBACK_PIN_2A 5 73 #define LOOPBACK_PIN_2B 25 74 #define LOOPBACK_PIN_3A 6 75 #define LOOPBACK_PIN_3B 7 76 #define LOOPBACK_PIN_4A 34 77 #define LOOPBACK_PIN_4B 35 78 #define ANALOG_INPUT_A0 0 79 #define ANALOG_INPUT_A1 1 80 #define ANALOG_INPUT_A2 2 81 #define LED1_PIN 28 82 #define LED2_PIN 29 83 #define LED3_PIN 30 84 #define LED4_PIN 31 85 #elif defined(NRF91_SERIES) 86 #define LOOPBACK_PIN_1A 14 87 #define LOOPBACK_PIN_1B 19 88 #define LOOPBACK_PIN_2A 15 89 #define LOOPBACK_PIN_2B 18 90 #define LOOPBACK_PIN_3A 16 91 #define LOOPBACK_PIN_3B 17 92 #define LOOPBACK_PIN_4A 30 93 #define LOOPBACK_PIN_4B 31 94 #define ANALOG_INPUT_A0 1 95 #define ANALOG_INPUT_A1 2 96 #define ANALOG_INPUT_A2 3 97 #define LED1_PIN 2 98 #define LED2_PIN 3 99 #define LED3_PIN 4 100 #define LED4_PIN 5 101 #else 102 #error "Unknown device." 103 #endif 104 105 #define ANALOG_INPUT_TO_SAADC_AIN(x) ((x) + 1) 106 107 #define ANALOG_INPUT_TO_COMP_AIN(x) (x) 108 109 #endif // NRFX_EXAMPLE_H__ 110