|
| 1 | +/** |
| 2 | + * Copyright (c) 2015 - 2017, Nordic Semiconductor ASA |
| 3 | + * |
| 4 | + * All rights reserved. |
| 5 | + * |
| 6 | + * Redistribution and use in source and binary forms, with or without modification, |
| 7 | + * are permitted provided that the following conditions are met: |
| 8 | + * |
| 9 | + * 1. Redistributions of source code must retain the above copyright notice, this |
| 10 | + * list of conditions and the following disclaimer. |
| 11 | + * |
| 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. |
| 17 | + * |
| 18 | + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its |
| 19 | + * contributors may be used to endorse or promote products derived from this |
| 20 | + * software without specific prior written permission. |
| 21 | + * |
| 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 |
| 32 | + * 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 | + * |
| 39 | + */ |
| 40 | +#ifndef ANT_CHANNEL_CONFIG_H__ |
| 41 | +#define ANT_CHANNEL_CONFIG_H__ |
| 42 | + |
| 43 | +/** @file |
| 44 | + * |
| 45 | + * @defgroup ant_channel_config ANT channel configuration |
| 46 | + * @{ |
| 47 | + * @ingroup ant_sdk_utils |
| 48 | + * @brief ANT channel configuration module. |
| 49 | + */ |
| 50 | + |
| 51 | +#include <stdint.h> |
| 52 | +#include "sdk_config.h" |
| 53 | + |
| 54 | + |
| 55 | +#ifndef ANT_CONFIG_ENCRYPTED_CHANNELS |
| 56 | + #error Undefined ANT_CONFIG_ENCRYPTED_CHANNELS. It should be defined in sdk_config.h file. |
| 57 | +#elif ANT_CONFIG_ENCRYPTED_CHANNELS > 0 |
| 58 | + #include "ant_encrypt_config.h" |
| 59 | +#endif |
| 60 | + |
| 61 | +#ifdef __cplusplus |
| 62 | +extern "C" { |
| 63 | +#endif |
| 64 | + |
| 65 | +/**@brief ANT channel configuration structure. */ |
| 66 | +typedef struct |
| 67 | +{ |
| 68 | + uint8_t channel_number; ///< Assigned channel number. |
| 69 | + uint8_t channel_type; ///< Channel type (see Assign Channel Parameters in ant_parameters.h: @ref ant_parameters). |
| 70 | + uint8_t ext_assign; ///< Extended assign (see Ext. Assign Channel Parameters in ant_parameters.h: @ref ant_parameters). |
| 71 | + uint8_t rf_freq; ///< Radio frequency offset from 2400 MHz (for example, 2466 MHz, rf_freq = 66). |
| 72 | + uint8_t transmission_type; ///< Transmission type. |
| 73 | + uint8_t device_type; ///< Device type. |
| 74 | + uint16_t device_number; ///< Device number. |
| 75 | + uint16_t channel_period; ///< The period in 32 kHz counts. |
| 76 | + uint8_t network_number; ///< Network number denoting the network key. |
| 77 | + |
| 78 | +#if ANT_CONFIG_ENCRYPTED_CHANNELS > 0 |
| 79 | + ant_encrypt_channel_settings_t * p_crypto_settings; ///< Pointer to cryptographic settings, NULL if this configuration have to be omitted. |
| 80 | +#endif |
| 81 | + |
| 82 | +} ant_channel_config_t; |
| 83 | + |
| 84 | +/**@brief Function for configuring the ANT channel. |
| 85 | + * |
| 86 | + * @param[in] p_config Pointer to the channel configuration structure. |
| 87 | + * |
| 88 | + * @retval NRF_SUCCESS If the channel was successfully configured. Otherwise, an error code is returned. |
| 89 | + */ |
| 90 | +uint32_t ant_channel_init(ant_channel_config_t const * p_config); |
| 91 | + |
| 92 | + |
| 93 | +#ifdef __cplusplus |
| 94 | +} |
| 95 | +#endif |
| 96 | + |
| 97 | +#endif // ANT_CHANNEL_CONFIG_H__ |
| 98 | +/** @} */ |
0 commit comments