Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sat Jun 03 00:22:44 2017 +0000
Revision:
46:b156ef445742
Parent:
18:6a4db94011d3
Final code for internal battlebot competition.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1 /*
sahilmgandhi 18:6a4db94011d3 2 * Copyright (c) 2015 Nordic Semiconductor ASA
sahilmgandhi 18:6a4db94011d3 3 * All rights reserved.
sahilmgandhi 18:6a4db94011d3 4 *
sahilmgandhi 18:6a4db94011d3 5 * Redistribution and use in source and binary forms, with or without modification,
sahilmgandhi 18:6a4db94011d3 6 * are permitted provided that the following conditions are met:
sahilmgandhi 18:6a4db94011d3 7 *
sahilmgandhi 18:6a4db94011d3 8 * 1. Redistributions of source code must retain the above copyright notice, this list
sahilmgandhi 18:6a4db94011d3 9 * of conditions and the following disclaimer.
sahilmgandhi 18:6a4db94011d3 10 *
sahilmgandhi 18:6a4db94011d3 11 * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA
sahilmgandhi 18:6a4db94011d3 12 * integrated circuit in a product or a software update for such product, must reproduce
sahilmgandhi 18:6a4db94011d3 13 * the above copyright notice, this list of conditions and the following disclaimer in
sahilmgandhi 18:6a4db94011d3 14 * the documentation and/or other materials provided with the distribution.
sahilmgandhi 18:6a4db94011d3 15 *
sahilmgandhi 18:6a4db94011d3 16 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be
sahilmgandhi 18:6a4db94011d3 17 * used to endorse or promote products derived from this software without specific prior
sahilmgandhi 18:6a4db94011d3 18 * written permission.
sahilmgandhi 18:6a4db94011d3 19 *
sahilmgandhi 18:6a4db94011d3 20 * 4. This software, with or without modification, must only be used with a
sahilmgandhi 18:6a4db94011d3 21 * Nordic Semiconductor ASA integrated circuit.
sahilmgandhi 18:6a4db94011d3 22 *
sahilmgandhi 18:6a4db94011d3 23 * 5. Any software provided in binary or object form under this license must not be reverse
sahilmgandhi 18:6a4db94011d3 24 * engineered, decompiled, modified and/or disassembled.
sahilmgandhi 18:6a4db94011d3 25 *
sahilmgandhi 18:6a4db94011d3 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
sahilmgandhi 18:6a4db94011d3 27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
sahilmgandhi 18:6a4db94011d3 28 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
sahilmgandhi 18:6a4db94011d3 29 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
sahilmgandhi 18:6a4db94011d3 30 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
sahilmgandhi 18:6a4db94011d3 31 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
sahilmgandhi 18:6a4db94011d3 32 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
sahilmgandhi 18:6a4db94011d3 33 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
sahilmgandhi 18:6a4db94011d3 34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
sahilmgandhi 18:6a4db94011d3 35 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
sahilmgandhi 18:6a4db94011d3 36 *
sahilmgandhi 18:6a4db94011d3 37 */
sahilmgandhi 18:6a4db94011d3 38
sahilmgandhi 18:6a4db94011d3 39
sahilmgandhi 18:6a4db94011d3 40 /**@file
sahilmgandhi 18:6a4db94011d3 41 * @defgroup nrf_spis SPI slave HAL and driver
sahilmgandhi 18:6a4db94011d3 42 * @ingroup nrf_spi
sahilmgandhi 18:6a4db94011d3 43 * @brief SPI slave API.
sahilmgandhi 18:6a4db94011d3 44 * @details The SPIS HAL provides basic APIs for accessing the registers
sahilmgandhi 18:6a4db94011d3 45 * of the SPIS. The SPIS driver provides APIs on a higher level.
sahilmgandhi 18:6a4db94011d3 46 **/
sahilmgandhi 18:6a4db94011d3 47
sahilmgandhi 18:6a4db94011d3 48 #ifndef SPI_SLAVE_H__
sahilmgandhi 18:6a4db94011d3 49 #define SPI_SLAVE_H__
sahilmgandhi 18:6a4db94011d3 50
sahilmgandhi 18:6a4db94011d3 51 #include <stdint.h>
sahilmgandhi 18:6a4db94011d3 52 #include "nrf.h"
sahilmgandhi 18:6a4db94011d3 53 #include "nrf_error.h"
sahilmgandhi 18:6a4db94011d3 54 #include "nrf_drv_config.h"
sahilmgandhi 18:6a4db94011d3 55 #include "nrf_spis.h"
sahilmgandhi 18:6a4db94011d3 56 #include "nrf_gpio.h"
sahilmgandhi 18:6a4db94011d3 57 #include "sdk_common.h"
sahilmgandhi 18:6a4db94011d3 58 #include "app_util_platform.h"
sahilmgandhi 18:6a4db94011d3 59
sahilmgandhi 18:6a4db94011d3 60 #if defined(NRF52)
sahilmgandhi 18:6a4db94011d3 61 #define SPIS2_IRQ SPIM2_SPIS2_SPI2_IRQn
sahilmgandhi 18:6a4db94011d3 62 #define SPIS2_IRQ_HANDLER SPIM2_SPIS2_SPI2_IRQHandler
sahilmgandhi 18:6a4db94011d3 63 #define SPIS0_IRQ SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn
sahilmgandhi 18:6a4db94011d3 64 #define SPIS0_IRQ_HANDLER SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler
sahilmgandhi 18:6a4db94011d3 65 #define SPIS1_IRQ SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn
sahilmgandhi 18:6a4db94011d3 66 #define SPIS1_IRQ_HANDLER SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler
sahilmgandhi 18:6a4db94011d3 67 #else
sahilmgandhi 18:6a4db94011d3 68 #define SPIS0_IRQ SPI0_TWI0_IRQn
sahilmgandhi 18:6a4db94011d3 69 #define SPIS0_IRQ_HANDLER SPI0_TWI0_IRQHandler
sahilmgandhi 18:6a4db94011d3 70 #define SPIS1_IRQ SPI1_TWI1_IRQn
sahilmgandhi 18:6a4db94011d3 71 #define SPIS1_IRQ_HANDLER SPI1_TWI1_IRQHandler
sahilmgandhi 18:6a4db94011d3 72 #endif
sahilmgandhi 18:6a4db94011d3 73
sahilmgandhi 18:6a4db94011d3 74 /**
sahilmgandhi 18:6a4db94011d3 75 * @defgroup nrf_drv_spi_slave SPI slave driver
sahilmgandhi 18:6a4db94011d3 76 * @{
sahilmgandhi 18:6a4db94011d3 77 * @ingroup nrf_spis
sahilmgandhi 18:6a4db94011d3 78 *
sahilmgandhi 18:6a4db94011d3 79 * @brief Multi-instance SPI slave driver.
sahilmgandhi 18:6a4db94011d3 80 */
sahilmgandhi 18:6a4db94011d3 81
sahilmgandhi 18:6a4db94011d3 82 #define NRF_DRV_SPIS_DEFAULT_CSN_PULLUP NRF_GPIO_PIN_NOPULL /**< Default pull-up configuration of the SPI CS. */
sahilmgandhi 18:6a4db94011d3 83 #define NRF_DRV_SPIS_DEFAULT_MISO_DRIVE NRF_GPIO_PIN_S0S1 /**< Default drive configuration of the SPI MISO. */
sahilmgandhi 18:6a4db94011d3 84 #define NRF_DRV_SPIS_DEFAULT_DEF 0xFF /**< Default DEF character. */
sahilmgandhi 18:6a4db94011d3 85 #define NRF_DRV_SPIS_DEFAULT_ORC 0xFF /**< Default ORC character. */
sahilmgandhi 18:6a4db94011d3 86
sahilmgandhi 18:6a4db94011d3 87 /**
sahilmgandhi 18:6a4db94011d3 88 * @brief This value can be provided instead of a pin number for the signals MOSI
sahilmgandhi 18:6a4db94011d3 89 * and MISO to specify that the given signal is not used and therefore
sahilmgandhi 18:6a4db94011d3 90 * does not need to be connected to a pin.
sahilmgandhi 18:6a4db94011d3 91 */
sahilmgandhi 18:6a4db94011d3 92 #define NRF_DRV_SPIS_PIN_NOT_USED 0xFF
sahilmgandhi 18:6a4db94011d3 93
sahilmgandhi 18:6a4db94011d3 94 /** @brief SPIS transaction bit order definitions. */
sahilmgandhi 18:6a4db94011d3 95 typedef enum
sahilmgandhi 18:6a4db94011d3 96 {
sahilmgandhi 18:6a4db94011d3 97 NRF_DRV_SPIS_BIT_ORDER_LSB_FIRST = NRF_SPIS_BIT_ORDER_LSB_FIRST, /**< Least significant bit shifted out first. */
sahilmgandhi 18:6a4db94011d3 98 NRF_DRV_SPIS_BIT_ORDER_MSB_FIRST = NRF_SPIS_BIT_ORDER_MSB_FIRST /**< Most significant bit shifted out first. */
sahilmgandhi 18:6a4db94011d3 99 } nrf_drv_spis_endian_t;
sahilmgandhi 18:6a4db94011d3 100
sahilmgandhi 18:6a4db94011d3 101 /** @brief SPIS mode definitions for clock polarity and phase. */
sahilmgandhi 18:6a4db94011d3 102 typedef enum
sahilmgandhi 18:6a4db94011d3 103 {
sahilmgandhi 18:6a4db94011d3 104 NRF_DRV_SPIS_MODE_0 = NRF_SPIS_MODE_0, /**< (CPOL = 0, CPHA = 0). */
sahilmgandhi 18:6a4db94011d3 105 NRF_DRV_SPIS_MODE_1 = NRF_SPIS_MODE_1, /**< (CPOL = 0, CPHA = 1). */
sahilmgandhi 18:6a4db94011d3 106 NRF_DRV_SPIS_MODE_2 = NRF_SPIS_MODE_2, /**< (CPOL = 1, CPHA = 0). */
sahilmgandhi 18:6a4db94011d3 107 NRF_DRV_SPIS_MODE_3 = NRF_SPIS_MODE_3 /**< (CPOL = 1, CPHA = 1). */
sahilmgandhi 18:6a4db94011d3 108 } nrf_drv_spis_mode_t;
sahilmgandhi 18:6a4db94011d3 109
sahilmgandhi 18:6a4db94011d3 110 /** @brief Event callback function event definitions. */
sahilmgandhi 18:6a4db94011d3 111 typedef enum
sahilmgandhi 18:6a4db94011d3 112 {
sahilmgandhi 18:6a4db94011d3 113 NRF_DRV_SPIS_BUFFERS_SET_DONE, /**< Memory buffer set event. Memory buffers have been set successfully to the SPI slave device, and SPI transactions can be done. */
sahilmgandhi 18:6a4db94011d3 114 NRF_DRV_SPIS_XFER_DONE, /**< SPI transaction event. SPI transaction has been completed. */
sahilmgandhi 18:6a4db94011d3 115 NRF_DRV_SPIS_EVT_TYPE_MAX /**< Enumeration upper bound. */
sahilmgandhi 18:6a4db94011d3 116 } nrf_drv_spis_event_type_t;
sahilmgandhi 18:6a4db94011d3 117
sahilmgandhi 18:6a4db94011d3 118 /** @brief Structure containing the event context from the SPI slave driver. */
sahilmgandhi 18:6a4db94011d3 119 typedef struct
sahilmgandhi 18:6a4db94011d3 120 {
sahilmgandhi 18:6a4db94011d3 121 nrf_drv_spis_event_type_t evt_type; //!< Type of event.
sahilmgandhi 18:6a4db94011d3 122 uint32_t rx_amount; //!< Number of bytes received in last transaction. This parameter is only valid for @ref NRF_DRV_SPIS_XFER_DONE events.
sahilmgandhi 18:6a4db94011d3 123 uint32_t tx_amount; //!< Number of bytes transmitted in last transaction. This parameter is only valid for @ref NRF_DRV_SPIS_XFER_DONE events.
sahilmgandhi 18:6a4db94011d3 124 } nrf_drv_spis_event_t;
sahilmgandhi 18:6a4db94011d3 125
sahilmgandhi 18:6a4db94011d3 126 /** @brief SPI slave driver instance data structure. */
sahilmgandhi 18:6a4db94011d3 127 typedef struct
sahilmgandhi 18:6a4db94011d3 128 {
sahilmgandhi 18:6a4db94011d3 129 NRF_SPIS_Type * p_reg; //!< SPIS instance register.
sahilmgandhi 18:6a4db94011d3 130 uint8_t instance_id; //!< SPIS instance ID.
sahilmgandhi 18:6a4db94011d3 131 IRQn_Type irq; //!< IRQ of the specific instance.
sahilmgandhi 18:6a4db94011d3 132 } nrf_drv_spis_t;
sahilmgandhi 18:6a4db94011d3 133
sahilmgandhi 18:6a4db94011d3 134 /** @brief Macro for creating an SPI slave driver instance. */
sahilmgandhi 18:6a4db94011d3 135 #define NRF_DRV_SPIS_INSTANCE(id) \
sahilmgandhi 18:6a4db94011d3 136 { \
sahilmgandhi 18:6a4db94011d3 137 .p_reg = CONCAT_2(NRF_SPIS, id), \
sahilmgandhi 18:6a4db94011d3 138 .irq = CONCAT_3(SPIS, id, _IRQ), \
sahilmgandhi 18:6a4db94011d3 139 .instance_id = CONCAT_3(SPIS, id, _INSTANCE_INDEX), \
sahilmgandhi 18:6a4db94011d3 140 }
sahilmgandhi 18:6a4db94011d3 141
sahilmgandhi 18:6a4db94011d3 142 /** @brief SPI slave instance default configuration. */
sahilmgandhi 18:6a4db94011d3 143 #define NRF_DRV_SPIS_DEFAULT_CONFIG(id) \
sahilmgandhi 18:6a4db94011d3 144 { \
sahilmgandhi 18:6a4db94011d3 145 .sck_pin = CONCAT_3(SPIS, id, _CONFIG_SCK_PIN), \
sahilmgandhi 18:6a4db94011d3 146 .mosi_pin = CONCAT_3(SPIS, id, _CONFIG_MOSI_PIN), \
sahilmgandhi 18:6a4db94011d3 147 .miso_pin = CONCAT_3(SPIS, id, _CONFIG_MISO_PIN), \
sahilmgandhi 18:6a4db94011d3 148 .csn_pin = NRF_DRV_SPIS_PIN_NOT_USED, \
sahilmgandhi 18:6a4db94011d3 149 .miso_drive = NRF_DRV_SPIS_DEFAULT_MISO_DRIVE, \
sahilmgandhi 18:6a4db94011d3 150 .csn_pullup = NRF_DRV_SPIS_DEFAULT_CSN_PULLUP, \
sahilmgandhi 18:6a4db94011d3 151 .orc = NRF_DRV_SPIS_DEFAULT_ORC, \
sahilmgandhi 18:6a4db94011d3 152 .def = NRF_DRV_SPIS_DEFAULT_DEF, \
sahilmgandhi 18:6a4db94011d3 153 .mode = NRF_DRV_SPIS_MODE_0, \
sahilmgandhi 18:6a4db94011d3 154 .bit_order = NRF_DRV_SPIS_BIT_ORDER_MSB_FIRST, \
sahilmgandhi 18:6a4db94011d3 155 .irq_priority = CONCAT_3(SPIS, id, _CONFIG_IRQ_PRIORITY), \
sahilmgandhi 18:6a4db94011d3 156 }
sahilmgandhi 18:6a4db94011d3 157
sahilmgandhi 18:6a4db94011d3 158 /** @brief SPI peripheral device configuration data. */
sahilmgandhi 18:6a4db94011d3 159 typedef struct
sahilmgandhi 18:6a4db94011d3 160 {
sahilmgandhi 18:6a4db94011d3 161 uint32_t miso_pin; //!< SPI MISO pin (optional).
sahilmgandhi 18:6a4db94011d3 162 /**< Set @ref NRF_DRV_SPIS_PIN_NOT_USED
sahilmgandhi 18:6a4db94011d3 163 * if this signal is not needed. */
sahilmgandhi 18:6a4db94011d3 164 uint32_t mosi_pin; //!< SPI MOSI pin (optional).
sahilmgandhi 18:6a4db94011d3 165 /**< Set @ref NRF_DRV_SPIS_PIN_NOT_USED
sahilmgandhi 18:6a4db94011d3 166 * if this signal is not needed. */
sahilmgandhi 18:6a4db94011d3 167 uint32_t sck_pin; //!< SPI SCK pin.
sahilmgandhi 18:6a4db94011d3 168 uint32_t csn_pin; //!< SPI CSN pin.
sahilmgandhi 18:6a4db94011d3 169 nrf_drv_spis_mode_t mode; //!< SPI mode.
sahilmgandhi 18:6a4db94011d3 170 nrf_drv_spis_endian_t bit_order; //!< SPI transaction bit order.
sahilmgandhi 18:6a4db94011d3 171 nrf_gpio_pin_pull_t csn_pullup; //!< CSN pin pull-up configuration.
sahilmgandhi 18:6a4db94011d3 172 nrf_gpio_pin_drive_t miso_drive; //!< MISO pin drive configuration.
sahilmgandhi 18:6a4db94011d3 173 uint8_t def; //!< Character clocked out in case of an ignored transaction.
sahilmgandhi 18:6a4db94011d3 174 uint8_t orc; //!< Character clocked out after an over-read of the transmit buffer.
sahilmgandhi 18:6a4db94011d3 175 uint8_t irq_priority; //!< Interrupt priority.
sahilmgandhi 18:6a4db94011d3 176 } nrf_drv_spis_config_t;
sahilmgandhi 18:6a4db94011d3 177
sahilmgandhi 18:6a4db94011d3 178
sahilmgandhi 18:6a4db94011d3 179 /** @brief SPI slave event callback function type.
sahilmgandhi 18:6a4db94011d3 180 *
sahilmgandhi 18:6a4db94011d3 181 * @param[in] event SPI slave driver event.
sahilmgandhi 18:6a4db94011d3 182 */
sahilmgandhi 18:6a4db94011d3 183 typedef void (*nrf_drv_spis_event_handler_t)(nrf_drv_spis_event_t event);
sahilmgandhi 18:6a4db94011d3 184
sahilmgandhi 18:6a4db94011d3 185 /** @brief Function for initializing the SPI slave driver instance.
sahilmgandhi 18:6a4db94011d3 186 *
sahilmgandhi 18:6a4db94011d3 187 * @param[in] p_instance Pointer to the instance structure.
sahilmgandhi 18:6a4db94011d3 188 * @param[in] p_config Pointer to the structure with the initial configuration.
sahilmgandhi 18:6a4db94011d3 189 * If NULL, the default configuration will be used.
sahilmgandhi 18:6a4db94011d3 190 * @param[in] event_handler Function to be called by the SPI slave driver upon event.
sahilmgandhi 18:6a4db94011d3 191 *
sahilmgandhi 18:6a4db94011d3 192 * @retval NRF_SUCCESS If the initialization was successful.
sahilmgandhi 18:6a4db94011d3 193 * @retval NRF_ERROR_INVALID_PARAM If an invalid parameter is supplied.
sahilmgandhi 18:6a4db94011d3 194 * @retval NRF_ERROR_BUSY If some other peripheral with the same
sahilmgandhi 18:6a4db94011d3 195 * instance ID is already in use. This is
sahilmgandhi 18:6a4db94011d3 196 * possible only if PERIPHERAL_RESOURCE_SHARING_ENABLED
sahilmgandhi 18:6a4db94011d3 197 * is set to a value other than zero.
sahilmgandhi 18:6a4db94011d3 198 */
sahilmgandhi 18:6a4db94011d3 199 ret_code_t nrf_drv_spis_init(nrf_drv_spis_t const * const p_instance,
sahilmgandhi 18:6a4db94011d3 200 nrf_drv_spis_config_t const * p_config,
sahilmgandhi 18:6a4db94011d3 201 nrf_drv_spis_event_handler_t event_handler);
sahilmgandhi 18:6a4db94011d3 202
sahilmgandhi 18:6a4db94011d3 203 /**
sahilmgandhi 18:6a4db94011d3 204 * @brief Function for uninitializing the SPI slave driver instance.
sahilmgandhi 18:6a4db94011d3 205 *
sahilmgandhi 18:6a4db94011d3 206 * @param[in] p_instance Pointer to the instance structure.
sahilmgandhi 18:6a4db94011d3 207 */
sahilmgandhi 18:6a4db94011d3 208 void nrf_drv_spis_uninit(nrf_drv_spis_t const * const p_instance);
sahilmgandhi 18:6a4db94011d3 209
sahilmgandhi 18:6a4db94011d3 210 /** @brief Function for preparing the SPI slave instance for a single SPI transaction.
sahilmgandhi 18:6a4db94011d3 211 *
sahilmgandhi 18:6a4db94011d3 212 * This function prepares the SPI slave device to be ready for a single SPI transaction. It configures
sahilmgandhi 18:6a4db94011d3 213 * the SPI slave device to use the memory supplied with the function call in SPI transactions.
sahilmgandhi 18:6a4db94011d3 214 *
sahilmgandhi 18:6a4db94011d3 215 * When either the memory buffer configuration or the SPI transaction has been
sahilmgandhi 18:6a4db94011d3 216 * completed, the event callback function will be called with the appropriate event
sahilmgandhi 18:6a4db94011d3 217 * @ref nrf_drv_spis_event_type_t. Note that the callback function can be called before returning from
sahilmgandhi 18:6a4db94011d3 218 * this function, because it is called from the SPI slave interrupt context.
sahilmgandhi 18:6a4db94011d3 219 *
sahilmgandhi 18:6a4db94011d3 220 * @note This function can be called from the callback function context.
sahilmgandhi 18:6a4db94011d3 221 *
sahilmgandhi 18:6a4db94011d3 222 * @note Client applications must call this function after every @ref NRF_DRV_SPIS_XFER_DONE event if
sahilmgandhi 18:6a4db94011d3 223 * the SPI slave driver should be prepared for a possible new SPI transaction.
sahilmgandhi 18:6a4db94011d3 224 *
sahilmgandhi 18:6a4db94011d3 225 * @note Peripherals that are using EasyDMA (for example, SPIS) require the transfer buffers
sahilmgandhi 18:6a4db94011d3 226 * to be placed in the Data RAM region. Otherwise, this function will fail
sahilmgandhi 18:6a4db94011d3 227 * with the error code NRF_ERROR_INVALID_ADDR.
sahilmgandhi 18:6a4db94011d3 228 *
sahilmgandhi 18:6a4db94011d3 229 * @param[in] p_instance SPIS instance.
sahilmgandhi 18:6a4db94011d3 230 * @param[in] p_tx_buffer Pointer to the TX buffer.
sahilmgandhi 18:6a4db94011d3 231 * @param[in] p_rx_buffer Pointer to the RX buffer.
sahilmgandhi 18:6a4db94011d3 232 * @param[in] tx_buffer_length Length of the TX buffer in bytes.
sahilmgandhi 18:6a4db94011d3 233 * @param[in] rx_buffer_length Length of the RX buffer in bytes.
sahilmgandhi 18:6a4db94011d3 234 *
sahilmgandhi 18:6a4db94011d3 235 * @retval NRF_SUCCESS If the operation was successful.
sahilmgandhi 18:6a4db94011d3 236 * @retval NRF_ERROR_NULL If the operation failed because a NULL pointer was supplied.
sahilmgandhi 18:6a4db94011d3 237 * @retval NRF_ERROR_INVALID_STATE If the operation failed because the SPI slave device is in an incorrect state.
sahilmgandhi 18:6a4db94011d3 238 * @retval NRF_ERROR_INVALID_ADDR If the provided buffers are not placed in the Data
sahilmgandhi 18:6a4db94011d3 239 * RAM region.
sahilmgandhi 18:6a4db94011d3 240 * @retval NRF_ERROR_INTERNAL If the operation failed because of an internal error.
sahilmgandhi 18:6a4db94011d3 241 */
sahilmgandhi 18:6a4db94011d3 242 ret_code_t nrf_drv_spis_buffers_set(nrf_drv_spis_t const * const p_instance,
sahilmgandhi 18:6a4db94011d3 243 const uint8_t * p_tx_buffer,
sahilmgandhi 18:6a4db94011d3 244 uint8_t tx_buffer_length,
sahilmgandhi 18:6a4db94011d3 245 uint8_t * p_rx_buffer,
sahilmgandhi 18:6a4db94011d3 246 uint8_t rx_buffer_length);
sahilmgandhi 18:6a4db94011d3 247
sahilmgandhi 18:6a4db94011d3 248 #endif // SPI_SLAVE_H__
sahilmgandhi 18:6a4db94011d3 249
sahilmgandhi 18:6a4db94011d3 250 /** @} */