NRF52_esb

Committer:
wkleunen
Date:
Thu Feb 04 10:36:44 2021 +0000
Revision:
1:66f95e364222
Initial compile;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wkleunen 1:66f95e364222 1 /**
wkleunen 1:66f95e364222 2 * Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
wkleunen 1:66f95e364222 3 *
wkleunen 1:66f95e364222 4 * All rights reserved.
wkleunen 1:66f95e364222 5 *
wkleunen 1:66f95e364222 6 * Redistribution and use in source and binary forms, with or without modification,
wkleunen 1:66f95e364222 7 * are permitted provided that the following conditions are met:
wkleunen 1:66f95e364222 8 *
wkleunen 1:66f95e364222 9 * 1. Redistributions of source code must retain the above copyright notice, this
wkleunen 1:66f95e364222 10 * list of conditions and the following disclaimer.
wkleunen 1:66f95e364222 11 *
wkleunen 1:66f95e364222 12 * 2. Redistributions in binary form, except as embedded into a Nordic
wkleunen 1:66f95e364222 13 * Semiconductor ASA integrated circuit in a product or a software update for
wkleunen 1:66f95e364222 14 * such product, must reproduce the above copyright notice, this list of
wkleunen 1:66f95e364222 15 * conditions and the following disclaimer in the documentation and/or other
wkleunen 1:66f95e364222 16 * materials provided with the distribution.
wkleunen 1:66f95e364222 17 *
wkleunen 1:66f95e364222 18 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
wkleunen 1:66f95e364222 19 * contributors may be used to endorse or promote products derived from this
wkleunen 1:66f95e364222 20 * software without specific prior written permission.
wkleunen 1:66f95e364222 21 *
wkleunen 1:66f95e364222 22 * 4. This software, with or without modification, must only be used with a
wkleunen 1:66f95e364222 23 * Nordic Semiconductor ASA integrated circuit.
wkleunen 1:66f95e364222 24 *
wkleunen 1:66f95e364222 25 * 5. Any software provided in binary form under this license must not be reverse
wkleunen 1:66f95e364222 26 * engineered, decompiled, modified and/or disassembled.
wkleunen 1:66f95e364222 27 *
wkleunen 1:66f95e364222 28 * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
wkleunen 1:66f95e364222 29 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
wkleunen 1:66f95e364222 30 * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
wkleunen 1:66f95e364222 31 * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
wkleunen 1:66f95e364222 32 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
wkleunen 1:66f95e364222 33 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
wkleunen 1:66f95e364222 34 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
wkleunen 1:66f95e364222 35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
wkleunen 1:66f95e364222 36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
wkleunen 1:66f95e364222 37 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
wkleunen 1:66f95e364222 38 *
wkleunen 1:66f95e364222 39 */
wkleunen 1:66f95e364222 40 #ifndef __NRF_ESB_H
wkleunen 1:66f95e364222 41 #define __NRF_ESB_H
wkleunen 1:66f95e364222 42
wkleunen 1:66f95e364222 43 #include <stdbool.h>
wkleunen 1:66f95e364222 44 #include <stdint.h>
wkleunen 1:66f95e364222 45 #include "nrf.h"
wkleunen 1:66f95e364222 46 #include "app_util.h"
wkleunen 1:66f95e364222 47
wkleunen 1:66f95e364222 48 #ifdef __cplusplus
wkleunen 1:66f95e364222 49 extern "C" {
wkleunen 1:66f95e364222 50 #endif
wkleunen 1:66f95e364222 51
wkleunen 1:66f95e364222 52 /** @defgroup nrf_esb Enhanced ShockBurst
wkleunen 1:66f95e364222 53 * @{
wkleunen 1:66f95e364222 54 * @ingroup proprietary_api
wkleunen 1:66f95e364222 55 *
wkleunen 1:66f95e364222 56 * @brief Enhanced ShockBurst (ESB) is a basic protocol that supports two-way data
wkleunen 1:66f95e364222 57 * packet communication including packet buffering, packet acknowledgment,
wkleunen 1:66f95e364222 58 * and automatic retransmission of lost packets.
wkleunen 1:66f95e364222 59 */
wkleunen 1:66f95e364222 60
wkleunen 1:66f95e364222 61 /** @name Debug pins
wkleunen 1:66f95e364222 62 * @{
wkleunen 1:66f95e364222 63 * @brief If NRF_ESB_DEBUG is defined, these GPIO pins can be used for debug timing.
wkleunen 1:66f95e364222 64 */
wkleunen 1:66f95e364222 65
wkleunen 1:66f95e364222 66 #define DEBUGPIN1 12 //!< If NRF_ESB_DEBUG is defined, this GPIO pin is set with every radio interrupt.
wkleunen 1:66f95e364222 67 #define DEBUGPIN2 13 //!< If NRF_ESB_DEBUG is defined, this GPIO pin is set with every NRF_RADIO->EVENTS_END.
wkleunen 1:66f95e364222 68 #define DEBUGPIN3 14 //!< If NRF_ESB_DEBUG is defined, this GPIO pin is set with every NRF_RADIO->EVENTS_DISABLED.
wkleunen 1:66f95e364222 69 #define DEBUGPIN4 15 //!< If NRF_ESB_DEBUG is defined, this GPIO pin is set when the radio is set to start transmission.
wkleunen 1:66f95e364222 70
wkleunen 1:66f95e364222 71
wkleunen 1:66f95e364222 72 #ifdef NRF_ESB_DEBUG
wkleunen 1:66f95e364222 73 #define DEBUG_PIN_SET(a) (NRF_GPIO->OUTSET = (1 << (a))) //!< Used internally to set debug pins.
wkleunen 1:66f95e364222 74 #define DEBUG_PIN_CLR(a) (NRF_GPIO->OUTCLR = (1 << (a))) //!< Used internally to clear debug pins.
wkleunen 1:66f95e364222 75 #else
wkleunen 1:66f95e364222 76 #define DEBUG_PIN_SET(a) //!< Used internally to set debug pins.
wkleunen 1:66f95e364222 77 #define DEBUG_PIN_CLR(a) //!< Used internally to clear debug pins.
wkleunen 1:66f95e364222 78 #endif
wkleunen 1:66f95e364222 79
wkleunen 1:66f95e364222 80 /** @} */
wkleunen 1:66f95e364222 81
wkleunen 1:66f95e364222 82 #define NRF_ESB_RETRANSMIT_DELAY_MIN 135
wkleunen 1:66f95e364222 83
wkleunen 1:66f95e364222 84 // Hardcoded parameters - change if necessary
wkleunen 1:66f95e364222 85 #ifndef NRF_ESB_MAX_PAYLOAD_LENGTH
wkleunen 1:66f95e364222 86 #define NRF_ESB_MAX_PAYLOAD_LENGTH 32 //!< The maximum size of the payload. Valid values are 1 to 252.
wkleunen 1:66f95e364222 87 #endif
wkleunen 1:66f95e364222 88
wkleunen 1:66f95e364222 89 #define NRF_ESB_TX_FIFO_SIZE 8 //!< The size of the transmission first-in, first-out buffer.
wkleunen 1:66f95e364222 90 #define NRF_ESB_RX_FIFO_SIZE 8 //!< The size of the reception first-in, first-out buffer.
wkleunen 1:66f95e364222 91
wkleunen 1:66f95e364222 92 // 252 is the largest possible payload size according to the nRF5 architecture.
wkleunen 1:66f95e364222 93 STATIC_ASSERT(NRF_ESB_MAX_PAYLOAD_LENGTH <= 252);
wkleunen 1:66f95e364222 94
wkleunen 1:66f95e364222 95 #define NRF_ESB_SYS_TIMER NRF_TIMER2 //!< The timer that is used by the module.
wkleunen 1:66f95e364222 96 #define NRF_ESB_SYS_TIMER_IRQ_Handler TIMER2_IRQHandler //!< The handler that is used by @ref NRF_ESB_SYS_TIMER.
wkleunen 1:66f95e364222 97
wkleunen 1:66f95e364222 98 #define NRF_ESB_PPI_TIMER_START 10 //!< The PPI channel used for starting the timer.
wkleunen 1:66f95e364222 99 #define NRF_ESB_PPI_TIMER_STOP 11 //!< The PPI channel used for stopping the timer.
wkleunen 1:66f95e364222 100 #define NRF_ESB_PPI_RX_TIMEOUT 12 //!< The PPI channel used for RX time-out.
wkleunen 1:66f95e364222 101 #define NRF_ESB_PPI_TX_START 13 //!< The PPI channel used for starting TX.
wkleunen 1:66f95e364222 102
wkleunen 1:66f95e364222 103 /**@cond NO_DOXYGEN */
wkleunen 1:66f95e364222 104
wkleunen 1:66f95e364222 105 // nRF52 address fix timer and PPI defines
wkleunen 1:66f95e364222 106 #ifdef NRF52
wkleunen 1:66f95e364222 107 #define NRF_ESB_PPI_BUGFIX1 9
wkleunen 1:66f95e364222 108 #define NRF_ESB_PPI_BUGFIX2 8
wkleunen 1:66f95e364222 109 #define NRF_ESB_PPI_BUGFIX3 7
wkleunen 1:66f95e364222 110
wkleunen 1:66f95e364222 111 #define NRF_ESB_BUGFIX_TIMER NRF_TIMER3
wkleunen 1:66f95e364222 112 #define NRF_ESB_BUGFIX_TIMER_IRQn TIMER3_IRQn
wkleunen 1:66f95e364222 113 #define NRF_ESB_BUGFIX_TIMER_IRQHandler TIMER3_IRQHandler
wkleunen 1:66f95e364222 114 #endif
wkleunen 1:66f95e364222 115
wkleunen 1:66f95e364222 116 /** @endcond */
wkleunen 1:66f95e364222 117
wkleunen 1:66f95e364222 118 // Interrupt flags
wkleunen 1:66f95e364222 119 #define NRF_ESB_INT_TX_SUCCESS_MSK 0x01 //!< The flag used to indicate a success since the last event.
wkleunen 1:66f95e364222 120 #define NRF_ESB_INT_TX_FAILED_MSK 0x02 //!< The flag used to indicate a failure since the last event.
wkleunen 1:66f95e364222 121 #define NRF_ESB_INT_RX_DR_MSK 0x04 //!< The flag used to indicate that a packet was received since the last event.
wkleunen 1:66f95e364222 122
wkleunen 1:66f95e364222 123 #define NRF_ESB_PID_RESET_VALUE 0xFF //!< Invalid PID value that is guaranteed to not collide with any valid PID value.
wkleunen 1:66f95e364222 124 #define NRF_ESB_PID_MAX 3 //!< The maximum value for PID.
wkleunen 1:66f95e364222 125 #define NRF_ESB_CRC_RESET_VALUE 0xFFFF //!< The CRC reset value.
wkleunen 1:66f95e364222 126
wkleunen 1:66f95e364222 127 #define ESB_EVT_IRQ SWI0_IRQn //!< The ESB event IRQ number when running on an nRF5 device.
wkleunen 1:66f95e364222 128 #define ESB_EVT_IRQHandler SWI0_IRQHandler //!< The handler for @ref ESB_EVT_IRQ when running on an nRF5 device.
wkleunen 1:66f95e364222 129
wkleunen 1:66f95e364222 130 #if defined(NRF52)
wkleunen 1:66f95e364222 131 #define ESB_IRQ_PRIORITY_MSK 0x07 //!< The mask used to enforce a valid IRQ priority.
wkleunen 1:66f95e364222 132 #else
wkleunen 1:66f95e364222 133 #define ESB_IRQ_PRIORITY_MSK 0x03 //!< The mask used to enforce a valid IRQ priority.
wkleunen 1:66f95e364222 134 #endif
wkleunen 1:66f95e364222 135
wkleunen 1:66f95e364222 136 /** @brief Default address configuration for ESB.
wkleunen 1:66f95e364222 137 * @details Roughly equal to the nRF24Lxx default (except for the number of pipes, because more pipes are supported). */
wkleunen 1:66f95e364222 138 #define NRF_ESB_ADDR_DEFAULT \
wkleunen 1:66f95e364222 139 { \
wkleunen 1:66f95e364222 140 .base_addr_p0 = { 0xE7, 0xE7, 0xE7, 0xE7 }, \
wkleunen 1:66f95e364222 141 .base_addr_p1 = { 0xC2, 0xC2, 0xC2, 0xC2 }, \
wkleunen 1:66f95e364222 142 .pipe_prefixes = { 0xE7, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8 }, \
wkleunen 1:66f95e364222 143 .addr_length = 5, \
wkleunen 1:66f95e364222 144 .num_pipes = 8, \
wkleunen 1:66f95e364222 145 .rf_channel = 2, \
wkleunen 1:66f95e364222 146 .rx_pipes_enabled = 0xFF \
wkleunen 1:66f95e364222 147 }
wkleunen 1:66f95e364222 148
wkleunen 1:66f95e364222 149
wkleunen 1:66f95e364222 150 /** @brief Default radio parameters.
wkleunen 1:66f95e364222 151 * @details Roughly equal to the nRF24Lxx default parameters (except for CRC, which is set to 16 bit, and protocol, which is set to DPL). */
wkleunen 1:66f95e364222 152 #define NRF_ESB_DEFAULT_CONFIG {.protocol = NRF_ESB_PROTOCOL_ESB_DPL, \
wkleunen 1:66f95e364222 153 .mode = NRF_ESB_MODE_PTX, \
wkleunen 1:66f95e364222 154 .event_handler = 0, \
wkleunen 1:66f95e364222 155 .bitrate = NRF_ESB_BITRATE_2MBPS, \
wkleunen 1:66f95e364222 156 .crc = NRF_ESB_CRC_16BIT, \
wkleunen 1:66f95e364222 157 .tx_output_power = NRF_ESB_TX_POWER_0DBM, \
wkleunen 1:66f95e364222 158 .retransmit_delay = 250, \
wkleunen 1:66f95e364222 159 .retransmit_count = 3, \
wkleunen 1:66f95e364222 160 .tx_mode = NRF_ESB_TXMODE_AUTO, \
wkleunen 1:66f95e364222 161 .radio_irq_priority = 1, \
wkleunen 1:66f95e364222 162 .event_irq_priority = 2, \
wkleunen 1:66f95e364222 163 .payload_length = 32, \
wkleunen 1:66f95e364222 164 .selective_auto_ack = false \
wkleunen 1:66f95e364222 165 }
wkleunen 1:66f95e364222 166
wkleunen 1:66f95e364222 167
wkleunen 1:66f95e364222 168 /** @brief Default legacy radio parameters. Identical to the nRF24Lxx defaults. */
wkleunen 1:66f95e364222 169 #define NRF_ESB_LEGACY_CONFIG {.protocol = NRF_ESB_PROTOCOL_ESB, \
wkleunen 1:66f95e364222 170 .mode = NRF_ESB_MODE_PTX, \
wkleunen 1:66f95e364222 171 .event_handler = 0, \
wkleunen 1:66f95e364222 172 .bitrate = NRF_ESB_BITRATE_2MBPS, \
wkleunen 1:66f95e364222 173 .crc = NRF_ESB_CRC_8BIT, \
wkleunen 1:66f95e364222 174 .tx_output_power = NRF_ESB_TX_POWER_0DBM, \
wkleunen 1:66f95e364222 175 .retransmit_delay = 600, \
wkleunen 1:66f95e364222 176 .retransmit_count = 3, \
wkleunen 1:66f95e364222 177 .tx_mode = NRF_ESB_TXMODE_AUTO, \
wkleunen 1:66f95e364222 178 .radio_irq_priority = 1, \
wkleunen 1:66f95e364222 179 .event_irq_priority = 2, \
wkleunen 1:66f95e364222 180 .payload_length = 32, \
wkleunen 1:66f95e364222 181 .selective_auto_ack = false \
wkleunen 1:66f95e364222 182 }
wkleunen 1:66f95e364222 183
wkleunen 1:66f95e364222 184
wkleunen 1:66f95e364222 185 /** @brief Macro to create an initializer for a TX data packet.
wkleunen 1:66f95e364222 186 *
wkleunen 1:66f95e364222 187 * @details This macro generates an initializer. Using the initializer is more efficient
wkleunen 1:66f95e364222 188 * than setting the individual parameters dynamically.
wkleunen 1:66f95e364222 189 *
wkleunen 1:66f95e364222 190 * @param[in] _pipe The pipe to use for the data packet.
wkleunen 1:66f95e364222 191 * @param[in] ... Comma separated list of character data to put in the TX buffer.
wkleunen 1:66f95e364222 192 * Supported values consist of 1 to 63 characters.
wkleunen 1:66f95e364222 193 *
wkleunen 1:66f95e364222 194 * @return Initializer that sets up the pipe, length, and byte array for content of the TX data.
wkleunen 1:66f95e364222 195 */
wkleunen 1:66f95e364222 196 #define NRF_ESB_CREATE_PAYLOAD(_pipe, ...) \
wkleunen 1:66f95e364222 197 {.pipe = _pipe, .length = NUM_VA_ARGS(__VA_ARGS__), .data = {__VA_ARGS__}}; \
wkleunen 1:66f95e364222 198 STATIC_ASSERT(NUM_VA_ARGS(__VA_ARGS__) > 0 && NUM_VA_ARGS(__VA_ARGS__) <= 63)
wkleunen 1:66f95e364222 199
wkleunen 1:66f95e364222 200
wkleunen 1:66f95e364222 201 /**@brief Enhanced ShockBurst protocols. */
wkleunen 1:66f95e364222 202 typedef enum {
wkleunen 1:66f95e364222 203 NRF_ESB_PROTOCOL_ESB, /**< Enhanced ShockBurst with fixed payload length. */
wkleunen 1:66f95e364222 204 NRF_ESB_PROTOCOL_ESB_DPL /**< Enhanced ShockBurst with dynamic payload length. */
wkleunen 1:66f95e364222 205 } nrf_esb_protocol_t;
wkleunen 1:66f95e364222 206
wkleunen 1:66f95e364222 207
wkleunen 1:66f95e364222 208 /**@brief Enhanced ShockBurst modes. */
wkleunen 1:66f95e364222 209 typedef enum {
wkleunen 1:66f95e364222 210 NRF_ESB_MODE_PTX, /**< Primary transmitter mode. */
wkleunen 1:66f95e364222 211 NRF_ESB_MODE_PRX /**< Primary receiver mode. */
wkleunen 1:66f95e364222 212 } nrf_esb_mode_t;
wkleunen 1:66f95e364222 213
wkleunen 1:66f95e364222 214
wkleunen 1:66f95e364222 215 /**@brief Enhanced ShockBurst bitrate modes. */
wkleunen 1:66f95e364222 216 typedef enum {
wkleunen 1:66f95e364222 217 NRF_ESB_BITRATE_2MBPS = RADIO_MODE_MODE_Nrf_2Mbit, /**< 2 Mb radio mode. */
wkleunen 1:66f95e364222 218 NRF_ESB_BITRATE_1MBPS = RADIO_MODE_MODE_Nrf_1Mbit, /**< 1 Mb radio mode. */
wkleunen 1:66f95e364222 219 NRF_ESB_BITRATE_250KBPS = RADIO_MODE_MODE_Nrf_250Kbit, /**< 250 Kb radio mode. */
wkleunen 1:66f95e364222 220 NRF_ESB_BITRATE_1MBPS_BLE = RADIO_MODE_MODE_Ble_1Mbit, /**< 1 Mb radio mode using @e Bluetooth low energy radio parameters. */
wkleunen 1:66f95e364222 221 #if defined(NRF52)
wkleunen 1:66f95e364222 222 NRF_ESB_BITRATE_2MBPS_BLE = 4 /**< 2 Mb radio mode using @e Bluetooth low energy radio parameters. */
wkleunen 1:66f95e364222 223 #endif
wkleunen 1:66f95e364222 224 } nrf_esb_bitrate_t;
wkleunen 1:66f95e364222 225
wkleunen 1:66f95e364222 226
wkleunen 1:66f95e364222 227 /**@brief Enhanced ShockBurst CRC modes. */
wkleunen 1:66f95e364222 228 typedef enum {
wkleunen 1:66f95e364222 229 NRF_ESB_CRC_16BIT = RADIO_CRCCNF_LEN_Two, /**< Use two-byte CRC. */
wkleunen 1:66f95e364222 230 NRF_ESB_CRC_8BIT = RADIO_CRCCNF_LEN_One, /**< Use one-byte CRC. */
wkleunen 1:66f95e364222 231 NRF_ESB_CRC_OFF = RADIO_CRCCNF_LEN_Disabled /**< Disable CRC. */
wkleunen 1:66f95e364222 232 } nrf_esb_crc_t;
wkleunen 1:66f95e364222 233
wkleunen 1:66f95e364222 234
wkleunen 1:66f95e364222 235 /**@brief Enhanced ShockBurst radio transmission power modes. */
wkleunen 1:66f95e364222 236 typedef enum {
wkleunen 1:66f95e364222 237 NRF_ESB_TX_POWER_4DBM = RADIO_TXPOWER_TXPOWER_Pos4dBm, /**< 4 dBm radio transmit power. */
wkleunen 1:66f95e364222 238 #if defined(NRF52)
wkleunen 1:66f95e364222 239 NRF_ESB_TX_POWER_3DBM = RADIO_TXPOWER_TXPOWER_Pos3dBm, /**< 3 dBm radio transmit power. */
wkleunen 1:66f95e364222 240 #endif
wkleunen 1:66f95e364222 241 NRF_ESB_TX_POWER_0DBM = RADIO_TXPOWER_TXPOWER_0dBm, /**< 0 dBm radio transmit power. */
wkleunen 1:66f95e364222 242 NRF_ESB_TX_POWER_NEG4DBM = RADIO_TXPOWER_TXPOWER_Neg4dBm, /**< -4 dBm radio transmit power. */
wkleunen 1:66f95e364222 243 NRF_ESB_TX_POWER_NEG8DBM = RADIO_TXPOWER_TXPOWER_Neg8dBm, /**< -8 dBm radio transmit power. */
wkleunen 1:66f95e364222 244 NRF_ESB_TX_POWER_NEG12DBM = RADIO_TXPOWER_TXPOWER_Neg12dBm, /**< -12 dBm radio transmit power. */
wkleunen 1:66f95e364222 245 NRF_ESB_TX_POWER_NEG16DBM = RADIO_TXPOWER_TXPOWER_Neg16dBm, /**< -16 dBm radio transmit power. */
wkleunen 1:66f95e364222 246 NRF_ESB_TX_POWER_NEG20DBM = RADIO_TXPOWER_TXPOWER_Neg20dBm, /**< -20 dBm radio transmit power. */
wkleunen 1:66f95e364222 247 NRF_ESB_TX_POWER_NEG30DBM = RADIO_TXPOWER_TXPOWER_Neg30dBm /**< -30 dBm radio transmit power. */
wkleunen 1:66f95e364222 248 } nrf_esb_tx_power_t;
wkleunen 1:66f95e364222 249
wkleunen 1:66f95e364222 250
wkleunen 1:66f95e364222 251 /**@brief Enhanced ShockBurst transmission modes. */
wkleunen 1:66f95e364222 252 typedef enum {
wkleunen 1:66f95e364222 253 NRF_ESB_TXMODE_AUTO, /**< Automatic TX mode: When the TX FIFO contains packets and the radio is idle, packets are sent automatically. */
wkleunen 1:66f95e364222 254 NRF_ESB_TXMODE_MANUAL, /**< Manual TX mode: Packets are not sent until @ref nrf_esb_start_tx is called. This mode can be used to ensure consistent packet timing. */
wkleunen 1:66f95e364222 255 NRF_ESB_TXMODE_MANUAL_START /**< Manual start TX mode: Packets are not sent until @ref nrf_esb_start_tx is called. Then, transmission continues automatically until the TX FIFO is empty. */
wkleunen 1:66f95e364222 256 } nrf_esb_tx_mode_t;
wkleunen 1:66f95e364222 257
wkleunen 1:66f95e364222 258
wkleunen 1:66f95e364222 259 /**@brief Enhanced ShockBurst event IDs used to indicate the type of the event. */
wkleunen 1:66f95e364222 260 typedef enum
wkleunen 1:66f95e364222 261 {
wkleunen 1:66f95e364222 262 NRF_ESB_EVENT_TX_SUCCESS, /**< Event triggered on TX success. */
wkleunen 1:66f95e364222 263 NRF_ESB_EVENT_TX_FAILED, /**< Event triggered on TX failure. */
wkleunen 1:66f95e364222 264 NRF_ESB_EVENT_RX_RECEIVED /**< Event triggered on RX received. */
wkleunen 1:66f95e364222 265 } nrf_esb_evt_id_t;
wkleunen 1:66f95e364222 266
wkleunen 1:66f95e364222 267
wkleunen 1:66f95e364222 268 /**@brief Enhanced ShockBurst payload.
wkleunen 1:66f95e364222 269 *
wkleunen 1:66f95e364222 270 * @details The payload is used both for transmissions and for acknowledging a
wkleunen 1:66f95e364222 271 * received packet with a payload.
wkleunen 1:66f95e364222 272 */
wkleunen 1:66f95e364222 273 typedef struct
wkleunen 1:66f95e364222 274 {
wkleunen 1:66f95e364222 275 uint8_t length; //!< Length of the packet (maximum value is @ref NRF_ESB_MAX_PAYLOAD_LENGTH).
wkleunen 1:66f95e364222 276 uint8_t pipe; //!< Pipe used for this payload.
wkleunen 1:66f95e364222 277 int8_t rssi; //!< RSSI for the received packet.
wkleunen 1:66f95e364222 278 uint8_t noack; //!< Flag indicating that this packet will not be acknowledgement.
wkleunen 1:66f95e364222 279 uint8_t pid; //!< PID assigned during communication.
wkleunen 1:66f95e364222 280 uint8_t data[NRF_ESB_MAX_PAYLOAD_LENGTH]; //!< The payload data.
wkleunen 1:66f95e364222 281 } nrf_esb_payload_t;
wkleunen 1:66f95e364222 282
wkleunen 1:66f95e364222 283
wkleunen 1:66f95e364222 284 /**@brief Enhanced ShockBurst event. */
wkleunen 1:66f95e364222 285 typedef struct
wkleunen 1:66f95e364222 286 {
wkleunen 1:66f95e364222 287 nrf_esb_evt_id_t evt_id; //!< Enhanced ShockBurst event ID.
wkleunen 1:66f95e364222 288 uint32_t tx_attempts; //!< Number of TX retransmission attempts.
wkleunen 1:66f95e364222 289 } nrf_esb_evt_t;
wkleunen 1:66f95e364222 290
wkleunen 1:66f95e364222 291
wkleunen 1:66f95e364222 292 /**@brief Definition of the event handler for the module. */
wkleunen 1:66f95e364222 293 typedef void (* nrf_esb_event_handler_t)(nrf_esb_evt_t const * p_event);
wkleunen 1:66f95e364222 294
wkleunen 1:66f95e364222 295
wkleunen 1:66f95e364222 296 /**@brief Main configuration structure for the module. */
wkleunen 1:66f95e364222 297 typedef struct
wkleunen 1:66f95e364222 298 {
wkleunen 1:66f95e364222 299 nrf_esb_protocol_t protocol; //!< Enhanced ShockBurst protocol.
wkleunen 1:66f95e364222 300 nrf_esb_mode_t mode; //!< Enhanced ShockBurst mode.
wkleunen 1:66f95e364222 301 nrf_esb_event_handler_t event_handler; //!< Enhanced ShockBurst event handler.
wkleunen 1:66f95e364222 302
wkleunen 1:66f95e364222 303 // General RF parameters
wkleunen 1:66f95e364222 304 nrf_esb_bitrate_t bitrate; //!< Enhanced ShockBurst bitrate mode.
wkleunen 1:66f95e364222 305 nrf_esb_crc_t crc; //!< Enhanced ShockBurst CRC mode.
wkleunen 1:66f95e364222 306
wkleunen 1:66f95e364222 307 nrf_esb_tx_power_t tx_output_power; //!< Enhanced ShockBurst radio transmission power mode.
wkleunen 1:66f95e364222 308
wkleunen 1:66f95e364222 309 uint16_t retransmit_delay; //!< The delay between each retransmission of unacknowledged packets.
wkleunen 1:66f95e364222 310 uint16_t retransmit_count; //!< The number of retransmission attempts before transmission fail.
wkleunen 1:66f95e364222 311
wkleunen 1:66f95e364222 312 // Control settings
wkleunen 1:66f95e364222 313 nrf_esb_tx_mode_t tx_mode; //!< Enhanced ShockBurst transmission mode.
wkleunen 1:66f95e364222 314
wkleunen 1:66f95e364222 315 uint8_t radio_irq_priority; //!< nRF radio interrupt priority.
wkleunen 1:66f95e364222 316 uint8_t event_irq_priority; //!< ESB event interrupt priority.
wkleunen 1:66f95e364222 317 uint8_t payload_length; //!< Length of the payload (maximum length depends on the platforms that are used on each side).
wkleunen 1:66f95e364222 318
wkleunen 1:66f95e364222 319 bool selective_auto_ack; //!< Enable or disable selective auto acknowledgement.
wkleunen 1:66f95e364222 320 } nrf_esb_config_t;
wkleunen 1:66f95e364222 321
wkleunen 1:66f95e364222 322
wkleunen 1:66f95e364222 323 /**@brief Function for initializing the Enhanced ShockBurst module.
wkleunen 1:66f95e364222 324 *
wkleunen 1:66f95e364222 325 * @param p_config Parameters for initializing the module.
wkleunen 1:66f95e364222 326 *
wkleunen 1:66f95e364222 327 * @retval NRF_SUCCESS If initialization was successful.
wkleunen 1:66f95e364222 328 * @retval NRF_ERROR_NULL If the @p p_config argument was NULL.
wkleunen 1:66f95e364222 329 * @retval NRF_ERROR_BUSY If the function failed because the radio is busy.
wkleunen 1:66f95e364222 330 */
wkleunen 1:66f95e364222 331 uint32_t nrf_esb_init(nrf_esb_config_t const * p_config);
wkleunen 1:66f95e364222 332
wkleunen 1:66f95e364222 333
wkleunen 1:66f95e364222 334 /**@brief Function for suspending the Enhanced ShockBurst module.
wkleunen 1:66f95e364222 335 *
wkleunen 1:66f95e364222 336 * Calling this function stops ongoing communications without changing the queues.
wkleunen 1:66f95e364222 337 *
wkleunen 1:66f95e364222 338 * @retval NRF_SUCCESS If Enhanced ShockBurst was suspended.
wkleunen 1:66f95e364222 339 * @retval NRF_ERROR_BUSY If the function failed because the radio is busy.
wkleunen 1:66f95e364222 340 */
wkleunen 1:66f95e364222 341 uint32_t nrf_esb_suspend(void);
wkleunen 1:66f95e364222 342
wkleunen 1:66f95e364222 343
wkleunen 1:66f95e364222 344 /**@brief Function for disabling the Enhanced ShockBurst module.
wkleunen 1:66f95e364222 345 *
wkleunen 1:66f95e364222 346 * Calling this function disables the Enhanced ShockBurst module immediately.
wkleunen 1:66f95e364222 347 * Doing so might stop ongoing communications.
wkleunen 1:66f95e364222 348 *
wkleunen 1:66f95e364222 349 * @note All queues are flushed by this function.
wkleunen 1:66f95e364222 350 *
wkleunen 1:66f95e364222 351 * @retval NRF_SUCCESS If Enhanced ShockBurst was disabled.
wkleunen 1:66f95e364222 352 */
wkleunen 1:66f95e364222 353 uint32_t nrf_esb_disable(void);
wkleunen 1:66f95e364222 354
wkleunen 1:66f95e364222 355
wkleunen 1:66f95e364222 356 /**@brief Function for checking if the Enhanced ShockBurst module is idle.
wkleunen 1:66f95e364222 357 *
wkleunen 1:66f95e364222 358 * @retval true If the module is idle.
wkleunen 1:66f95e364222 359 * @retval false If the module is busy.
wkleunen 1:66f95e364222 360 */
wkleunen 1:66f95e364222 361 bool nrf_esb_is_idle(void);
wkleunen 1:66f95e364222 362
wkleunen 1:66f95e364222 363
wkleunen 1:66f95e364222 364 /**@brief Function for writing a payload for transmission or acknowledgement.
wkleunen 1:66f95e364222 365 *
wkleunen 1:66f95e364222 366 * This function writes a payload that is added to the queue. When the module is in PTX mode, the
wkleunen 1:66f95e364222 367 * payload is queued for a regular transmission. When the module is in PRX mode, the payload
wkleunen 1:66f95e364222 368 * is queued for when a packet is received that requires an acknowledgement with payload.
wkleunen 1:66f95e364222 369 *
wkleunen 1:66f95e364222 370 * @param[in] p_payload Pointer to the structure that contains information and state of the payload.
wkleunen 1:66f95e364222 371 *
wkleunen 1:66f95e364222 372 * @retval NRF_SUCCESS If the payload was successfully queued for writing.
wkleunen 1:66f95e364222 373 * @retval NRF_ERROR_NULL If the required parameter was NULL.
wkleunen 1:66f95e364222 374 * @retval NRF_INVALID_STATE If the module is not initialized.
wkleunen 1:66f95e364222 375 * @retval NRF_ERROR_NOT_SUPPORTED If @p p_payload->noack was false, but selective acknowledgement is not enabled.
wkleunen 1:66f95e364222 376 * @retval NRF_ERROR_NO_MEM If the TX FIFO is full.
wkleunen 1:66f95e364222 377 * @retval NRF_ERROR_INVALID_LENGTH If the payload length was invalid (zero or larger than the allowed maximum).
wkleunen 1:66f95e364222 378 */
wkleunen 1:66f95e364222 379 uint32_t nrf_esb_write_payload(nrf_esb_payload_t const * p_payload);
wkleunen 1:66f95e364222 380
wkleunen 1:66f95e364222 381
wkleunen 1:66f95e364222 382 /**@brief Function for reading an RX payload.
wkleunen 1:66f95e364222 383 *
wkleunen 1:66f95e364222 384 * @param[in,out] p_payload Pointer to the structure that contains information and state of the payload.
wkleunen 1:66f95e364222 385 *
wkleunen 1:66f95e364222 386 * @retval NRF_SUCCESS If the data was read successfully.
wkleunen 1:66f95e364222 387 * @retval NRF_ERROR_NULL If the required parameter was NULL.
wkleunen 1:66f95e364222 388 * @retval NRF_INVALID_STATE If the module is not initialized.
wkleunen 1:66f95e364222 389 */
wkleunen 1:66f95e364222 390 uint32_t nrf_esb_read_rx_payload(nrf_esb_payload_t * p_payload);
wkleunen 1:66f95e364222 391
wkleunen 1:66f95e364222 392
wkleunen 1:66f95e364222 393 /**@brief Function for starting transmission.
wkleunen 1:66f95e364222 394 *
wkleunen 1:66f95e364222 395 * @retval NRF_SUCCESS If the TX started successfully.
wkleunen 1:66f95e364222 396 * @retval NRF_ERROR_BUFFER_EMPTY If the TX did not start because the FIFO buffer is empty.
wkleunen 1:66f95e364222 397 * @retval NRF_ERROR_BUSY If the function failed because the radio is busy.
wkleunen 1:66f95e364222 398 */
wkleunen 1:66f95e364222 399 uint32_t nrf_esb_start_tx(void);
wkleunen 1:66f95e364222 400
wkleunen 1:66f95e364222 401
wkleunen 1:66f95e364222 402 /**@brief Function for starting to transmit data from the FIFO buffer.
wkleunen 1:66f95e364222 403 *
wkleunen 1:66f95e364222 404 * @retval NRF_SUCCESS If the transmission was started successfully.
wkleunen 1:66f95e364222 405 * @retval NRF_ERROR_BUSY If the function failed because the radio is busy.
wkleunen 1:66f95e364222 406 */
wkleunen 1:66f95e364222 407 uint32_t nrf_esb_start_rx(void);
wkleunen 1:66f95e364222 408
wkleunen 1:66f95e364222 409
wkleunen 1:66f95e364222 410 /** @brief Function for stopping data reception.
wkleunen 1:66f95e364222 411 *
wkleunen 1:66f95e364222 412 * @retval NRF_SUCCESS If data reception was stopped successfully.
wkleunen 1:66f95e364222 413 * @retval NRF_ESB_ERROR_NOT_IN_RX_MODE If the function failed because the module is not in RX mode.
wkleunen 1:66f95e364222 414 */
wkleunen 1:66f95e364222 415 uint32_t nrf_esb_stop_rx(void);
wkleunen 1:66f95e364222 416
wkleunen 1:66f95e364222 417
wkleunen 1:66f95e364222 418 /**@brief Function for removing remaining items from the TX buffer.
wkleunen 1:66f95e364222 419 *
wkleunen 1:66f95e364222 420 * This function clears the TX FIFO buffer.
wkleunen 1:66f95e364222 421 *
wkleunen 1:66f95e364222 422 * @retval NRF_SUCCESS If pending items in the TX buffer were successfully cleared.
wkleunen 1:66f95e364222 423 * @retval NRF_INVALID_STATE If the module is not initialized.
wkleunen 1:66f95e364222 424 */
wkleunen 1:66f95e364222 425 uint32_t nrf_esb_flush_tx(void);
wkleunen 1:66f95e364222 426
wkleunen 1:66f95e364222 427
wkleunen 1:66f95e364222 428 /**@brief Function for removing the first item from the TX buffer.
wkleunen 1:66f95e364222 429 *
wkleunen 1:66f95e364222 430 * @retval NRF_SUCCESS If the operation completed successfully.
wkleunen 1:66f95e364222 431 * @retval NRF_INVALID_STATE If the module is not initialized.
wkleunen 1:66f95e364222 432 * @retval NRF_ERROR_BUFFER_EMPTY If there are no items in the queue to remove.
wkleunen 1:66f95e364222 433 */
wkleunen 1:66f95e364222 434 uint32_t nrf_esb_pop_tx(void);
wkleunen 1:66f95e364222 435
wkleunen 1:66f95e364222 436
wkleunen 1:66f95e364222 437 /**@brief Function for removing remaining items from the RX buffer.
wkleunen 1:66f95e364222 438 *
wkleunen 1:66f95e364222 439 * @retval NRF_SUCCESS If the pending items in the RX buffer were successfully cleared.
wkleunen 1:66f95e364222 440 * @retval NRF_INVALID_STATE If the module is not initialized.
wkleunen 1:66f95e364222 441 */
wkleunen 1:66f95e364222 442 uint32_t nrf_esb_flush_rx(void);
wkleunen 1:66f95e364222 443
wkleunen 1:66f95e364222 444
wkleunen 1:66f95e364222 445 /**@brief Function for setting the length of the address.
wkleunen 1:66f95e364222 446 *
wkleunen 1:66f95e364222 447 * @param[in] length Length of the ESB address (in bytes).
wkleunen 1:66f95e364222 448 *
wkleunen 1:66f95e364222 449 * @retval NRF_SUCCESS If the address length was set successfully.
wkleunen 1:66f95e364222 450 * @retval NRF_ERROR_INVALID_PARAM If the address length was invalid.
wkleunen 1:66f95e364222 451 * @retval NRF_ERROR_BUSY If the function failed because the radio is busy.
wkleunen 1:66f95e364222 452 */
wkleunen 1:66f95e364222 453 uint32_t nrf_esb_set_address_length(uint8_t length);
wkleunen 1:66f95e364222 454
wkleunen 1:66f95e364222 455
wkleunen 1:66f95e364222 456 /**@brief Function for setting the base address for pipe 0.
wkleunen 1:66f95e364222 457 *
wkleunen 1:66f95e364222 458 * @param[in] p_addr Pointer to the address data.
wkleunen 1:66f95e364222 459 *
wkleunen 1:66f95e364222 460 * @retval NRF_SUCCESS If the base address was set successfully.
wkleunen 1:66f95e364222 461 * @retval NRF_ERROR_BUSY If the function failed because the radio is busy.
wkleunen 1:66f95e364222 462 * @retval NRF_ERROR_INVALID_PARAM If the function failed because the address given was too close to a zero address.
wkleunen 1:66f95e364222 463 * @retval NRF_ERROR_NULL If the required parameter was NULL.
wkleunen 1:66f95e364222 464 */
wkleunen 1:66f95e364222 465 uint32_t nrf_esb_set_base_address_0(uint8_t const * p_addr);
wkleunen 1:66f95e364222 466
wkleunen 1:66f95e364222 467
wkleunen 1:66f95e364222 468 /**@brief Function for setting the base address for pipe 1 to pipe 7.
wkleunen 1:66f95e364222 469 *
wkleunen 1:66f95e364222 470 * @param[in] p_addr Pointer to the address data.
wkleunen 1:66f95e364222 471 *
wkleunen 1:66f95e364222 472 * @retval NRF_SUCCESS If the base address was set successfully.
wkleunen 1:66f95e364222 473 * @retval NRF_ERROR_BUSY If the function failed because the radio is busy.
wkleunen 1:66f95e364222 474 * @retval NRF_ERROR_INVALID_PARAM If the function failed because the address given was too close to a zero address.
wkleunen 1:66f95e364222 475 * @retval NRF_ERROR_NULL If the required parameter was NULL.
wkleunen 1:66f95e364222 476 */
wkleunen 1:66f95e364222 477 uint32_t nrf_esb_set_base_address_1(uint8_t const * p_addr);
wkleunen 1:66f95e364222 478
wkleunen 1:66f95e364222 479
wkleunen 1:66f95e364222 480 /**@brief Function for setting the number of pipes and the pipe prefix addresses.
wkleunen 1:66f95e364222 481 *
wkleunen 1:66f95e364222 482 * This function configures the number of available pipes, enables the pipes,
wkleunen 1:66f95e364222 483 * and sets their prefix addresses.
wkleunen 1:66f95e364222 484 *
wkleunen 1:66f95e364222 485 * @param[in] p_prefixes Pointer to a char array that contains the prefix for each pipe.
wkleunen 1:66f95e364222 486 * @param[in] num_pipes Number of pipes.
wkleunen 1:66f95e364222 487 *
wkleunen 1:66f95e364222 488 * @retval NRF_SUCCESS If the prefix addresses were set successfully.
wkleunen 1:66f95e364222 489 * @retval NRF_ERROR_BUSY If the function failed because the radio is busy.
wkleunen 1:66f95e364222 490 * @retval NRF_ERROR_NULL If a required parameter was NULL.
wkleunen 1:66f95e364222 491 * @retval NRF_ERROR_INVALID_PARAM If an invalid number of pipes was given or if the address given was too close to a zero address.
wkleunen 1:66f95e364222 492 */
wkleunen 1:66f95e364222 493 uint32_t nrf_esb_set_prefixes(uint8_t const * p_prefixes, uint8_t num_pipes);
wkleunen 1:66f95e364222 494
wkleunen 1:66f95e364222 495
wkleunen 1:66f95e364222 496 /**@brief Function for enabling pipes.
wkleunen 1:66f95e364222 497 *
wkleunen 1:66f95e364222 498 * The @p enable_mask parameter must contain the same number of pipes as has been configured
wkleunen 1:66f95e364222 499 * with @ref nrf_esb_set_prefixes.
wkleunen 1:66f95e364222 500 *
wkleunen 1:66f95e364222 501 * @param enable_mask Bitfield mask to enable or disable pipes. Setting a bit to
wkleunen 1:66f95e364222 502 * 0 disables the pipe. Setting a bit to 1 enables the pipe.
wkleunen 1:66f95e364222 503 *
wkleunen 1:66f95e364222 504 * @retval NRF_SUCCESS If the pipes were enabled and disabled successfully.
wkleunen 1:66f95e364222 505 * @retval NRF_ERROR_BUSY If the function failed because the radio is busy.
wkleunen 1:66f95e364222 506 * @retval NRF_ERROR_INVALID_PARAM If the function failed because the address given was too close to a zero address.
wkleunen 1:66f95e364222 507 */
wkleunen 1:66f95e364222 508 uint32_t nrf_esb_enable_pipes(uint8_t enable_mask);
wkleunen 1:66f95e364222 509
wkleunen 1:66f95e364222 510
wkleunen 1:66f95e364222 511 /**@brief Function for updating the prefix for a pipe.
wkleunen 1:66f95e364222 512 *
wkleunen 1:66f95e364222 513 * @param pipe Pipe for which to set the prefix.
wkleunen 1:66f95e364222 514 * @param prefix Prefix to set for the pipe.
wkleunen 1:66f95e364222 515 *
wkleunen 1:66f95e364222 516 * @retval NRF_SUCCESS If the operation completed successfully.
wkleunen 1:66f95e364222 517 * @retval NRF_ERROR_BUSY If the function failed because the radio is busy.
wkleunen 1:66f95e364222 518 * @retval NRF_ERROR_INVALID_PARAM If the given pipe number was invalid or if the address given was too close to a zero address.
wkleunen 1:66f95e364222 519 */
wkleunen 1:66f95e364222 520 uint32_t nrf_esb_update_prefix(uint8_t pipe, uint8_t prefix);
wkleunen 1:66f95e364222 521
wkleunen 1:66f95e364222 522
wkleunen 1:66f95e364222 523 /** @brief Function for setting the channel to use for the radio.
wkleunen 1:66f95e364222 524 *
wkleunen 1:66f95e364222 525 * The module must be in an idle state to call this function. As a PTX, the
wkleunen 1:66f95e364222 526 * application must wait for an idle state and as a PRX, the application must stop RX
wkleunen 1:66f95e364222 527 * before changing the channel. After changing the channel, operation can be resumed.
wkleunen 1:66f95e364222 528 *
wkleunen 1:66f95e364222 529 * @param[in] channel Channel to use for radio.
wkleunen 1:66f95e364222 530 *
wkleunen 1:66f95e364222 531 * @retval NRF_SUCCESS If the operation completed successfully.
wkleunen 1:66f95e364222 532 * @retval NRF_INVALID_STATE If the module is not initialized.
wkleunen 1:66f95e364222 533 * @retval NRF_ERROR_BUSY If the module was not in idle state.
wkleunen 1:66f95e364222 534 * @retval NRF_ERROR_INVALID_PARAM If the channel is invalid (larger than 100).
wkleunen 1:66f95e364222 535 */
wkleunen 1:66f95e364222 536 uint32_t nrf_esb_set_rf_channel(uint32_t channel);
wkleunen 1:66f95e364222 537
wkleunen 1:66f95e364222 538
wkleunen 1:66f95e364222 539 /**@brief Function for getting the current radio channel.
wkleunen 1:66f95e364222 540 *
wkleunen 1:66f95e364222 541 * @param[in, out] p_channel Pointer to the channel data.
wkleunen 1:66f95e364222 542 *
wkleunen 1:66f95e364222 543 * @retval NRF_SUCCESS If the operation completed successfully.
wkleunen 1:66f95e364222 544 * @retval NRF_ERROR_NULL If the required parameter was NULL.
wkleunen 1:66f95e364222 545 */
wkleunen 1:66f95e364222 546 uint32_t nrf_esb_get_rf_channel(uint32_t * p_channel);
wkleunen 1:66f95e364222 547
wkleunen 1:66f95e364222 548
wkleunen 1:66f95e364222 549 /**@brief Function for setting the radio output power.
wkleunen 1:66f95e364222 550 *
wkleunen 1:66f95e364222 551 * @param[in] tx_output_power Output power.
wkleunen 1:66f95e364222 552 *
wkleunen 1:66f95e364222 553 * @retval NRF_SUCCESS If the operation completed successfully.
wkleunen 1:66f95e364222 554 * @retval NRF_ERROR_BUSY If the function failed because the radio is busy.
wkleunen 1:66f95e364222 555 */
wkleunen 1:66f95e364222 556 uint32_t nrf_esb_set_tx_power(nrf_esb_tx_power_t tx_output_power);
wkleunen 1:66f95e364222 557
wkleunen 1:66f95e364222 558
wkleunen 1:66f95e364222 559 /**@brief Function for setting the packet retransmit delay.
wkleunen 1:66f95e364222 560 *
wkleunen 1:66f95e364222 561 * @param[in] delay Delay between retransmissions.
wkleunen 1:66f95e364222 562 *
wkleunen 1:66f95e364222 563 * @retval NRF_SUCCESS If the operation completed successfully.
wkleunen 1:66f95e364222 564 * @retval NRF_ERROR_BUSY If the function failed because the radio is busy.
wkleunen 1:66f95e364222 565 */
wkleunen 1:66f95e364222 566 uint32_t nrf_esb_set_retransmit_delay(uint16_t delay);
wkleunen 1:66f95e364222 567
wkleunen 1:66f95e364222 568
wkleunen 1:66f95e364222 569 /**@brief Function for setting the number of retransmission attempts.
wkleunen 1:66f95e364222 570 *
wkleunen 1:66f95e364222 571 * @param[in] count Number of retransmissions.
wkleunen 1:66f95e364222 572 *
wkleunen 1:66f95e364222 573 * @retval NRF_SUCCESS If the operation completed successfully.
wkleunen 1:66f95e364222 574 * @retval NRF_ERROR_BUSY If the function failed because the radio is busy.
wkleunen 1:66f95e364222 575 */
wkleunen 1:66f95e364222 576 uint32_t nrf_esb_set_retransmit_count(uint16_t count);
wkleunen 1:66f95e364222 577
wkleunen 1:66f95e364222 578
wkleunen 1:66f95e364222 579 /**@brief Function for setting the radio bitrate.
wkleunen 1:66f95e364222 580 *
wkleunen 1:66f95e364222 581 * @param[in] bitrate Radio bitrate.
wkleunen 1:66f95e364222 582 *
wkleunen 1:66f95e364222 583 * @retval NRF_SUCCESS If the operation completed successfully.
wkleunen 1:66f95e364222 584 * @retval NRF_ERROR_BUSY If the function failed because the radio is busy.
wkleunen 1:66f95e364222 585 */
wkleunen 1:66f95e364222 586 uint32_t nrf_esb_set_bitrate(nrf_esb_bitrate_t bitrate);
wkleunen 1:66f95e364222 587
wkleunen 1:66f95e364222 588
wkleunen 1:66f95e364222 589 /**@brief Function for reusing a packet ID for a specific pipe.
wkleunen 1:66f95e364222 590 *
wkleunen 1:66f95e364222 591 * The ESB protocol uses a 2-bit sequence number (packet ID) to identify
wkleunen 1:66f95e364222 592 * retransmitted packets. By default, the packet ID is incremented for every
wkleunen 1:66f95e364222 593 * uploaded packet. Use this function to prevent this and send two different
wkleunen 1:66f95e364222 594 * packets with the same packet ID.
wkleunen 1:66f95e364222 595 *
wkleunen 1:66f95e364222 596 * @param[in] pipe Pipe.
wkleunen 1:66f95e364222 597 *
wkleunen 1:66f95e364222 598 * @retval NRF_SUCCESS If the operation completed successfully.
wkleunen 1:66f95e364222 599 * @retval NRF_ERROR_BUSY If the function failed because the radio is busy.
wkleunen 1:66f95e364222 600 */
wkleunen 1:66f95e364222 601 uint32_t nrf_esb_reuse_pid(uint8_t pipe);
wkleunen 1:66f95e364222 602
wkleunen 1:66f95e364222 603 /** @} */
wkleunen 1:66f95e364222 604
wkleunen 1:66f95e364222 605 #ifdef __cplusplus
wkleunen 1:66f95e364222 606 }
wkleunen 1:66f95e364222 607 #endif
wkleunen 1:66f95e364222 608
wkleunen 1:66f95e364222 609 #endif // NRF_ESB