|
1 |
| -/** |
2 |
| - * Copyright (c) 2015 - 2020, Nordic Semiconductor ASA |
3 |
| - * |
| 1 | +/* |
| 2 | + * Copyright (c) 2015 - 2021, Nordic Semiconductor ASA |
4 | 3 | * All rights reserved.
|
5 | 4 | *
|
6 |
| - * Redistribution and use in source and binary forms, with or without modification, |
7 |
| - * are permitted provided that the following conditions are met: |
| 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: |
8 | 9 | *
|
9 | 10 | * 1. Redistributions of source code must retain the above copyright notice, this
|
10 | 11 | * list of conditions and the following disclaimer.
|
11 | 12 | *
|
12 |
| - * 2. Redistributions in binary form, except as embedded into a Nordic |
13 |
| - * Semiconductor ASA integrated circuit in a product or a software update for |
14 |
| - * such product, must reproduce the above copyright notice, this list of |
15 |
| - * conditions and the following disclaimer in the documentation and/or other |
16 |
| - * materials provided with the distribution. |
| 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. |
17 | 16 | *
|
18 |
| - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its |
| 17 | + * 3. Neither the name of the copyright holder nor the names of its |
19 | 18 | * contributors may be used to endorse or promote products derived from this
|
20 | 19 | * software without specific prior written permission.
|
21 | 20 | *
|
22 |
| - * 4. This software, with or without modification, must only be used with a |
23 |
| - * Nordic Semiconductor ASA integrated circuit. |
24 |
| - * |
25 |
| - * 5. Any software provided in binary form under this license must not be reverse |
26 |
| - * engineered, decompiled, modified and/or disassembled. |
27 |
| - * |
28 |
| - * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS |
29 |
| - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
30 |
| - * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE |
31 |
| - * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE |
| 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 |
32 | 25 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
33 |
| - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
34 |
| - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
35 |
| - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
36 |
| - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
37 |
| - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
38 |
| - * |
| 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. |
39 | 32 | */
|
40 | 33 |
|
41 | 34 | #ifndef NRFX_TWIS_H__
|
@@ -154,16 +147,26 @@ typedef struct
|
154 | 147 | uint8_t interrupt_priority; //!< The priority of interrupt for the module to be set.
|
155 | 148 | } nrfx_twis_config_t;
|
156 | 149 |
|
157 |
| -/** @brief Generate the default configuration for the TWIS driver instance. */ |
158 |
| -#define NRFX_TWIS_DEFAULT_CONFIG \ |
159 |
| -{ \ |
160 |
| - .addr = { NRFX_TWIS_DEFAULT_CONFIG_ADDR0, \ |
161 |
| - NRFX_TWIS_DEFAULT_CONFIG_ADDR1 }, \ |
162 |
| - .scl = 31, \ |
163 |
| - .sda = 31, \ |
164 |
| - .scl_pull = (nrf_gpio_pin_pull_t)NRFX_TWIS_DEFAULT_CONFIG_SCL_PULL, \ |
165 |
| - .sda_pull = (nrf_gpio_pin_pull_t)NRFX_TWIS_DEFAULT_CONFIG_SDA_PULL, \ |
166 |
| - .interrupt_priority = NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY \ |
| 150 | +/** |
| 151 | + * @brief TWIS driver default configuration. |
| 152 | + * |
| 153 | + * This configuration sets up TWIS with the following options: |
| 154 | + * - second slave address disabled |
| 155 | + * - SCL pull-up disabled |
| 156 | + * - SDA pull-up disabled |
| 157 | + * |
| 158 | + * @param[in] _pin_scl SCL pin. |
| 159 | + * @param[in] _pin_sda SDA pin. |
| 160 | + * @param[in] _addr Slave address on TWI bus. |
| 161 | + */ |
| 162 | +#define NRFX_TWIS_DEFAULT_CONFIG(_pin_scl, _pin_sda, _addr) \ |
| 163 | +{ \ |
| 164 | + .addr = { _addr, 0x00 }, \ |
| 165 | + .scl = _pin_scl, \ |
| 166 | + .sda = _pin_sda, \ |
| 167 | + .scl_pull = NRF_GPIO_PIN_NOPULL, \ |
| 168 | + .sda_pull = NRF_GPIO_PIN_NOPULL, \ |
| 169 | + .interrupt_priority = NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY \ |
167 | 170 | }
|
168 | 171 |
|
169 | 172 | /**
|
@@ -276,7 +279,7 @@ nrfx_err_t nrfx_twis_tx_prepare(nrfx_twis_t const * p_instance,
|
276 | 279 | *
|
277 | 280 | * @return Number of bytes sent.
|
278 | 281 | */
|
279 |
| -__STATIC_INLINE size_t nrfx_twis_tx_amount(nrfx_twis_t const * p_instance); |
| 282 | +NRFX_STATIC_INLINE size_t nrfx_twis_tx_amount(nrfx_twis_t const * p_instance); |
280 | 283 |
|
281 | 284 | /**
|
282 | 285 | * @brief Function for preparing the data for receiving.
|
@@ -310,7 +313,7 @@ nrfx_err_t nrfx_twis_rx_prepare(nrfx_twis_t const * p_instance,
|
310 | 313 | *
|
311 | 314 | * @return Number of bytes received.
|
312 | 315 | */
|
313 |
| -__STATIC_INLINE size_t nrfx_twis_rx_amount(nrfx_twis_t const * p_instance); |
| 316 | +NRFX_STATIC_INLINE size_t nrfx_twis_rx_amount(nrfx_twis_t const * p_instance); |
314 | 317 |
|
315 | 318 | /**
|
316 | 319 | * @brief Function for checking if the driver is busy right now.
|
@@ -375,17 +378,17 @@ bool nrfx_twis_is_pending_tx(nrfx_twis_t const * p_instance);
|
375 | 378 | */
|
376 | 379 | bool nrfx_twis_is_pending_rx(nrfx_twis_t const * p_instance);
|
377 | 380 |
|
378 |
| -#ifndef SUPPRESS_INLINE_IMPLEMENTATION |
379 |
| -__STATIC_INLINE size_t nrfx_twis_tx_amount(nrfx_twis_t const * p_instance) |
| 381 | +#ifndef NRFX_DECLARE_ONLY |
| 382 | +NRFX_STATIC_INLINE size_t nrfx_twis_tx_amount(nrfx_twis_t const * p_instance) |
380 | 383 | {
|
381 | 384 | return nrf_twis_tx_amount_get(p_instance->p_reg);
|
382 | 385 | }
|
383 | 386 |
|
384 |
| -__STATIC_INLINE size_t nrfx_twis_rx_amount(nrfx_twis_t const * p_instance) |
| 387 | +NRFX_STATIC_INLINE size_t nrfx_twis_rx_amount(nrfx_twis_t const * p_instance) |
385 | 388 | {
|
386 | 389 | return nrf_twis_rx_amount_get(p_instance->p_reg);
|
387 | 390 | }
|
388 |
| -#endif // SUPPRESS_INLINE_IMPLEMENTATION |
| 391 | +#endif // NRFX_DECLARE_ONLY |
389 | 392 |
|
390 | 393 | /** @} */
|
391 | 394 |
|
|
0 commit comments