esb gcc program

Dependencies:   ESP8266

Fork of esb_gcc by Joshua Noble

Committer:
joshuajnoble
Date:
Mon Mar 23 02:58:28 2015 +0000
Revision:
0:b7e137e41f80
esb gcc

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joshuajnoble 0:b7e137e41f80 1 /* Copyright (c) 2011 Nordic Semiconductor. All Rights Reserved.
joshuajnoble 0:b7e137e41f80 2 *
joshuajnoble 0:b7e137e41f80 3 * The information contained herein is property of Nordic Semiconductor ASA.
joshuajnoble 0:b7e137e41f80 4 * Terms and conditions of usage are described in detail in NORDIC
joshuajnoble 0:b7e137e41f80 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
joshuajnoble 0:b7e137e41f80 6 *
joshuajnoble 0:b7e137e41f80 7 * Licensees are granted free, non-transferable use of the information. NO
joshuajnoble 0:b7e137e41f80 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
joshuajnoble 0:b7e137e41f80 9 * the file.
joshuajnoble 0:b7e137e41f80 10 *
joshuajnoble 0:b7e137e41f80 11 * $LastChangedRevision: 39629 $
joshuajnoble 0:b7e137e41f80 12 */
joshuajnoble 0:b7e137e41f80 13
joshuajnoble 0:b7e137e41f80 14 /**
joshuajnoble 0:b7e137e41f80 15 * @file
joshuajnoble 0:b7e137e41f80 16 * @brief Enhanced ShockBurst API.
joshuajnoble 0:b7e137e41f80 17 *
joshuajnoble 0:b7e137e41f80 18 */
joshuajnoble 0:b7e137e41f80 19
joshuajnoble 0:b7e137e41f80 20 #ifndef NRF_ESB_H__
joshuajnoble 0:b7e137e41f80 21 #define NRF_ESB_H__
joshuajnoble 0:b7e137e41f80 22
joshuajnoble 0:b7e137e41f80 23 #include <stdbool.h>
joshuajnoble 0:b7e137e41f80 24 #include <stdint.h>
joshuajnoble 0:b7e137e41f80 25 #include "nrf_esb_constants.h"
joshuajnoble 0:b7e137e41f80 26
joshuajnoble 0:b7e137e41f80 27
joshuajnoble 0:b7e137e41f80 28 /**
joshuajnoble 0:b7e137e41f80 29 * @defgroup esb_02_api Application Programming Interface (API)
joshuajnoble 0:b7e137e41f80 30 * @{
joshuajnoble 0:b7e137e41f80 31 * @ingroup modules_02_esb
joshuajnoble 0:b7e137e41f80 32 * @brief Enhanced ShockBurst Application Programming Interface (API).
joshuajnoble 0:b7e137e41f80 33 */
joshuajnoble 0:b7e137e41f80 34
joshuajnoble 0:b7e137e41f80 35
joshuajnoble 0:b7e137e41f80 36 /**
joshuajnoble 0:b7e137e41f80 37 * @enum nrf_esb_mode_t
joshuajnoble 0:b7e137e41f80 38 * @brief Enumerator used for selecting the ESB mode.
joshuajnoble 0:b7e137e41f80 39 */
joshuajnoble 0:b7e137e41f80 40 typedef enum
joshuajnoble 0:b7e137e41f80 41 {
joshuajnoble 0:b7e137e41f80 42 NRF_ESB_MODE_PTX, ///< Primary Transmitter mode
joshuajnoble 0:b7e137e41f80 43 NRF_ESB_MODE_PRX, ///< Primary Receiver mode
joshuajnoble 0:b7e137e41f80 44 } nrf_esb_mode_t;
joshuajnoble 0:b7e137e41f80 45
joshuajnoble 0:b7e137e41f80 46 /**
joshuajnoble 0:b7e137e41f80 47 * @enum nrf_esb_packet_t
joshuajnoble 0:b7e137e41f80 48 * @brief Enumerator used for selecting TX packet type used in
joshuajnoble 0:b7e137e41f80 49 * PTX mode.
joshuajnoble 0:b7e137e41f80 50 */
joshuajnoble 0:b7e137e41f80 51 typedef enum
joshuajnoble 0:b7e137e41f80 52 {
joshuajnoble 0:b7e137e41f80 53 NRF_ESB_PACKET_USE_ACK, ///< PTX packet requires ACK.
joshuajnoble 0:b7e137e41f80 54 NRF_ESB_PACKET_NO_ACK, ///< PTX packet does not require ACK.
joshuajnoble 0:b7e137e41f80 55 } nrf_esb_packet_t ;
joshuajnoble 0:b7e137e41f80 56
joshuajnoble 0:b7e137e41f80 57
joshuajnoble 0:b7e137e41f80 58 /**
joshuajnoble 0:b7e137e41f80 59 * @enum nrf_esb_base_address_length_t
joshuajnoble 0:b7e137e41f80 60 * @brief Enumerator used for selecting the base address length.
joshuajnoble 0:b7e137e41f80 61 */
joshuajnoble 0:b7e137e41f80 62 typedef enum
joshuajnoble 0:b7e137e41f80 63 {
joshuajnoble 0:b7e137e41f80 64 NRF_ESB_BASE_ADDRESS_LENGTH_2B, ///< 2 byte address length
joshuajnoble 0:b7e137e41f80 65 NRF_ESB_BASE_ADDRESS_LENGTH_3B, ///< 3 byte address length
joshuajnoble 0:b7e137e41f80 66 NRF_ESB_BASE_ADDRESS_LENGTH_4B ///< 4 byte address length
joshuajnoble 0:b7e137e41f80 67 } nrf_esb_base_address_length_t;
joshuajnoble 0:b7e137e41f80 68
joshuajnoble 0:b7e137e41f80 69
joshuajnoble 0:b7e137e41f80 70 /**
joshuajnoble 0:b7e137e41f80 71 * @enum nrf_esb_output_power_t
joshuajnoble 0:b7e137e41f80 72 * @brief Enumerator used for selecting the TX output power.
joshuajnoble 0:b7e137e41f80 73 */
joshuajnoble 0:b7e137e41f80 74 typedef enum
joshuajnoble 0:b7e137e41f80 75 {
joshuajnoble 0:b7e137e41f80 76 NRF_ESB_OUTPUT_POWER_4_DBM, ///< 4 dBm output power.
joshuajnoble 0:b7e137e41f80 77 NRF_ESB_OUTPUT_POWER_0_DBM, ///< 0 dBm output power.
joshuajnoble 0:b7e137e41f80 78 NRF_ESB_OUTPUT_POWER_N4_DBM, ///< -4 dBm output power.
joshuajnoble 0:b7e137e41f80 79 NRF_ESB_OUTPUT_POWER_N8_DBM, ///< -8 dBm output power.
joshuajnoble 0:b7e137e41f80 80 NRF_ESB_OUTPUT_POWER_N12_DBM, ///< -12 dBm output power.
joshuajnoble 0:b7e137e41f80 81 NRF_ESB_OUTPUT_POWER_N16_DBM, ///< -16 dBm output power.
joshuajnoble 0:b7e137e41f80 82 NRF_ESB_OUTPUT_POWER_N20_DBM ///< -20 dBm output power.
joshuajnoble 0:b7e137e41f80 83 } nrf_esb_output_power_t;
joshuajnoble 0:b7e137e41f80 84
joshuajnoble 0:b7e137e41f80 85
joshuajnoble 0:b7e137e41f80 86 /**
joshuajnoble 0:b7e137e41f80 87 * @enum nrf_esb_datarate_t
joshuajnoble 0:b7e137e41f80 88 * @brief Enumerator used for selecting the radio data rate.
joshuajnoble 0:b7e137e41f80 89 */
joshuajnoble 0:b7e137e41f80 90 typedef enum
joshuajnoble 0:b7e137e41f80 91 {
joshuajnoble 0:b7e137e41f80 92 NRF_ESB_DATARATE_250_KBPS, ///< 250 Kbps datarate
joshuajnoble 0:b7e137e41f80 93 NRF_ESB_DATARATE_1_MBPS, ///< 1 Mbps datarate
joshuajnoble 0:b7e137e41f80 94 NRF_ESB_DATARATE_2_MBPS, ///< 1 Mbps datarate
joshuajnoble 0:b7e137e41f80 95 } nrf_esb_datarate_t;
joshuajnoble 0:b7e137e41f80 96
joshuajnoble 0:b7e137e41f80 97
joshuajnoble 0:b7e137e41f80 98 /**
joshuajnoble 0:b7e137e41f80 99 * @enum nrf_esb_crc_length_t
joshuajnoble 0:b7e137e41f80 100 * @brief Enumerator used for selecting the CRC length.
joshuajnoble 0:b7e137e41f80 101 */
joshuajnoble 0:b7e137e41f80 102 typedef enum
joshuajnoble 0:b7e137e41f80 103 {
joshuajnoble 0:b7e137e41f80 104 NRF_ESB_CRC_OFF, ///< CRC check disabled
joshuajnoble 0:b7e137e41f80 105 NRF_ESB_CRC_LENGTH_1_BYTE, ///< CRC check set to 8-bit
joshuajnoble 0:b7e137e41f80 106 NRF_ESB_CRC_LENGTH_2_BYTE ///< CRC check set to 16-bit
joshuajnoble 0:b7e137e41f80 107 } nrf_esb_crc_length_t;
joshuajnoble 0:b7e137e41f80 108
joshuajnoble 0:b7e137e41f80 109 /**
joshuajnoble 0:b7e137e41f80 110 * @enum nrf_esb_xosc_ctl_t
joshuajnoble 0:b7e137e41f80 111 * @brief Enumerator used for specifying whether switching the
joshuajnoble 0:b7e137e41f80 112 * external 16 MHz oscillator on/off shall be handled automatically
joshuajnoble 0:b7e137e41f80 113 * inside ESB or manually by the application.
joshuajnoble 0:b7e137e41f80 114 */
joshuajnoble 0:b7e137e41f80 115 typedef enum
joshuajnoble 0:b7e137e41f80 116 {
joshuajnoble 0:b7e137e41f80 117 NRF_ESB_XOSC_CTL_AUTO, ///< Switch XOSC on/off automatically
joshuajnoble 0:b7e137e41f80 118 NRF_ESB_XOSC_CTL_MANUAL ///< Switch XOSC on/off manually
joshuajnoble 0:b7e137e41f80 119 } nrf_esb_xosc_ctl_t;
joshuajnoble 0:b7e137e41f80 120
joshuajnoble 0:b7e137e41f80 121 /******************************************************************************/
joshuajnoble 0:b7e137e41f80 122 /** @name General API functions
joshuajnoble 0:b7e137e41f80 123 * @{ */
joshuajnoble 0:b7e137e41f80 124 /******************************************************************************/
joshuajnoble 0:b7e137e41f80 125
joshuajnoble 0:b7e137e41f80 126 /**
joshuajnoble 0:b7e137e41f80 127 * @brief Initialize ESB.
joshuajnoble 0:b7e137e41f80 128 *
joshuajnoble 0:b7e137e41f80 129 * @param mode The mode to initialize ESB in.
joshuajnoble 0:b7e137e41f80 130 *
joshuajnoble 0:b7e137e41f80 131 * @retval true If ESB initialized.
joshuajnoble 0:b7e137e41f80 132 * @retval false If ESB failed to initialize.
joshuajnoble 0:b7e137e41f80 133 */
joshuajnoble 0:b7e137e41f80 134 bool nrf_esb_init(nrf_esb_mode_t mode);
joshuajnoble 0:b7e137e41f80 135
joshuajnoble 0:b7e137e41f80 136
joshuajnoble 0:b7e137e41f80 137 /**
joshuajnoble 0:b7e137e41f80 138 * @brief Enable ESB.
joshuajnoble 0:b7e137e41f80 139 *
joshuajnoble 0:b7e137e41f80 140 * Equivalent to setting CE high in legacy ESB.
joshuajnoble 0:b7e137e41f80 141 *
joshuajnoble 0:b7e137e41f80 142 * When enabled the behaviour described for the current ESB mode will apply.
joshuajnoble 0:b7e137e41f80 143 */
joshuajnoble 0:b7e137e41f80 144 void nrf_esb_enable(void);
joshuajnoble 0:b7e137e41f80 145
joshuajnoble 0:b7e137e41f80 146 /**
joshuajnoble 0:b7e137e41f80 147 * @brief Disable ESB.
joshuajnoble 0:b7e137e41f80 148 *
joshuajnoble 0:b7e137e41f80 149 * Equivalent to setting CE low in legacy ESB.
joshuajnoble 0:b7e137e41f80 150 *
joshuajnoble 0:b7e137e41f80 151 * When calling this function ESB will begin disabling,
joshuajnoble 0:b7e137e41f80 152 * and will be fully disabled when ESB calls nrf_esb_disabled().
joshuajnoble 0:b7e137e41f80 153 * If there are any pending notifications (callbacks) , or if any new notifications
joshuajnoble 0:b7e137e41f80 154 * are being added to the internal notification queue while ESB is disabling,
joshuajnoble 0:b7e137e41f80 155 * these will be sent to the application before ESB is fully disabled.
joshuajnoble 0:b7e137e41f80 156 *
joshuajnoble 0:b7e137e41f80 157 * After ESB has been fully disabled, no more notifications will be
joshuajnoble 0:b7e137e41f80 158 * sent to the application.
joshuajnoble 0:b7e137e41f80 159 */
joshuajnoble 0:b7e137e41f80 160 void nrf_esb_disable(void);
joshuajnoble 0:b7e137e41f80 161
joshuajnoble 0:b7e137e41f80 162 /** Check whether ESB is enabled or disabled.
joshuajnoble 0:b7e137e41f80 163 *
joshuajnoble 0:b7e137e41f80 164 * @retval true If ESB is enabled.
joshuajnoble 0:b7e137e41f80 165 * @retval false If ESB is disabled.
joshuajnoble 0:b7e137e41f80 166 */
joshuajnoble 0:b7e137e41f80 167 bool nrf_esb_is_enabled(void);
joshuajnoble 0:b7e137e41f80 168
joshuajnoble 0:b7e137e41f80 169 /** @} */
joshuajnoble 0:b7e137e41f80 170
joshuajnoble 0:b7e137e41f80 171
joshuajnoble 0:b7e137e41f80 172 /******************************************************************************/
joshuajnoble 0:b7e137e41f80 173 /** @name functions
joshuajnoble 0:b7e137e41f80 174 * @{ */
joshuajnoble 0:b7e137e41f80 175 /******************************************************************************/
joshuajnoble 0:b7e137e41f80 176
joshuajnoble 0:b7e137e41f80 177 /**
joshuajnoble 0:b7e137e41f80 178 * @brief TX success callback.
joshuajnoble 0:b7e137e41f80 179 *
joshuajnoble 0:b7e137e41f80 180 * In PTX mode this function is called after the PTX has sent a packet
joshuajnoble 0:b7e137e41f80 181 * and received the corresponding ACK packet from a PRX.
joshuajnoble 0:b7e137e41f80 182 *
joshuajnoble 0:b7e137e41f80 183 * In PRX mode this function is called after a payload in ACK is assumed
joshuajnoble 0:b7e137e41f80 184 * successfully transmitted, that is when the PRX received a new packet
joshuajnoble 0:b7e137e41f80 185 * (new PID or CRC) and the previous ACK sent to a PTX contained a
joshuajnoble 0:b7e137e41f80 186 * payload.
joshuajnoble 0:b7e137e41f80 187 *
joshuajnoble 0:b7e137e41f80 188 * @param tx_pipe The pipe on which the ACK packet was received.
joshuajnoble 0:b7e137e41f80 189 *
joshuajnoble 0:b7e137e41f80 190 * @param rssi Received signal strength indicator in dBm of measured ACK.
joshuajnoble 0:b7e137e41f80 191 *
joshuajnoble 0:b7e137e41f80 192 * As the RSSI measurement requires a minimum on-air duration of the received
joshuajnoble 0:b7e137e41f80 193 * packet, the measured RSSI value will not be reliable when ALL of the following
joshuajnoble 0:b7e137e41f80 194 * criteria are met:
joshuajnoble 0:b7e137e41f80 195 *
joshuajnoble 0:b7e137e41f80 196 * - Datarate = 2 Mbps
joshuajnoble 0:b7e137e41f80 197 * - Payload length = 0
joshuajnoble 0:b7e137e41f80 198 * - CRC is off
joshuajnoble 0:b7e137e41f80 199 *
joshuajnoble 0:b7e137e41f80 200 */
joshuajnoble 0:b7e137e41f80 201 void nrf_esb_tx_success(uint32_t tx_pipe, int32_t rssi);
joshuajnoble 0:b7e137e41f80 202
joshuajnoble 0:b7e137e41f80 203
joshuajnoble 0:b7e137e41f80 204 /**
joshuajnoble 0:b7e137e41f80 205 * @brief TX failed callback (PTX mode only).
joshuajnoble 0:b7e137e41f80 206 *
joshuajnoble 0:b7e137e41f80 207 * This is called after the maximum number of TX attempts
joshuajnoble 0:b7e137e41f80 208 * were reached for a packet. The packet is deleted from the TX FIFO.
joshuajnoble 0:b7e137e41f80 209 *
joshuajnoble 0:b7e137e41f80 210 * Note that when NRF_ESB_PACKET_NO_ACK is used this callback is
joshuajnoble 0:b7e137e41f80 211 * always made after sending a packet.
joshuajnoble 0:b7e137e41f80 212 * @sa nrf_esb_set_max_number_of_tx_attempts().
joshuajnoble 0:b7e137e41f80 213 *
joshuajnoble 0:b7e137e41f80 214 * @param tx_pipe The pipe that failed to send a packet.
joshuajnoble 0:b7e137e41f80 215 */
joshuajnoble 0:b7e137e41f80 216 void nrf_esb_tx_failed(uint32_t tx_pipe);
joshuajnoble 0:b7e137e41f80 217
joshuajnoble 0:b7e137e41f80 218
joshuajnoble 0:b7e137e41f80 219 /**
joshuajnoble 0:b7e137e41f80 220 * @brief RX data ready callback.
joshuajnoble 0:b7e137e41f80 221 *
joshuajnoble 0:b7e137e41f80 222 * PTX mode: This is called after an ACK is received from a PRX containing a
joshuajnoble 0:b7e137e41f80 223 * payload.
joshuajnoble 0:b7e137e41f80 224 *
joshuajnoble 0:b7e137e41f80 225 * PRX mode: This is called after a packet is received from a PTX ACK is
joshuajnoble 0:b7e137e41f80 226 * received from a PRX containing a payload.
joshuajnoble 0:b7e137e41f80 227 *
joshuajnoble 0:b7e137e41f80 228 * @param rx_pipe is the pipe on which a packet was received.
joshuajnoble 0:b7e137e41f80 229 * This value must be < NRF_ESB_CONST_PIPE_COUNT.
joshuajnoble 0:b7e137e41f80 230 *
joshuajnoble 0:b7e137e41f80 231 * @param rssi Received signal strength indicator in dBm of packet.
joshuajnoble 0:b7e137e41f80 232 *
joshuajnoble 0:b7e137e41f80 233 * As the RSSI measurement requires a minimum on-air duration of the received
joshuajnoble 0:b7e137e41f80 234 * packet, the measured RSSI value will not be reliable when ALL of the following
joshuajnoble 0:b7e137e41f80 235 * criteria are met:
joshuajnoble 0:b7e137e41f80 236 *
joshuajnoble 0:b7e137e41f80 237 * - Datarate = 2 Mbps
joshuajnoble 0:b7e137e41f80 238 * - Payload length = 0
joshuajnoble 0:b7e137e41f80 239 * - CRC is off
joshuajnoble 0:b7e137e41f80 240 *
joshuajnoble 0:b7e137e41f80 241 */
joshuajnoble 0:b7e137e41f80 242 void nrf_esb_rx_data_ready(uint32_t rx_pipe, int32_t rssi);
joshuajnoble 0:b7e137e41f80 243
joshuajnoble 0:b7e137e41f80 244
joshuajnoble 0:b7e137e41f80 245 /**
joshuajnoble 0:b7e137e41f80 246 * @brief Disabled callback.
joshuajnoble 0:b7e137e41f80 247 *
joshuajnoble 0:b7e137e41f80 248 * This is called after ESB enters the disabled state.
joshuajnoble 0:b7e137e41f80 249 * There is no further CPU use by ESB, the radio is disabled and the timer is
joshuajnoble 0:b7e137e41f80 250 * powered down.
joshuajnoble 0:b7e137e41f80 251 */
joshuajnoble 0:b7e137e41f80 252 void nrf_esb_disabled(void);
joshuajnoble 0:b7e137e41f80 253
joshuajnoble 0:b7e137e41f80 254 /** @} */
joshuajnoble 0:b7e137e41f80 255
joshuajnoble 0:b7e137e41f80 256
joshuajnoble 0:b7e137e41f80 257 /******************************************************************************/
joshuajnoble 0:b7e137e41f80 258 /** @name Packet transmission and receiving functions
joshuajnoble 0:b7e137e41f80 259 * @{ */
joshuajnoble 0:b7e137e41f80 260 /******************************************************************************/
joshuajnoble 0:b7e137e41f80 261
joshuajnoble 0:b7e137e41f80 262 /**
joshuajnoble 0:b7e137e41f80 263 * @brief Add a packet to the tail of the TX FIFO.
joshuajnoble 0:b7e137e41f80 264 *
joshuajnoble 0:b7e137e41f80 265 * In PTX mode, the packet will be transmitted at the next occation when ESB is enabled.
joshuajnoble 0:b7e137e41f80 266 * In PRX mode, the payload will be piggybacked to onto an ACK.
joshuajnoble 0:b7e137e41f80 267 *
joshuajnoble 0:b7e137e41f80 268 * @param payload Pointer to the payload.
joshuajnoble 0:b7e137e41f80 269 * @param payload_length The number of bytes of the payload to transmit.
joshuajnoble 0:b7e137e41f80 270 * @param pipe The pipe for which to add the payload. This value must be < NRF_ESB_CONST_PIPE_COUNT.
joshuajnoble 0:b7e137e41f80 271 * @param packet_type Specifies whether an ACK is required (ignored when in
joshuajnoble 0:b7e137e41f80 272 * PRX mode, or when the dynamic ack feature is disabled).
joshuajnoble 0:b7e137e41f80 273 * @sa nrf_esb_enable_dyn_ack()
joshuajnoble 0:b7e137e41f80 274 *
joshuajnoble 0:b7e137e41f80 275 * @retval true If the packet was successfully added to the TX FIFO.
joshuajnoble 0:b7e137e41f80 276 * @retval false If pipe was invalid, payload pointer was NULL, payload length
joshuajnoble 0:b7e137e41f80 277 was invalid, insufficient space in FIFO memory pool or
joshuajnoble 0:b7e137e41f80 278 insufficient packets in TX queue.
joshuajnoble 0:b7e137e41f80 279 */
joshuajnoble 0:b7e137e41f80 280 bool nrf_esb_add_packet_to_tx_fifo(uint32_t pipe, uint8_t * payload, uint32_t payload_length, nrf_esb_packet_t packet_type);
joshuajnoble 0:b7e137e41f80 281
joshuajnoble 0:b7e137e41f80 282
joshuajnoble 0:b7e137e41f80 283 /**
joshuajnoble 0:b7e137e41f80 284 * @brief Fetch a packet from the head of the RX FIFO.
joshuajnoble 0:b7e137e41f80 285 *
joshuajnoble 0:b7e137e41f80 286 * @param payload Pointer to copy the payload to.
joshuajnoble 0:b7e137e41f80 287 * @param payload_length Pointer to copy the payload length to. The
joshuajnoble 0:b7e137e41f80 288 * payload length is given in bytes (0 to NRF_ESB_CONST_MAX_PAYLOAD_LENGTH).
joshuajnoble 0:b7e137e41f80 289 * @param pipe Pipe for which to add the payload. This value must be < NRF_ESB_CONST_PIPE_COUNT.
joshuajnoble 0:b7e137e41f80 290 *
joshuajnoble 0:b7e137e41f80 291 * @retval true If the fetch was successful.
joshuajnoble 0:b7e137e41f80 292 * @retval false If there was no packet in the FIFO or the payload pointer
joshuajnoble 0:b7e137e41f80 293 * was NULL.
joshuajnoble 0:b7e137e41f80 294 */
joshuajnoble 0:b7e137e41f80 295 bool nrf_esb_fetch_packet_from_rx_fifo(uint32_t pipe, uint8_t * payload, uint32_t* payload_length);
joshuajnoble 0:b7e137e41f80 296
joshuajnoble 0:b7e137e41f80 297
joshuajnoble 0:b7e137e41f80 298 /**
joshuajnoble 0:b7e137e41f80 299 * @brief Get the number of packets residing in the TX FIFO on a specific
joshuajnoble 0:b7e137e41f80 300 * pipe.
joshuajnoble 0:b7e137e41f80 301 *
joshuajnoble 0:b7e137e41f80 302 * @param pipe The pipe for which to check. This value must be < NRF_ESB_CONST_PIPE_COUNT.
joshuajnoble 0:b7e137e41f80 303 *
joshuajnoble 0:b7e137e41f80 304 * @retval The number of packets in the TX FIFO for the pipe.
joshuajnoble 0:b7e137e41f80 305 */
joshuajnoble 0:b7e137e41f80 306 uint32_t nrf_esb_get_tx_fifo_packet_count(uint32_t pipe);
joshuajnoble 0:b7e137e41f80 307
joshuajnoble 0:b7e137e41f80 308
joshuajnoble 0:b7e137e41f80 309 /**
joshuajnoble 0:b7e137e41f80 310 * @brief Get the number of packets residing in the RX FIFO on a specific
joshuajnoble 0:b7e137e41f80 311 * pipe.
joshuajnoble 0:b7e137e41f80 312 *
joshuajnoble 0:b7e137e41f80 313 * @param pipe The pipe for which to check. This value must be < NRF_ESB_CONST_PIPE_COUNT.
joshuajnoble 0:b7e137e41f80 314 *
joshuajnoble 0:b7e137e41f80 315 * @retval The number of packets in the RX FIFO for the pipe.
joshuajnoble 0:b7e137e41f80 316 */
joshuajnoble 0:b7e137e41f80 317 uint32_t nrf_esb_get_rx_fifo_packet_count(uint32_t pipe);
joshuajnoble 0:b7e137e41f80 318
joshuajnoble 0:b7e137e41f80 319
joshuajnoble 0:b7e137e41f80 320 /**
joshuajnoble 0:b7e137e41f80 321 * @brief Flush the RX FIFO for a specific pipe.
joshuajnoble 0:b7e137e41f80 322 *
joshuajnoble 0:b7e137e41f80 323 * Delete all the packets and free the memory of the TX FIFO for a
joshuajnoble 0:b7e137e41f80 324 * specific pipe.
joshuajnoble 0:b7e137e41f80 325 *
joshuajnoble 0:b7e137e41f80 326 * Note that it is not allowed to flush a TX FIFO when
joshuajnoble 0:b7e137e41f80 327 * ESB is enabled.
joshuajnoble 0:b7e137e41f80 328 *
joshuajnoble 0:b7e137e41f80 329 * @param pipe The pipe for which to flush. This value must be < NRF_ESB_CONST_PIPE_COUNT.
joshuajnoble 0:b7e137e41f80 330 */
joshuajnoble 0:b7e137e41f80 331 void nrf_esb_flush_tx_fifo(uint32_t pipe);
joshuajnoble 0:b7e137e41f80 332
joshuajnoble 0:b7e137e41f80 333
joshuajnoble 0:b7e137e41f80 334 /**
joshuajnoble 0:b7e137e41f80 335 * @brief Flush the RX FIFO for a specific pipe.
joshuajnoble 0:b7e137e41f80 336 *
joshuajnoble 0:b7e137e41f80 337 * Delete all the packets and free the memory of the RX FIFO for a
joshuajnoble 0:b7e137e41f80 338 * specific pipe.
joshuajnoble 0:b7e137e41f80 339 *
joshuajnoble 0:b7e137e41f80 340 * @param pipe The pipe for which to flush. This value must be < NRF_ESB_CONST_PIPE_COUNT.
joshuajnoble 0:b7e137e41f80 341 */
joshuajnoble 0:b7e137e41f80 342 void nrf_esb_flush_rx_fifo(uint32_t pipe);
joshuajnoble 0:b7e137e41f80 343
joshuajnoble 0:b7e137e41f80 344
joshuajnoble 0:b7e137e41f80 345 /**
joshuajnoble 0:b7e137e41f80 346 * @brief Get the total number of transmission attempts
joshuajnoble 0:b7e137e41f80 347 * used for sending the previous successful packet.
joshuajnoble 0:b7e137e41f80 348 *
joshuajnoble 0:b7e137e41f80 349 * The value applies to the packet for which the latest
joshuajnoble 0:b7e137e41f80 350 * nrf_esb_tx_data_sent callback was made.
joshuajnoble 0:b7e137e41f80 351 *
joshuajnoble 0:b7e137e41f80 352 * @return The number of transmission attempts for the
joshuajnoble 0:b7e137e41f80 353 * previous transmitted packet.
joshuajnoble 0:b7e137e41f80 354 */
joshuajnoble 0:b7e137e41f80 355 uint16_t nrf_esb_get_tx_attempts(void);
joshuajnoble 0:b7e137e41f80 356
joshuajnoble 0:b7e137e41f80 357
joshuajnoble 0:b7e137e41f80 358 /**
joshuajnoble 0:b7e137e41f80 359 * @brief Specify that the previous used 2 bit packet ID (PID) shall be reused for
joshuajnoble 0:b7e137e41f80 360 * a given pipe.
joshuajnoble 0:b7e137e41f80 361 *
joshuajnoble 0:b7e137e41f80 362 * This function can be used for continue retransmitting a packet that previously failed
joshuajnoble 0:b7e137e41f80 363 * to be transmitted.
joshuajnoble 0:b7e137e41f80 364
joshuajnoble 0:b7e137e41f80 365 * Example:
joshuajnoble 0:b7e137e41f80 366 * 1. Upload initial packet:
joshuajnoble 0:b7e137e41f80 367 * nrf_esb_add_packet_to_tx_fifo(PIPE_NUMBER, my_tx_payload, TX_PAYLOAD_LENGTH, NRF_ESB_PACKET_USE_ACK);
joshuajnoble 0:b7e137e41f80 368 * 2. If the initial packet fails to be transmitted, specify the PID to be reused:
joshuajnoble 0:b7e137e41f80 369 * nrf_esb_reuse_pid(PIPE_NUMBER);
joshuajnoble 0:b7e137e41f80 370 * 3. Continue re-transmission of the packet by re-uploading it to the TX FIFO:
joshuajnoble 0:b7e137e41f80 371 * nrf_esb_add_packet_to_tx_fifo(PIPE_NUMBER, my_tx_payload, TX_PAYLOAD_LENGTH, NRF_ESB_PACKET_USE_ACK);
joshuajnoble 0:b7e137e41f80 372 *
joshuajnoble 0:b7e137e41f80 373 * @param pipe is the pipe for which to reuse the PID.
joshuajnoble 0:b7e137e41f80 374 */
joshuajnoble 0:b7e137e41f80 375 void nrf_esb_reuse_pid(uint32_t pipe);
joshuajnoble 0:b7e137e41f80 376
joshuajnoble 0:b7e137e41f80 377 /** @} */
joshuajnoble 0:b7e137e41f80 378
joshuajnoble 0:b7e137e41f80 379
joshuajnoble 0:b7e137e41f80 380 /******************************************************************************/
joshuajnoble 0:b7e137e41f80 381 /** @name Configuration functions
joshuajnoble 0:b7e137e41f80 382 *
joshuajnoble 0:b7e137e41f80 383 * Configuration 'set' functions may only be called while ESB is disabled. The
joshuajnoble 0:b7e137e41f80 384 * new parameter comes into effect when ESB is enabled again.
joshuajnoble 0:b7e137e41f80 385 *
joshuajnoble 0:b7e137e41f80 386 * Configuration 'get' functions may be called at any time.
joshuajnoble 0:b7e137e41f80 387 *
joshuajnoble 0:b7e137e41f80 388 * @{ */
joshuajnoble 0:b7e137e41f80 389 /******************************************************************************/
joshuajnoble 0:b7e137e41f80 390
joshuajnoble 0:b7e137e41f80 391
joshuajnoble 0:b7e137e41f80 392 /**
joshuajnoble 0:b7e137e41f80 393 * @brief Set the mode.
joshuajnoble 0:b7e137e41f80 394 *
joshuajnoble 0:b7e137e41f80 395 * @param mode The mode to be used.
joshuajnoble 0:b7e137e41f80 396 * See nrf_esb_mode_t for a list of valid modes.
joshuajnoble 0:b7e137e41f80 397 *
joshuajnoble 0:b7e137e41f80 398 * @retval true if the mode was set properly.
joshuajnoble 0:b7e137e41f80 399 * @retval false if the mode is invalid.
joshuajnoble 0:b7e137e41f80 400 */
joshuajnoble 0:b7e137e41f80 401 bool nrf_esb_set_mode(nrf_esb_mode_t mode);
joshuajnoble 0:b7e137e41f80 402
joshuajnoble 0:b7e137e41f80 403
joshuajnoble 0:b7e137e41f80 404 /**
joshuajnoble 0:b7e137e41f80 405 * @brief Get function counterpart to nrf_esb_set_mode().
joshuajnoble 0:b7e137e41f80 406 *
joshuajnoble 0:b7e137e41f80 407 * @return The current ESB mode.
joshuajnoble 0:b7e137e41f80 408 */
joshuajnoble 0:b7e137e41f80 409 nrf_esb_mode_t nrf_esb_get_mode(void);
joshuajnoble 0:b7e137e41f80 410
joshuajnoble 0:b7e137e41f80 411
joshuajnoble 0:b7e137e41f80 412 /**
joshuajnoble 0:b7e137e41f80 413 * @brief Set the base address length.
joshuajnoble 0:b7e137e41f80 414 *
joshuajnoble 0:b7e137e41f80 415 * @param length The base address length.
joshuajnoble 0:b7e137e41f80 416 *
joshuajnoble 0:b7e137e41f80 417 * @retval true If the address length was set.
joshuajnoble 0:b7e137e41f80 418 * @retval false If the length was invalid.
joshuajnoble 0:b7e137e41f80 419 */
joshuajnoble 0:b7e137e41f80 420 bool nrf_esb_set_base_address_length(nrf_esb_base_address_length_t length);
joshuajnoble 0:b7e137e41f80 421
joshuajnoble 0:b7e137e41f80 422
joshuajnoble 0:b7e137e41f80 423 /**
joshuajnoble 0:b7e137e41f80 424 * @brief Get function counterpart to nrf_esb_set_base_address_length().
joshuajnoble 0:b7e137e41f80 425 *
joshuajnoble 0:b7e137e41f80 426 * @return The current base_address length.
joshuajnoble 0:b7e137e41f80 427 */
joshuajnoble 0:b7e137e41f80 428 nrf_esb_base_address_length_t nrf_esb_get_base_address_length(void);
joshuajnoble 0:b7e137e41f80 429
joshuajnoble 0:b7e137e41f80 430
joshuajnoble 0:b7e137e41f80 431 /**
joshuajnoble 0:b7e137e41f80 432 * @brief Set the base address for pipe 0.
joshuajnoble 0:b7e137e41f80 433 *
joshuajnoble 0:b7e137e41f80 434 * The full on-air address for each pipe is composed of a multi-byte base address
joshuajnoble 0:b7e137e41f80 435 * and a prefix address byte.
joshuajnoble 0:b7e137e41f80 436 *
joshuajnoble 0:b7e137e41f80 437 * For packets to be received correctly, the most significant byte of
joshuajnoble 0:b7e137e41f80 438 * the base address should not be an alternating sequence of 0s and 1s i.e.
joshuajnoble 0:b7e137e41f80 439 * it should not be 0x55 or 0xAA.
joshuajnoble 0:b7e137e41f80 440 *
joshuajnoble 0:b7e137e41f80 441 * @param base_address is the 4 byte base address. The parameter is
joshuajnoble 0:b7e137e41f80 442 * 4 bytes, however only the least L significant bytes are used, where L is
joshuajnoble 0:b7e137e41f80 443 * set by nrf_esb_set_base_address_length().
joshuajnoble 0:b7e137e41f80 444 *
joshuajnoble 0:b7e137e41f80 445 * @retval true if base_address_0 was set.
joshuajnoble 0:b7e137e41f80 446 * @retval false if ESB was enabled.
joshuajnoble 0:b7e137e41f80 447 */
joshuajnoble 0:b7e137e41f80 448 bool nrf_esb_set_base_address_0(uint32_t base_address);
joshuajnoble 0:b7e137e41f80 449
joshuajnoble 0:b7e137e41f80 450
joshuajnoble 0:b7e137e41f80 451 /**
joshuajnoble 0:b7e137e41f80 452 * @brief Get function counterpart to nrf_esb_set_base_address_0().
joshuajnoble 0:b7e137e41f80 453 *
joshuajnoble 0:b7e137e41f80 454 * @return Base address 0.
joshuajnoble 0:b7e137e41f80 455 */
joshuajnoble 0:b7e137e41f80 456 uint32_t nrf_esb_get_base_address_0(void);
joshuajnoble 0:b7e137e41f80 457
joshuajnoble 0:b7e137e41f80 458
joshuajnoble 0:b7e137e41f80 459 /**
joshuajnoble 0:b7e137e41f80 460 * @brief Set the base address for pipes 1-7.
joshuajnoble 0:b7e137e41f80 461 *
joshuajnoble 0:b7e137e41f80 462 * Pipes 1 through 7 share base_address_1. @sa nrf_esb_set_base_address_0.
joshuajnoble 0:b7e137e41f80 463 *
joshuajnoble 0:b7e137e41f80 464 * @param base_address is the 4 byte base address. The parameter is
joshuajnoble 0:b7e137e41f80 465 * 4 bytes, however only the least L significant bytes are used, where L is
joshuajnoble 0:b7e137e41f80 466 * set by nrf_esb_set_base_address_length().
joshuajnoble 0:b7e137e41f80 467 *
joshuajnoble 0:b7e137e41f80 468 * @retval true If base_address_1 was set.
joshuajnoble 0:b7e137e41f80 469 * @retval false If ESB was enabled.
joshuajnoble 0:b7e137e41f80 470 */
joshuajnoble 0:b7e137e41f80 471 bool nrf_esb_set_base_address_1(uint32_t base_address);
joshuajnoble 0:b7e137e41f80 472
joshuajnoble 0:b7e137e41f80 473
joshuajnoble 0:b7e137e41f80 474 /**
joshuajnoble 0:b7e137e41f80 475 * @brief Get function counterpart to nrf_esb_set_base_address_1().
joshuajnoble 0:b7e137e41f80 476 *
joshuajnoble 0:b7e137e41f80 477 * @return Base address 1.
joshuajnoble 0:b7e137e41f80 478 */
joshuajnoble 0:b7e137e41f80 479 uint32_t nrf_esb_get_base_address_1(void);
joshuajnoble 0:b7e137e41f80 480
joshuajnoble 0:b7e137e41f80 481
joshuajnoble 0:b7e137e41f80 482 /**
joshuajnoble 0:b7e137e41f80 483 * @brief Set the address prefix byte for a specific pipe.
joshuajnoble 0:b7e137e41f80 484 *
joshuajnoble 0:b7e137e41f80 485 * Each pipe should have its own unique prefix byte.
joshuajnoble 0:b7e137e41f80 486 *
joshuajnoble 0:b7e137e41f80 487 * @param pipe The pipe that the address should apply to. This value must be < NRF_ESB_CONST_PIPE_COUNT.
joshuajnoble 0:b7e137e41f80 488 * @param address The address prefix byte.
joshuajnoble 0:b7e137e41f80 489 *
joshuajnoble 0:b7e137e41f80 490 * @retval true If the address prefix byte was set.
joshuajnoble 0:b7e137e41f80 491 * @retval false If ESB was enabled or if the pipe was invalid.
joshuajnoble 0:b7e137e41f80 492 */
joshuajnoble 0:b7e137e41f80 493 bool nrf_esb_set_address_prefix_byte(uint32_t pipe, uint8_t address);
joshuajnoble 0:b7e137e41f80 494
joshuajnoble 0:b7e137e41f80 495
joshuajnoble 0:b7e137e41f80 496 /**
joshuajnoble 0:b7e137e41f80 497 * @brief Get function counterpart to nrf_esb_set_address_prefix_byte().
joshuajnoble 0:b7e137e41f80 498 *
joshuajnoble 0:b7e137e41f80 499 * @param pipe the pipe for which to get the address. This value must be < NRF_ESB_CONST_PIPE_COUNT.
joshuajnoble 0:b7e137e41f80 500 * @param out_address is the pointer in which to return the address byte.
joshuajnoble 0:b7e137e41f80 501 *
joshuajnoble 0:b7e137e41f80 502 * @retval true If the value was set.
joshuajnoble 0:b7e137e41f80 503 * @retval false If ESB was enabled, or the pipe was invalid,
joshuajnoble 0:b7e137e41f80 504 * or the out_address pointer was NULL.
joshuajnoble 0:b7e137e41f80 505 */
joshuajnoble 0:b7e137e41f80 506 bool nrf_esb_get_address_prefix_byte(uint32_t pipe, uint8_t* out_address);
joshuajnoble 0:b7e137e41f80 507
joshuajnoble 0:b7e137e41f80 508
joshuajnoble 0:b7e137e41f80 509 /**
joshuajnoble 0:b7e137e41f80 510 * @brief Set which pipes the node shall listen on in PRX mode.
joshuajnoble 0:b7e137e41f80 511 *
joshuajnoble 0:b7e137e41f80 512 * This value is a bitmap, and each bit corresponds to a given pipe number.
joshuajnoble 0:b7e137e41f80 513 * Bit 0 set to "1" enables pipes 0, bit 1 set to "1" enables pipe 1
joshuajnoble 0:b7e137e41f80 514 * and so forth.
joshuajnoble 0:b7e137e41f80 515 * The maximum number of pipes is defined by NRF_CONST_ESB_PIPE_COUNT.
joshuajnoble 0:b7e137e41f80 516 *
joshuajnoble 0:b7e137e41f80 517 * @param pipes A bitmap specifying which pipes to monitor.
joshuajnoble 0:b7e137e41f80 518 *
joshuajnoble 0:b7e137e41f80 519 * @retval true If the bitmap was set.
joshuajnoble 0:b7e137e41f80 520 * @retval false If ESB was enabled.
joshuajnoble 0:b7e137e41f80 521 */
joshuajnoble 0:b7e137e41f80 522 bool nrf_esb_set_enabled_prx_pipes(uint32_t pipes);
joshuajnoble 0:b7e137e41f80 523
joshuajnoble 0:b7e137e41f80 524
joshuajnoble 0:b7e137e41f80 525 /**
joshuajnoble 0:b7e137e41f80 526 * @brief Get function counterpart to nrf_esb_set_enabled_prx_pipes().
joshuajnoble 0:b7e137e41f80 527 *
joshuajnoble 0:b7e137e41f80 528 * @return Bitmap holding the current enabled pipes.
joshuajnoble 0:b7e137e41f80 529 */
joshuajnoble 0:b7e137e41f80 530 uint32_t nrf_esb_get_enabled_prx_pipes(void);
joshuajnoble 0:b7e137e41f80 531
joshuajnoble 0:b7e137e41f80 532
joshuajnoble 0:b7e137e41f80 533 /**
joshuajnoble 0:b7e137e41f80 534 * @brief Set the retransmission delay.
joshuajnoble 0:b7e137e41f80 535 *
joshuajnoble 0:b7e137e41f80 536 * The retransmission delay is the delay from the start of a packet
joshuajnoble 0:b7e137e41f80 537 * that failed to receive the ACK until the start of the retransmission
joshuajnoble 0:b7e137e41f80 538 * attempt.
joshuajnoble 0:b7e137e41f80 539 *
joshuajnoble 0:b7e137e41f80 540 * The minimum value of the retransmission delay is dependent of the
joshuajnoble 0:b7e137e41f80 541 * radio data rate and the payload size(s).(@sa nrf_esb_set_datarate()).
joshuajnoble 0:b7e137e41f80 542 * As a rule of thumb, when using 32 byte payloads in each direction (forward and ACK):
joshuajnoble 0:b7e137e41f80 543 *
joshuajnoble 0:b7e137e41f80 544 * - For NRF_ESB_DATARATE_2_MBPS the retransmission delay must be >= 600 us.
joshuajnoble 0:b7e137e41f80 545 * - For NRF_ESB_DATARATE_1_MBPS the retransmission delay must >= 900 us.
joshuajnoble 0:b7e137e41f80 546 * - For NRF_ESB_DATARATE_250_KBPS the retransmission delay must be >= 2700 us.
joshuajnoble 0:b7e137e41f80 547 *
joshuajnoble 0:b7e137e41f80 548 * @param delay_us The delay in microseconds between each
joshuajnoble 0:b7e137e41f80 549 * retransmission attempt.
joshuajnoble 0:b7e137e41f80 550 *
joshuajnoble 0:b7e137e41f80 551 * @retval true If the retransmit delay was set.
joshuajnoble 0:b7e137e41f80 552 * @retval false If ESB was enabled.
joshuajnoble 0:b7e137e41f80 553 */
joshuajnoble 0:b7e137e41f80 554 bool nrf_esb_set_retransmit_delay(uint32_t delay_us);
joshuajnoble 0:b7e137e41f80 555
joshuajnoble 0:b7e137e41f80 556
joshuajnoble 0:b7e137e41f80 557 /**
joshuajnoble 0:b7e137e41f80 558 * @brief Get function counterpart to nrf_esb_set_retransmit_delay().
joshuajnoble 0:b7e137e41f80 559 *
joshuajnoble 0:b7e137e41f80 560 * @return The current retransmission delay.
joshuajnoble 0:b7e137e41f80 561 */
joshuajnoble 0:b7e137e41f80 562 uint32_t nrf_esb_get_retransmit_delay(void);
joshuajnoble 0:b7e137e41f80 563
joshuajnoble 0:b7e137e41f80 564
joshuajnoble 0:b7e137e41f80 565 /**
joshuajnoble 0:b7e137e41f80 566 * @brief Set the maximum number of TX attempts
joshuajnoble 0:b7e137e41f80 567 * that can be used for a single packet.
joshuajnoble 0:b7e137e41f80 568 *
joshuajnoble 0:b7e137e41f80 569 * @param attempts The maximum number of TX attempts.
joshuajnoble 0:b7e137e41f80 570 * 0 indicates that a packet can use a infinite number of attempts.
joshuajnoble 0:b7e137e41f80 571 *
joshuajnoble 0:b7e137e41f80 572 * @retval false If ESB was enabled.
joshuajnoble 0:b7e137e41f80 573 */
joshuajnoble 0:b7e137e41f80 574 bool nrf_esb_set_max_number_of_tx_attempts(uint16_t attempts);
joshuajnoble 0:b7e137e41f80 575
joshuajnoble 0:b7e137e41f80 576
joshuajnoble 0:b7e137e41f80 577 /**
joshuajnoble 0:b7e137e41f80 578 * @brief Get function counterpart to nrf_esb_set_max_number_of_retransmits().
joshuajnoble 0:b7e137e41f80 579 *
joshuajnoble 0:b7e137e41f80 580 * @return The current number of maximum retransmission attempts.
joshuajnoble 0:b7e137e41f80 581 */
joshuajnoble 0:b7e137e41f80 582 uint16_t nrf_esb_get_max_number_of_tx_attempts(void);
joshuajnoble 0:b7e137e41f80 583
joshuajnoble 0:b7e137e41f80 584
joshuajnoble 0:b7e137e41f80 585 /**
joshuajnoble 0:b7e137e41f80 586 * @brief Set the Radio Frequency (RF) channel.
joshuajnoble 0:b7e137e41f80 587 *
joshuajnoble 0:b7e137e41f80 588 * The valid channels are in the range 0 <= channel <= 125, where the
joshuajnoble 0:b7e137e41f80 589 * actual centre frequency is (2400 + channel) MHz.
joshuajnoble 0:b7e137e41f80 590 *
joshuajnoble 0:b7e137e41f80 591 * @param channel The RF Channel to use.
joshuajnoble 0:b7e137e41f80 592 *
joshuajnoble 0:b7e137e41f80 593 * @return false If ESB was enabled.
joshuajnoble 0:b7e137e41f80 594 */
joshuajnoble 0:b7e137e41f80 595 bool nrf_esb_set_channel(uint32_t channel);
joshuajnoble 0:b7e137e41f80 596
joshuajnoble 0:b7e137e41f80 597
joshuajnoble 0:b7e137e41f80 598 /**
joshuajnoble 0:b7e137e41f80 599 * @brief Get function counterpart to nrf_esb_set_channel().
joshuajnoble 0:b7e137e41f80 600 *
joshuajnoble 0:b7e137e41f80 601 * @return The current RF channel.
joshuajnoble 0:b7e137e41f80 602 */
joshuajnoble 0:b7e137e41f80 603 uint32_t nrf_esb_get_channel(void);
joshuajnoble 0:b7e137e41f80 604
joshuajnoble 0:b7e137e41f80 605
joshuajnoble 0:b7e137e41f80 606 /**
joshuajnoble 0:b7e137e41f80 607 * @brief Set the radio TX output power.
joshuajnoble 0:b7e137e41f80 608 *
joshuajnoble 0:b7e137e41f80 609 * @param power The output power.
joshuajnoble 0:b7e137e41f80 610 *
joshuajnoble 0:b7e137e41f80 611 * @return false If the output_power was invalid.
joshuajnoble 0:b7e137e41f80 612 */
joshuajnoble 0:b7e137e41f80 613 bool nrf_esb_set_output_power(nrf_esb_output_power_t power);
joshuajnoble 0:b7e137e41f80 614
joshuajnoble 0:b7e137e41f80 615
joshuajnoble 0:b7e137e41f80 616 /**
joshuajnoble 0:b7e137e41f80 617 * @brief Get function counterpart to nrf_esb_set_output_power().
joshuajnoble 0:b7e137e41f80 618 *
joshuajnoble 0:b7e137e41f80 619 * @return The output power.
joshuajnoble 0:b7e137e41f80 620 */
joshuajnoble 0:b7e137e41f80 621 nrf_esb_output_power_t nrf_esb_get_output_power(void);
joshuajnoble 0:b7e137e41f80 622
joshuajnoble 0:b7e137e41f80 623
joshuajnoble 0:b7e137e41f80 624 /**
joshuajnoble 0:b7e137e41f80 625 * @brief Set the radio datarate.
joshuajnoble 0:b7e137e41f80 626 *
joshuajnoble 0:b7e137e41f80 627 * @param datarate Datarate.
joshuajnoble 0:b7e137e41f80 628 *
joshuajnoble 0:b7e137e41f80 629 * @retval false If the datarate was invalid.
joshuajnoble 0:b7e137e41f80 630 */
joshuajnoble 0:b7e137e41f80 631 bool nrf_esb_set_datarate(nrf_esb_datarate_t datarate);
joshuajnoble 0:b7e137e41f80 632
joshuajnoble 0:b7e137e41f80 633
joshuajnoble 0:b7e137e41f80 634 /**
joshuajnoble 0:b7e137e41f80 635 * @brief Get function counterpart to nrf_esb_set_datarate().
joshuajnoble 0:b7e137e41f80 636 *
joshuajnoble 0:b7e137e41f80 637 * @return The current datarate.
joshuajnoble 0:b7e137e41f80 638 */
joshuajnoble 0:b7e137e41f80 639 nrf_esb_datarate_t nrf_esb_get_datarate(void);
joshuajnoble 0:b7e137e41f80 640
joshuajnoble 0:b7e137e41f80 641
joshuajnoble 0:b7e137e41f80 642 /**
joshuajnoble 0:b7e137e41f80 643 * @brief Set the CRC length.
joshuajnoble 0:b7e137e41f80 644 *
joshuajnoble 0:b7e137e41f80 645 * The CRC length should be the same on both PTX and PRX in order
joshuajnoble 0:b7e137e41f80 646 * to ensure correct operation.
joshuajnoble 0:b7e137e41f80 647 *
joshuajnoble 0:b7e137e41f80 648 * @param length The CRC length.
joshuajnoble 0:b7e137e41f80 649 *
joshuajnoble 0:b7e137e41f80 650 * @retval false If ESB was enabled or the length was invalid.
joshuajnoble 0:b7e137e41f80 651 */
joshuajnoble 0:b7e137e41f80 652 bool nrf_esb_set_crc_length(nrf_esb_crc_length_t length);
joshuajnoble 0:b7e137e41f80 653
joshuajnoble 0:b7e137e41f80 654
joshuajnoble 0:b7e137e41f80 655 /**
joshuajnoble 0:b7e137e41f80 656 * @brief Get function counterpart to nrf_esb_set_crc_length().
joshuajnoble 0:b7e137e41f80 657 *
joshuajnoble 0:b7e137e41f80 658 * @return The current CRC length.
joshuajnoble 0:b7e137e41f80 659 */
joshuajnoble 0:b7e137e41f80 660 nrf_esb_crc_length_t nrf_esb_get_crc_length(void);
joshuajnoble 0:b7e137e41f80 661
joshuajnoble 0:b7e137e41f80 662
joshuajnoble 0:b7e137e41f80 663 /**
joshuajnoble 0:b7e137e41f80 664 * @brief Set whether start/stop of external oscillator (XOSC) shall be handled
joshuajnoble 0:b7e137e41f80 665 * automatically inside ESB or manually by the application.
joshuajnoble 0:b7e137e41f80 666 *
joshuajnoble 0:b7e137e41f80 667 * When controlling the XOSC manually from the application it is
joshuajnoble 0:b7e137e41f80 668 * required that the XOSC is started before ESB is enabled.
joshuajnoble 0:b7e137e41f80 669 *
joshuajnoble 0:b7e137e41f80 670 * When start/stop of the XOSC is handled automatically by ESB,
joshuajnoble 0:b7e137e41f80 671 * the XOSC will only be running when needed, that is when the radio
joshuajnoble 0:b7e137e41f80 672 * is being used or when ESB needs to maintain synchronization.
joshuajnoble 0:b7e137e41f80 673 *
joshuajnoble 0:b7e137e41f80 674 * It is required that the XOSC is started in order for the radio to be
joshuajnoble 0:b7e137e41f80 675 * able to send or receive any packets.
joshuajnoble 0:b7e137e41f80 676 *
joshuajnoble 0:b7e137e41f80 677 * @param xosc_ctl setting for XOSC control.
joshuajnoble 0:b7e137e41f80 678 *
joshuajnoble 0:b7e137e41f80 679 * @retval true if the parameter was set.
joshuajnoble 0:b7e137e41f80 680 * @retval false if Gazell was enabled or the xosc_ctl value was invalid.
joshuajnoble 0:b7e137e41f80 681 */
joshuajnoble 0:b7e137e41f80 682 bool nrf_esb_set_xosc_ctl(nrf_esb_xosc_ctl_t xosc_ctl);
joshuajnoble 0:b7e137e41f80 683
joshuajnoble 0:b7e137e41f80 684
joshuajnoble 0:b7e137e41f80 685 /**
joshuajnoble 0:b7e137e41f80 686 * @brief Enable dynamic ACK feature. After initialization this feature is disabled.
joshuajnoble 0:b7e137e41f80 687 *
joshuajnoble 0:b7e137e41f80 688 * The dynamic ACK feature must be enabled in order for the @b packet_type
joshuajnoble 0:b7e137e41f80 689 * parameter in the nrf_esb_add_packet_to_tx_fifo() function to have any effect,
joshuajnoble 0:b7e137e41f80 690 * or for the ACK bit of received packets to be evaluated.
joshuajnoble 0:b7e137e41f80 691 *
joshuajnoble 0:b7e137e41f80 692 * When the dynamic ACK feature is disabled, all packets will be ACK'ed.
joshuajnoble 0:b7e137e41f80 693 */
joshuajnoble 0:b7e137e41f80 694 void nrf_esb_enable_dyn_ack(void);
joshuajnoble 0:b7e137e41f80 695
joshuajnoble 0:b7e137e41f80 696 /**
joshuajnoble 0:b7e137e41f80 697 * @brief Disable dynamic ACK feature.
joshuajnoble 0:b7e137e41f80 698 *
joshuajnoble 0:b7e137e41f80 699 * @sa nrf_esb_enable_dyn_ack()
joshuajnoble 0:b7e137e41f80 700 */
joshuajnoble 0:b7e137e41f80 701 void nrf_esb_disable_dyn_ack(void);
joshuajnoble 0:b7e137e41f80 702
joshuajnoble 0:b7e137e41f80 703
joshuajnoble 0:b7e137e41f80 704 /**
joshuajnoble 0:b7e137e41f80 705 * Get function counterpart for nrf_esb_set_xosc_ctl();
joshuajnoble 0:b7e137e41f80 706 *
joshuajnoble 0:b7e137e41f80 707 * @return The XOSC control setting.
joshuajnoble 0:b7e137e41f80 708 */
joshuajnoble 0:b7e137e41f80 709 nrf_esb_xosc_ctl_t nrf_esb_get_xosc_ctl(void);
joshuajnoble 0:b7e137e41f80 710
joshuajnoble 0:b7e137e41f80 711
joshuajnoble 0:b7e137e41f80 712 /** @} */
joshuajnoble 0:b7e137e41f80 713 /** @} */
joshuajnoble 0:b7e137e41f80 714 #endif