Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
spi_api_multibyte.c@2:c520d7c7739d, 2017-05-31 (annotated)
- Committer:
- tsungta
- Date:
- Wed May 31 09:30:53 2017 +0000
- Revision:
- 2:c520d7c7739d
- Parent:
- 1:58f0712d9aa2
- Child:
- 3:f9aa81ae7c4c
Modified API receive and reply; 'receive' is functional ; 'reply' need to FIX
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tsungta | 0:b7415ae44dac | 1 | /* |
tsungta | 0:b7415ae44dac | 2 | * Copyright (c) 2013 Nordic Semiconductor ASA |
tsungta | 0:b7415ae44dac | 3 | * All rights reserved. |
tsungta | 0:b7415ae44dac | 4 | * |
tsungta | 0:b7415ae44dac | 5 | * Redistribution and use in source and binary forms, with or without modification, |
tsungta | 0:b7415ae44dac | 6 | * are permitted provided that the following conditions are met: |
tsungta | 0:b7415ae44dac | 7 | * |
tsungta | 0:b7415ae44dac | 8 | * 1. Redistributions of source code must retain the above copyright notice, this list |
tsungta | 0:b7415ae44dac | 9 | * of conditions and the following disclaimer. |
tsungta | 0:b7415ae44dac | 10 | * |
tsungta | 0:b7415ae44dac | 11 | * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA |
tsungta | 0:b7415ae44dac | 12 | * integrated circuit in a product or a software update for such product, must reproduce |
tsungta | 0:b7415ae44dac | 13 | * the above copyright notice, this list of conditions and the following disclaimer in |
tsungta | 0:b7415ae44dac | 14 | * the documentation and/or other materials provided with the distribution. |
tsungta | 0:b7415ae44dac | 15 | * |
tsungta | 0:b7415ae44dac | 16 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be |
tsungta | 0:b7415ae44dac | 17 | * used to endorse or promote products derived from this software without specific prior |
tsungta | 0:b7415ae44dac | 18 | * written permission. |
tsungta | 0:b7415ae44dac | 19 | * |
tsungta | 0:b7415ae44dac | 20 | * 4. This software, with or without modification, must only be used with a |
tsungta | 0:b7415ae44dac | 21 | * Nordic Semiconductor ASA integrated circuit. |
tsungta | 0:b7415ae44dac | 22 | * |
tsungta | 0:b7415ae44dac | 23 | * 5. Any software provided in binary or object form under this license must not be reverse |
tsungta | 0:b7415ae44dac | 24 | * engineered, decompiled, modified and/or disassembled. |
tsungta | 0:b7415ae44dac | 25 | * |
tsungta | 0:b7415ae44dac | 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
tsungta | 0:b7415ae44dac | 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
tsungta | 0:b7415ae44dac | 28 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
tsungta | 0:b7415ae44dac | 29 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
tsungta | 0:b7415ae44dac | 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
tsungta | 0:b7415ae44dac | 31 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
tsungta | 0:b7415ae44dac | 32 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
tsungta | 0:b7415ae44dac | 33 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
tsungta | 0:b7415ae44dac | 34 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
tsungta | 0:b7415ae44dac | 35 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
tsungta | 0:b7415ae44dac | 36 | * |
tsungta | 0:b7415ae44dac | 37 | */ |
tsungta | 0:b7415ae44dac | 38 | |
tsungta | 0:b7415ae44dac | 39 | |
tsungta | 0:b7415ae44dac | 40 | #include "spi_api_multibyte.h" |
tsungta | 0:b7415ae44dac | 41 | |
tsungta | 0:b7415ae44dac | 42 | #if DEVICE_SPI |
tsungta | 0:b7415ae44dac | 43 | |
tsungta | 0:b7415ae44dac | 44 | #include "cmsis.h" |
tsungta | 0:b7415ae44dac | 45 | #include "pinmap.h" |
tsungta | 0:b7415ae44dac | 46 | #include "mbed_assert.h" |
tsungta | 0:b7415ae44dac | 47 | #include "mbed_error.h" |
tsungta | 0:b7415ae44dac | 48 | #include "nrf_drv_spi.h" |
tsungta | 0:b7415ae44dac | 49 | #include "nrf_drv_spis.h" |
tsungta | 0:b7415ae44dac | 50 | #include "app_util_platform.h" |
tsungta | 0:b7415ae44dac | 51 | |
tsungta | 0:b7415ae44dac | 52 | #if DEVICE_SPI_ASYNCH |
tsungta | 0:b7415ae44dac | 53 | #define SPI_IDX(obj) ((obj)->spi.spi_idx) |
tsungta | 0:b7415ae44dac | 54 | #else |
tsungta | 0:b7415ae44dac | 55 | #define SPI_IDX(obj) ((obj)->spi_idx) |
tsungta | 0:b7415ae44dac | 56 | #endif |
tsungta | 0:b7415ae44dac | 57 | #define SPI_INFO(obj) (&m_spi_info[SPI_IDX(obj)]) |
tsungta | 0:b7415ae44dac | 58 | #define MASTER_INST(obj) (&m_instances[SPI_IDX(obj)].master) |
tsungta | 0:b7415ae44dac | 59 | #define SLAVE_INST(obj) (&m_instances[SPI_IDX(obj)].slave) |
tsungta | 0:b7415ae44dac | 60 | |
tsungta | 0:b7415ae44dac | 61 | typedef struct { |
tsungta | 0:b7415ae44dac | 62 | bool initialized; |
tsungta | 0:b7415ae44dac | 63 | bool master; |
tsungta | 0:b7415ae44dac | 64 | uint8_t sck_pin; |
tsungta | 0:b7415ae44dac | 65 | uint8_t mosi_pin; |
tsungta | 0:b7415ae44dac | 66 | uint8_t miso_pin; |
tsungta | 0:b7415ae44dac | 67 | uint8_t ss_pin; |
tsungta | 0:b7415ae44dac | 68 | uint8_t spi_mode; |
tsungta | 0:b7415ae44dac | 69 | nrf_drv_spi_frequency_t frequency; |
tsungta | 0:b7415ae44dac | 70 | volatile union { |
tsungta | 0:b7415ae44dac | 71 | bool busy; // master |
tsungta | 0:b7415ae44dac | 72 | bool readable; // slave |
tsungta | 0:b7415ae44dac | 73 | } flag; |
tsungta | 0:b7415ae44dac | 74 | //volatile uint8_t tx_buf; |
tsungta | 0:b7415ae44dac | 75 | //volatile uint8_t rx_buf; |
tsungta | 0:b7415ae44dac | 76 | |
tsungta | 0:b7415ae44dac | 77 | #if DEVICE_SPI_ASYNCH |
tsungta | 0:b7415ae44dac | 78 | uint32_t handler; |
tsungta | 0:b7415ae44dac | 79 | uint32_t event; |
tsungta | 0:b7415ae44dac | 80 | #endif |
tsungta | 0:b7415ae44dac | 81 | } spi_info_t; |
tsungta | 0:b7415ae44dac | 82 | |
tsungta | 1:58f0712d9aa2 | 83 | // #define TEST_STRING "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" //Tsungta, handle 32 bytes per SPI CS cycle |
tsungta | 1:58f0712d9aa2 | 84 | #define TEST_STRING "012" //Tsungta, handle 32 bytes per SPI CS cycle |
tsungta | 0:b7415ae44dac | 85 | uint8_t m_tx_buf[] = TEST_STRING; /**< TX buffer. */ |
tsungta | 0:b7415ae44dac | 86 | uint8_t m_rx_buf[sizeof(TEST_STRING)+1]; /**< RX buffer. */ |
tsungta | 0:b7415ae44dac | 87 | const uint8_t m_length = sizeof(m_tx_buf); /**< Transfer length. */ |
tsungta | 2:c520d7c7739d | 88 | int receive_bytes; |
tsungta | 2:c520d7c7739d | 89 | |
tsungta | 0:b7415ae44dac | 90 | static spi_info_t m_spi_info[SPI_COUNT]; |
tsungta | 0:b7415ae44dac | 91 | |
tsungta | 0:b7415ae44dac | 92 | typedef struct { |
tsungta | 0:b7415ae44dac | 93 | nrf_drv_spi_t master; |
tsungta | 0:b7415ae44dac | 94 | nrf_drv_spis_t slave; |
tsungta | 0:b7415ae44dac | 95 | } sdk_driver_instances_t; |
tsungta | 0:b7415ae44dac | 96 | |
tsungta | 0:b7415ae44dac | 97 | void SPI0_TWI0_IRQHandler(void); |
tsungta | 0:b7415ae44dac | 98 | void SPI1_TWI1_IRQHandler(void); |
tsungta | 0:b7415ae44dac | 99 | void SPIM2_SPIS2_SPI2_IRQHandler(void); |
tsungta | 0:b7415ae44dac | 100 | |
tsungta | 0:b7415ae44dac | 101 | static const peripheral_handler_desc_t spi_hanlder_desc[SPI_COUNT] = { |
tsungta | 0:b7415ae44dac | 102 | #if SPI0_ENABLED |
tsungta | 0:b7415ae44dac | 103 | { |
tsungta | 0:b7415ae44dac | 104 | SPIS0_IRQ, |
tsungta | 0:b7415ae44dac | 105 | (uint32_t) SPI0_TWI0_IRQHandler |
tsungta | 0:b7415ae44dac | 106 | }, |
tsungta | 0:b7415ae44dac | 107 | #endif |
tsungta | 0:b7415ae44dac | 108 | #if SPI1_ENABLED |
tsungta | 0:b7415ae44dac | 109 | { |
tsungta | 0:b7415ae44dac | 110 | SPIS1_IRQ, |
tsungta | 0:b7415ae44dac | 111 | (uint32_t) SPI1_TWI1_IRQHandler |
tsungta | 0:b7415ae44dac | 112 | }, |
tsungta | 0:b7415ae44dac | 113 | #endif |
tsungta | 0:b7415ae44dac | 114 | #if SPI2_ENABLED |
tsungta | 0:b7415ae44dac | 115 | { |
tsungta | 0:b7415ae44dac | 116 | SPIS2_IRQ, |
tsungta | 0:b7415ae44dac | 117 | (uint32_t) SPIM2_SPIS2_SPI2_IRQHandler |
tsungta | 0:b7415ae44dac | 118 | }, |
tsungta | 0:b7415ae44dac | 119 | #endif |
tsungta | 0:b7415ae44dac | 120 | }; |
tsungta | 0:b7415ae44dac | 121 | |
tsungta | 0:b7415ae44dac | 122 | |
tsungta | 0:b7415ae44dac | 123 | static sdk_driver_instances_t m_instances[SPI_COUNT] = { |
tsungta | 0:b7415ae44dac | 124 | #if SPI0_ENABLED |
tsungta | 0:b7415ae44dac | 125 | { |
tsungta | 0:b7415ae44dac | 126 | NRF_DRV_SPI_INSTANCE(0), |
tsungta | 0:b7415ae44dac | 127 | NRF_DRV_SPIS_INSTANCE(0) |
tsungta | 0:b7415ae44dac | 128 | }, |
tsungta | 0:b7415ae44dac | 129 | #endif |
tsungta | 0:b7415ae44dac | 130 | #if SPI1_ENABLED |
tsungta | 0:b7415ae44dac | 131 | { |
tsungta | 0:b7415ae44dac | 132 | NRF_DRV_SPI_INSTANCE(1), |
tsungta | 0:b7415ae44dac | 133 | NRF_DRV_SPIS_INSTANCE(1) |
tsungta | 0:b7415ae44dac | 134 | }, |
tsungta | 0:b7415ae44dac | 135 | #endif |
tsungta | 0:b7415ae44dac | 136 | #if SPI2_ENABLED |
tsungta | 0:b7415ae44dac | 137 | { |
tsungta | 0:b7415ae44dac | 138 | NRF_DRV_SPI_INSTANCE(2), |
tsungta | 0:b7415ae44dac | 139 | NRF_DRV_SPIS_INSTANCE(2) |
tsungta | 0:b7415ae44dac | 140 | }, |
tsungta | 0:b7415ae44dac | 141 | #endif |
tsungta | 0:b7415ae44dac | 142 | }; |
tsungta | 0:b7415ae44dac | 143 | |
tsungta | 0:b7415ae44dac | 144 | static void master_event_handler(uint8_t spi_idx, |
tsungta | 0:b7415ae44dac | 145 | nrf_drv_spi_evt_t const *p_event) |
tsungta | 0:b7415ae44dac | 146 | { |
tsungta | 0:b7415ae44dac | 147 | spi_info_t *p_spi_info = &m_spi_info[spi_idx]; |
tsungta | 0:b7415ae44dac | 148 | |
tsungta | 0:b7415ae44dac | 149 | if (p_event->type == NRF_DRV_SPI_EVENT_DONE) { |
tsungta | 0:b7415ae44dac | 150 | p_spi_info->flag.busy = false; |
tsungta | 0:b7415ae44dac | 151 | if (p_spi_info->handler) { |
tsungta | 0:b7415ae44dac | 152 | void (*handler)(void) = (void (*)(void))p_spi_info->handler; |
tsungta | 0:b7415ae44dac | 153 | p_spi_info->handler = 0; |
tsungta | 0:b7415ae44dac | 154 | handler(); |
tsungta | 0:b7415ae44dac | 155 | } |
tsungta | 0:b7415ae44dac | 156 | } |
tsungta | 0:b7415ae44dac | 157 | } |
tsungta | 0:b7415ae44dac | 158 | #define MASTER_EVENT_HANDLER(idx) \ |
tsungta | 0:b7415ae44dac | 159 | static void master_event_handler_##idx(nrf_drv_spi_evt_t const *p_event) { \ |
tsungta | 0:b7415ae44dac | 160 | master_event_handler(SPI##idx##_INSTANCE_INDEX, p_event); \ |
tsungta | 0:b7415ae44dac | 161 | } |
tsungta | 0:b7415ae44dac | 162 | #if SPI0_ENABLED |
tsungta | 0:b7415ae44dac | 163 | MASTER_EVENT_HANDLER(0) |
tsungta | 0:b7415ae44dac | 164 | #endif |
tsungta | 0:b7415ae44dac | 165 | #if SPI1_ENABLED |
tsungta | 0:b7415ae44dac | 166 | MASTER_EVENT_HANDLER(1) |
tsungta | 0:b7415ae44dac | 167 | #endif |
tsungta | 0:b7415ae44dac | 168 | #if SPI2_ENABLED |
tsungta | 0:b7415ae44dac | 169 | MASTER_EVENT_HANDLER(2) |
tsungta | 0:b7415ae44dac | 170 | #endif |
tsungta | 0:b7415ae44dac | 171 | |
tsungta | 0:b7415ae44dac | 172 | static nrf_drv_spi_handler_t const m_master_event_handlers[SPI_COUNT] = { |
tsungta | 0:b7415ae44dac | 173 | #if SPI0_ENABLED |
tsungta | 0:b7415ae44dac | 174 | master_event_handler_0, |
tsungta | 0:b7415ae44dac | 175 | #endif |
tsungta | 0:b7415ae44dac | 176 | #if SPI1_ENABLED |
tsungta | 0:b7415ae44dac | 177 | master_event_handler_1, |
tsungta | 0:b7415ae44dac | 178 | #endif |
tsungta | 0:b7415ae44dac | 179 | #if SPI2_ENABLED |
tsungta | 0:b7415ae44dac | 180 | master_event_handler_2, |
tsungta | 0:b7415ae44dac | 181 | #endif |
tsungta | 0:b7415ae44dac | 182 | }; |
tsungta | 0:b7415ae44dac | 183 | |
tsungta | 0:b7415ae44dac | 184 | |
tsungta | 0:b7415ae44dac | 185 | static void slave_event_handler(uint8_t spi_idx, |
tsungta | 0:b7415ae44dac | 186 | nrf_drv_spis_event_t event) |
tsungta | 0:b7415ae44dac | 187 | { |
tsungta | 0:b7415ae44dac | 188 | spi_info_t *p_spi_info = &m_spi_info[spi_idx]; |
tsungta | 0:b7415ae44dac | 189 | |
tsungta | 0:b7415ae44dac | 190 | if (event.evt_type == NRF_DRV_SPIS_XFER_DONE) { |
tsungta | 0:b7415ae44dac | 191 | // Signal that there is some data received that could be read. |
tsungta | 2:c520d7c7739d | 192 | if(event.rx_amount == receive_bytes)//Tsungta |
tsungta | 1:58f0712d9aa2 | 193 | p_spi_info->flag.readable = true; |
tsungta | 0:b7415ae44dac | 194 | |
tsungta | 0:b7415ae44dac | 195 | // And prepare for the next transfer. |
tsungta | 0:b7415ae44dac | 196 | // Previous data set in 'spi_slave_write' (if any) has been transmitted, |
tsungta | 0:b7415ae44dac | 197 | // now use the default one, until some new is set by 'spi_slave_write'. |
tsungta | 0:b7415ae44dac | 198 | //m_tx_buf = NRF_DRV_SPIS_DEFAULT_ORC; |
tsungta | 0:b7415ae44dac | 199 | nrf_drv_spis_buffers_set(&m_instances[spi_idx].slave, |
tsungta | 0:b7415ae44dac | 200 | m_tx_buf, m_length, m_rx_buf, m_length); |
tsungta | 0:b7415ae44dac | 201 | } |
tsungta | 0:b7415ae44dac | 202 | } |
tsungta | 0:b7415ae44dac | 203 | #define SLAVE_EVENT_HANDLER(idx) \ |
tsungta | 0:b7415ae44dac | 204 | static void slave_event_handler_##idx(nrf_drv_spis_event_t event) { \ |
tsungta | 0:b7415ae44dac | 205 | slave_event_handler(SPIS##idx##_INSTANCE_INDEX, event); \ |
tsungta | 0:b7415ae44dac | 206 | } |
tsungta | 0:b7415ae44dac | 207 | #if SPIS0_ENABLED |
tsungta | 0:b7415ae44dac | 208 | SLAVE_EVENT_HANDLER(0) |
tsungta | 0:b7415ae44dac | 209 | #endif |
tsungta | 0:b7415ae44dac | 210 | #if SPIS1_ENABLED |
tsungta | 0:b7415ae44dac | 211 | SLAVE_EVENT_HANDLER(1) |
tsungta | 0:b7415ae44dac | 212 | #endif |
tsungta | 0:b7415ae44dac | 213 | #if SPIS2_ENABLED |
tsungta | 0:b7415ae44dac | 214 | SLAVE_EVENT_HANDLER(2) |
tsungta | 0:b7415ae44dac | 215 | #endif |
tsungta | 0:b7415ae44dac | 216 | |
tsungta | 0:b7415ae44dac | 217 | static nrf_drv_spis_event_handler_t const m_slave_event_handlers[SPIS_COUNT] = { |
tsungta | 0:b7415ae44dac | 218 | #if SPIS0_ENABLED |
tsungta | 0:b7415ae44dac | 219 | slave_event_handler_0, |
tsungta | 0:b7415ae44dac | 220 | #endif |
tsungta | 0:b7415ae44dac | 221 | #if SPIS1_ENABLED |
tsungta | 0:b7415ae44dac | 222 | slave_event_handler_1, |
tsungta | 0:b7415ae44dac | 223 | #endif |
tsungta | 0:b7415ae44dac | 224 | #if SPIS2_ENABLED |
tsungta | 0:b7415ae44dac | 225 | slave_event_handler_2, |
tsungta | 0:b7415ae44dac | 226 | #endif |
tsungta | 0:b7415ae44dac | 227 | }; |
tsungta | 0:b7415ae44dac | 228 | |
tsungta | 0:b7415ae44dac | 229 | static void prepare_master_config(nrf_drv_spi_config_t *p_config, |
tsungta | 0:b7415ae44dac | 230 | spi_info_t const *p_spi_info) |
tsungta | 0:b7415ae44dac | 231 | { |
tsungta | 0:b7415ae44dac | 232 | p_config->sck_pin = p_spi_info->sck_pin; |
tsungta | 0:b7415ae44dac | 233 | p_config->mosi_pin = p_spi_info->mosi_pin; |
tsungta | 0:b7415ae44dac | 234 | p_config->miso_pin = p_spi_info->miso_pin; |
tsungta | 0:b7415ae44dac | 235 | p_config->ss_pin = p_spi_info->ss_pin; |
tsungta | 0:b7415ae44dac | 236 | p_config->frequency = p_spi_info->frequency; |
tsungta | 0:b7415ae44dac | 237 | p_config->mode = (nrf_drv_spi_mode_t)p_spi_info->spi_mode; |
tsungta | 0:b7415ae44dac | 238 | |
tsungta | 0:b7415ae44dac | 239 | p_config->irq_priority = SPI1_CONFIG_IRQ_PRIORITY; |
tsungta | 0:b7415ae44dac | 240 | p_config->orc = 0xFF; |
tsungta | 0:b7415ae44dac | 241 | p_config->bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST; |
tsungta | 0:b7415ae44dac | 242 | } |
tsungta | 0:b7415ae44dac | 243 | |
tsungta | 0:b7415ae44dac | 244 | static void prepare_slave_config(nrf_drv_spis_config_t *p_config, |
tsungta | 0:b7415ae44dac | 245 | spi_info_t const *p_spi_info) |
tsungta | 0:b7415ae44dac | 246 | { |
tsungta | 0:b7415ae44dac | 247 | p_config->sck_pin = p_spi_info->sck_pin; |
tsungta | 0:b7415ae44dac | 248 | p_config->mosi_pin = p_spi_info->mosi_pin; |
tsungta | 0:b7415ae44dac | 249 | p_config->miso_pin = p_spi_info->miso_pin; |
tsungta | 0:b7415ae44dac | 250 | p_config->csn_pin = p_spi_info->ss_pin; |
tsungta | 0:b7415ae44dac | 251 | p_config->mode = (nrf_drv_spis_mode_t)p_spi_info->spi_mode; |
tsungta | 0:b7415ae44dac | 252 | |
tsungta | 0:b7415ae44dac | 253 | p_config->irq_priority = SPIS1_CONFIG_IRQ_PRIORITY; |
tsungta | 0:b7415ae44dac | 254 | p_config->orc = NRF_DRV_SPIS_DEFAULT_ORC; |
tsungta | 0:b7415ae44dac | 255 | p_config->def = NRF_DRV_SPIS_DEFAULT_DEF; |
tsungta | 0:b7415ae44dac | 256 | p_config->bit_order = NRF_DRV_SPIS_BIT_ORDER_MSB_FIRST; |
tsungta | 0:b7415ae44dac | 257 | p_config->csn_pullup = NRF_DRV_SPIS_DEFAULT_CSN_PULLUP; |
tsungta | 0:b7415ae44dac | 258 | p_config->miso_drive = NRF_DRV_SPIS_DEFAULT_MISO_DRIVE; |
tsungta | 0:b7415ae44dac | 259 | } |
tsungta | 0:b7415ae44dac | 260 | |
tsungta | 0:b7415ae44dac | 261 | void spi_init_multibyte(spi_mb_t *obj, |
tsungta | 0:b7415ae44dac | 262 | PinName mosi, PinName miso, PinName sclk, PinName ssel) |
tsungta | 0:b7415ae44dac | 263 | { |
tsungta | 0:b7415ae44dac | 264 | int i; |
tsungta | 0:b7415ae44dac | 265 | for (i = 0; i < SPI_COUNT; ++i) { |
tsungta | 0:b7415ae44dac | 266 | spi_info_t *p_spi_info = &m_spi_info[i]; |
tsungta | 0:b7415ae44dac | 267 | if (!p_spi_info->initialized) { |
tsungta | 0:b7415ae44dac | 268 | |
tsungta | 0:b7415ae44dac | 269 | NVIC_SetVector(spi_hanlder_desc[i].IRQn, spi_hanlder_desc[i].vector); |
tsungta | 0:b7415ae44dac | 270 | |
tsungta | 0:b7415ae44dac | 271 | p_spi_info->sck_pin = (uint8_t)sclk; |
tsungta | 0:b7415ae44dac | 272 | p_spi_info->mosi_pin = (mosi != NC) ? |
tsungta | 0:b7415ae44dac | 273 | (uint8_t)mosi : NRF_DRV_SPI_PIN_NOT_USED; |
tsungta | 0:b7415ae44dac | 274 | p_spi_info->miso_pin = (miso != NC) ? |
tsungta | 0:b7415ae44dac | 275 | (uint8_t)miso : NRF_DRV_SPI_PIN_NOT_USED; |
tsungta | 0:b7415ae44dac | 276 | p_spi_info->ss_pin = (ssel != NC) ? |
tsungta | 0:b7415ae44dac | 277 | (uint8_t)ssel : NRF_DRV_SPI_PIN_NOT_USED; |
tsungta | 0:b7415ae44dac | 278 | p_spi_info->spi_mode = (uint8_t)NRF_DRV_SPI_MODE_0; |
tsungta | 0:b7415ae44dac | 279 | p_spi_info->frequency = NRF_DRV_SPI_FREQ_1M; |
tsungta | 0:b7415ae44dac | 280 | |
tsungta | 0:b7415ae44dac | 281 | // By default each SPI instance is initialized to work as a master. |
tsungta | 0:b7415ae44dac | 282 | // Should the slave mode be used, the instance will be reconfigured |
tsungta | 0:b7415ae44dac | 283 | // appropriately in 'spi_format'. |
tsungta | 0:b7415ae44dac | 284 | nrf_drv_spi_config_t config; |
tsungta | 0:b7415ae44dac | 285 | prepare_master_config(&config, p_spi_info); |
tsungta | 0:b7415ae44dac | 286 | |
tsungta | 0:b7415ae44dac | 287 | nrf_drv_spi_t const *p_spi = &m_instances[i].master; |
tsungta | 0:b7415ae44dac | 288 | ret_code_t ret_code = nrf_drv_spi_init(p_spi, |
tsungta | 0:b7415ae44dac | 289 | &config, m_master_event_handlers[i]); |
tsungta | 0:b7415ae44dac | 290 | if (ret_code == NRF_SUCCESS) { |
tsungta | 0:b7415ae44dac | 291 | p_spi_info->initialized = true; |
tsungta | 0:b7415ae44dac | 292 | p_spi_info->master = true; |
tsungta | 0:b7415ae44dac | 293 | p_spi_info->flag.busy = false; |
tsungta | 0:b7415ae44dac | 294 | #if DEVICE_SPI_ASYNCH |
tsungta | 0:b7415ae44dac | 295 | p_spi_info->handler = 0; |
tsungta | 0:b7415ae44dac | 296 | #endif |
tsungta | 0:b7415ae44dac | 297 | SPI_IDX(obj) = i; |
tsungta | 0:b7415ae44dac | 298 | |
tsungta | 0:b7415ae44dac | 299 | return; |
tsungta | 0:b7415ae44dac | 300 | } |
tsungta | 0:b7415ae44dac | 301 | } |
tsungta | 0:b7415ae44dac | 302 | } |
tsungta | 0:b7415ae44dac | 303 | |
tsungta | 0:b7415ae44dac | 304 | // No available peripheral |
tsungta | 0:b7415ae44dac | 305 | error("No available SPI peripheral\r\n"); |
tsungta | 0:b7415ae44dac | 306 | } |
tsungta | 0:b7415ae44dac | 307 | |
tsungta | 0:b7415ae44dac | 308 | void spi_free_multibyte(spi_mb_t *obj) |
tsungta | 0:b7415ae44dac | 309 | { |
tsungta | 0:b7415ae44dac | 310 | spi_info_t *p_spi_info = SPI_INFO(obj); |
tsungta | 0:b7415ae44dac | 311 | if (p_spi_info->master) { |
tsungta | 0:b7415ae44dac | 312 | nrf_drv_spi_uninit(MASTER_INST(obj)); |
tsungta | 0:b7415ae44dac | 313 | } |
tsungta | 0:b7415ae44dac | 314 | else { |
tsungta | 0:b7415ae44dac | 315 | nrf_drv_spis_uninit(SLAVE_INST(obj)); |
tsungta | 0:b7415ae44dac | 316 | } |
tsungta | 0:b7415ae44dac | 317 | p_spi_info->initialized = false; |
tsungta | 0:b7415ae44dac | 318 | } |
tsungta | 0:b7415ae44dac | 319 | |
tsungta | 0:b7415ae44dac | 320 | int spi_busy_multibyte(spi_mb_t *obj) |
tsungta | 0:b7415ae44dac | 321 | { |
tsungta | 0:b7415ae44dac | 322 | return (int)(SPI_INFO(obj)->flag.busy); |
tsungta | 0:b7415ae44dac | 323 | } |
tsungta | 0:b7415ae44dac | 324 | |
tsungta | 0:b7415ae44dac | 325 | void spi_format_multibyte(spi_mb_t *obj, int bits, int mode, int slave) |
tsungta | 0:b7415ae44dac | 326 | { |
tsungta | 0:b7415ae44dac | 327 | if (bits != 8) { |
tsungta | 0:b7415ae44dac | 328 | error("Only 8-bits SPI is supported\r\n"); |
tsungta | 0:b7415ae44dac | 329 | } |
tsungta | 0:b7415ae44dac | 330 | if (mode > 3) { |
tsungta | 0:b7415ae44dac | 331 | error("SPI format error\r\n"); |
tsungta | 0:b7415ae44dac | 332 | } |
tsungta | 0:b7415ae44dac | 333 | |
tsungta | 0:b7415ae44dac | 334 | spi_info_t *p_spi_info = SPI_INFO(obj); |
tsungta | 0:b7415ae44dac | 335 | |
tsungta | 0:b7415ae44dac | 336 | if (slave) |
tsungta | 0:b7415ae44dac | 337 | { |
tsungta | 0:b7415ae44dac | 338 | nrf_drv_spis_mode_t spi_modes[4] = { |
tsungta | 0:b7415ae44dac | 339 | NRF_DRV_SPIS_MODE_0, |
tsungta | 0:b7415ae44dac | 340 | NRF_DRV_SPIS_MODE_1, |
tsungta | 0:b7415ae44dac | 341 | NRF_DRV_SPIS_MODE_2, |
tsungta | 0:b7415ae44dac | 342 | NRF_DRV_SPIS_MODE_3, |
tsungta | 0:b7415ae44dac | 343 | }; |
tsungta | 0:b7415ae44dac | 344 | nrf_drv_spis_mode_t new_mode = spi_modes[mode]; |
tsungta | 0:b7415ae44dac | 345 | |
tsungta | 0:b7415ae44dac | 346 | // If the peripheral is currently working as a master, the SDK driver |
tsungta | 0:b7415ae44dac | 347 | // it uses needs to be switched from SPI to SPIS. |
tsungta | 0:b7415ae44dac | 348 | if (p_spi_info->master) { |
tsungta | 0:b7415ae44dac | 349 | nrf_drv_spi_uninit(MASTER_INST(obj)); |
tsungta | 0:b7415ae44dac | 350 | } |
tsungta | 0:b7415ae44dac | 351 | // I the SPI mode has to be changed, the SDK's SPIS driver needs to be |
tsungta | 0:b7415ae44dac | 352 | // re-initialized (there is no other way to change its configuration). |
tsungta | 0:b7415ae44dac | 353 | else if (p_spi_info->spi_mode != (uint8_t)new_mode) { |
tsungta | 0:b7415ae44dac | 354 | nrf_drv_spis_uninit(SLAVE_INST(obj)); |
tsungta | 0:b7415ae44dac | 355 | } |
tsungta | 0:b7415ae44dac | 356 | else { |
tsungta | 0:b7415ae44dac | 357 | return; |
tsungta | 0:b7415ae44dac | 358 | } |
tsungta | 0:b7415ae44dac | 359 | |
tsungta | 0:b7415ae44dac | 360 | p_spi_info->spi_mode = (uint8_t)new_mode; |
tsungta | 0:b7415ae44dac | 361 | p_spi_info->master = false; |
tsungta | 0:b7415ae44dac | 362 | p_spi_info->flag.readable = false; |
tsungta | 0:b7415ae44dac | 363 | |
tsungta | 0:b7415ae44dac | 364 | // Initialize SDK's SPIS driver with the new configuration. |
tsungta | 0:b7415ae44dac | 365 | nrf_drv_spis_config_t config; |
tsungta | 0:b7415ae44dac | 366 | prepare_slave_config(&config, p_spi_info); |
tsungta | 0:b7415ae44dac | 367 | (void)nrf_drv_spis_init(SLAVE_INST(obj), &config, |
tsungta | 0:b7415ae44dac | 368 | m_slave_event_handlers[SPI_IDX(obj)]); |
tsungta | 0:b7415ae44dac | 369 | |
tsungta | 0:b7415ae44dac | 370 | // Prepare the slave for transfer. |
tsungta | 0:b7415ae44dac | 371 | //m_tx_buf = NRF_DRV_SPIS_DEFAULT_ORC; |
tsungta | 0:b7415ae44dac | 372 | nrf_drv_spis_buffers_set(SLAVE_INST(obj), |
tsungta | 0:b7415ae44dac | 373 | m_tx_buf, m_length, m_rx_buf, m_length); |
tsungta | 0:b7415ae44dac | 374 | } |
tsungta | 0:b7415ae44dac | 375 | else // master |
tsungta | 0:b7415ae44dac | 376 | { |
tsungta | 0:b7415ae44dac | 377 | nrf_drv_spi_mode_t spi_modes[4] = { |
tsungta | 0:b7415ae44dac | 378 | NRF_DRV_SPI_MODE_0, |
tsungta | 0:b7415ae44dac | 379 | NRF_DRV_SPI_MODE_1, |
tsungta | 0:b7415ae44dac | 380 | NRF_DRV_SPI_MODE_2, |
tsungta | 0:b7415ae44dac | 381 | NRF_DRV_SPI_MODE_3, |
tsungta | 0:b7415ae44dac | 382 | }; |
tsungta | 0:b7415ae44dac | 383 | nrf_drv_spi_mode_t new_mode = spi_modes[mode]; |
tsungta | 0:b7415ae44dac | 384 | |
tsungta | 0:b7415ae44dac | 385 | // If the peripheral is currently working as a slave, the SDK driver |
tsungta | 0:b7415ae44dac | 386 | // it uses needs to be switched from SPIS to SPI. |
tsungta | 0:b7415ae44dac | 387 | if (!p_spi_info->master) { |
tsungta | 0:b7415ae44dac | 388 | nrf_drv_spis_uninit(SLAVE_INST(obj)); |
tsungta | 0:b7415ae44dac | 389 | } |
tsungta | 0:b7415ae44dac | 390 | // I the SPI mode has to be changed, the SDK's SPI driver needs to be |
tsungta | 0:b7415ae44dac | 391 | // re-initialized (there is no other way to change its configuration). |
tsungta | 0:b7415ae44dac | 392 | else if (p_spi_info->spi_mode != (uint8_t)new_mode) { |
tsungta | 0:b7415ae44dac | 393 | nrf_drv_spi_uninit(MASTER_INST(obj)); |
tsungta | 0:b7415ae44dac | 394 | } |
tsungta | 0:b7415ae44dac | 395 | else { |
tsungta | 0:b7415ae44dac | 396 | return; |
tsungta | 0:b7415ae44dac | 397 | } |
tsungta | 0:b7415ae44dac | 398 | |
tsungta | 0:b7415ae44dac | 399 | p_spi_info->spi_mode = (uint8_t)new_mode; |
tsungta | 0:b7415ae44dac | 400 | p_spi_info->master = true; |
tsungta | 0:b7415ae44dac | 401 | p_spi_info->flag.busy = false; |
tsungta | 0:b7415ae44dac | 402 | |
tsungta | 0:b7415ae44dac | 403 | // Initialize SDK's SPI driver with the new configuration. |
tsungta | 0:b7415ae44dac | 404 | nrf_drv_spi_config_t config; |
tsungta | 0:b7415ae44dac | 405 | prepare_master_config(&config, p_spi_info); |
tsungta | 0:b7415ae44dac | 406 | (void)nrf_drv_spi_init(MASTER_INST(obj), &config, |
tsungta | 0:b7415ae44dac | 407 | m_master_event_handlers[SPI_IDX(obj)]); |
tsungta | 0:b7415ae44dac | 408 | } |
tsungta | 0:b7415ae44dac | 409 | } |
tsungta | 0:b7415ae44dac | 410 | |
tsungta | 0:b7415ae44dac | 411 | static nrf_drv_spi_frequency_t freq_translate(int hz) |
tsungta | 0:b7415ae44dac | 412 | { |
tsungta | 0:b7415ae44dac | 413 | nrf_drv_spi_frequency_t frequency; |
tsungta | 0:b7415ae44dac | 414 | if (hz<250000) { //125Kbps |
tsungta | 0:b7415ae44dac | 415 | frequency = NRF_DRV_SPI_FREQ_125K; |
tsungta | 0:b7415ae44dac | 416 | } else if (hz<500000) { //250Kbps |
tsungta | 0:b7415ae44dac | 417 | frequency = NRF_DRV_SPI_FREQ_250K; |
tsungta | 0:b7415ae44dac | 418 | } else if (hz<1000000) { //500Kbps |
tsungta | 0:b7415ae44dac | 419 | frequency = NRF_DRV_SPI_FREQ_500K; |
tsungta | 0:b7415ae44dac | 420 | } else if (hz<2000000) { //1Mbps |
tsungta | 0:b7415ae44dac | 421 | frequency = NRF_DRV_SPI_FREQ_1M; |
tsungta | 0:b7415ae44dac | 422 | } else if (hz<4000000) { //2Mbps |
tsungta | 0:b7415ae44dac | 423 | frequency = NRF_DRV_SPI_FREQ_2M; |
tsungta | 0:b7415ae44dac | 424 | } else if (hz<8000000) { //4Mbps |
tsungta | 0:b7415ae44dac | 425 | frequency = NRF_DRV_SPI_FREQ_4M; |
tsungta | 0:b7415ae44dac | 426 | } else { //8Mbps |
tsungta | 0:b7415ae44dac | 427 | frequency = NRF_DRV_SPI_FREQ_8M; |
tsungta | 0:b7415ae44dac | 428 | } |
tsungta | 0:b7415ae44dac | 429 | return frequency; |
tsungta | 0:b7415ae44dac | 430 | } |
tsungta | 0:b7415ae44dac | 431 | |
tsungta | 0:b7415ae44dac | 432 | void spi_frequency_multibyte(spi_mb_t *obj, int hz) |
tsungta | 0:b7415ae44dac | 433 | { |
tsungta | 0:b7415ae44dac | 434 | spi_info_t *p_spi_info = SPI_INFO(obj); |
tsungta | 0:b7415ae44dac | 435 | nrf_drv_spi_frequency_t new_frequency = freq_translate(hz); |
tsungta | 0:b7415ae44dac | 436 | |
tsungta | 0:b7415ae44dac | 437 | if (p_spi_info->master) |
tsungta | 0:b7415ae44dac | 438 | { |
tsungta | 0:b7415ae44dac | 439 | if (p_spi_info->frequency != new_frequency) { |
tsungta | 0:b7415ae44dac | 440 | p_spi_info->frequency = new_frequency; |
tsungta | 0:b7415ae44dac | 441 | |
tsungta | 0:b7415ae44dac | 442 | nrf_drv_spi_config_t config; |
tsungta | 0:b7415ae44dac | 443 | prepare_master_config(&config, p_spi_info); |
tsungta | 0:b7415ae44dac | 444 | |
tsungta | 0:b7415ae44dac | 445 | nrf_drv_spi_t const *p_spi = MASTER_INST(obj); |
tsungta | 0:b7415ae44dac | 446 | nrf_drv_spi_uninit(p_spi); |
tsungta | 0:b7415ae44dac | 447 | (void)nrf_drv_spi_init(p_spi, &config, |
tsungta | 0:b7415ae44dac | 448 | m_master_event_handlers[SPI_IDX(obj)]); |
tsungta | 0:b7415ae44dac | 449 | } |
tsungta | 0:b7415ae44dac | 450 | } |
tsungta | 0:b7415ae44dac | 451 | // There is no need to set anything in slaves when it comes to frequency, |
tsungta | 0:b7415ae44dac | 452 | // since slaves just synchronize with the clock provided by a master. |
tsungta | 0:b7415ae44dac | 453 | } |
tsungta | 0:b7415ae44dac | 454 | |
tsungta | 0:b7415ae44dac | 455 | int spi_master_write_multibyte(spi_mb_t *obj, int value) |
tsungta | 0:b7415ae44dac | 456 | { |
tsungta | 0:b7415ae44dac | 457 | spi_info_t *p_spi_info = SPI_INFO(obj); |
tsungta | 0:b7415ae44dac | 458 | |
tsungta | 0:b7415ae44dac | 459 | #if DEVICE_SPI_ASYNCH |
tsungta | 0:b7415ae44dac | 460 | while (p_spi_info->flag.busy) { |
tsungta | 0:b7415ae44dac | 461 | } |
tsungta | 0:b7415ae44dac | 462 | #endif |
tsungta | 0:b7415ae44dac | 463 | |
tsungta | 0:b7415ae44dac | 464 | //m_tx_buf = value; |
tsungta | 0:b7415ae44dac | 465 | p_spi_info->flag.busy = true; |
tsungta | 0:b7415ae44dac | 466 | (void)nrf_drv_spi_transfer(MASTER_INST(obj), |
tsungta | 0:b7415ae44dac | 467 | m_tx_buf, m_length, m_rx_buf, m_length); |
tsungta | 0:b7415ae44dac | 468 | while (p_spi_info->flag.busy) { |
tsungta | 0:b7415ae44dac | 469 | } |
tsungta | 0:b7415ae44dac | 470 | |
tsungta | 0:b7415ae44dac | 471 | return m_rx_buf; |
tsungta | 0:b7415ae44dac | 472 | } |
tsungta | 0:b7415ae44dac | 473 | |
tsungta | 2:c520d7c7739d | 474 | int spi_slave_receive_multibyte(spi_mb_t *obj, int bytes) |
tsungta | 0:b7415ae44dac | 475 | { |
tsungta | 2:c520d7c7739d | 476 | receive_bytes = bytes;//Tsungta |
tsungta | 0:b7415ae44dac | 477 | spi_info_t *p_spi_info = SPI_INFO(obj); |
tsungta | 0:b7415ae44dac | 478 | MBED_ASSERT(!p_spi_info->master); |
tsungta | 0:b7415ae44dac | 479 | return p_spi_info->flag.readable; |
tsungta | 0:b7415ae44dac | 480 | ; |
tsungta | 0:b7415ae44dac | 481 | } |
tsungta | 0:b7415ae44dac | 482 | |
tsungta | 0:b7415ae44dac | 483 | int spi_slave_read_multibyte(spi_mb_t *obj) |
tsungta | 0:b7415ae44dac | 484 | { |
tsungta | 0:b7415ae44dac | 485 | spi_info_t *p_spi_info = SPI_INFO(obj); |
tsungta | 0:b7415ae44dac | 486 | MBED_ASSERT(!p_spi_info->master); |
tsungta | 0:b7415ae44dac | 487 | while (!p_spi_info->flag.readable) { |
tsungta | 0:b7415ae44dac | 488 | } |
tsungta | 0:b7415ae44dac | 489 | p_spi_info->flag.readable = false; |
tsungta | 0:b7415ae44dac | 490 | return m_rx_buf; |
tsungta | 0:b7415ae44dac | 491 | } |
tsungta | 0:b7415ae44dac | 492 | |
tsungta | 2:c520d7c7739d | 493 | void spi_slave_write_multibyte(spi_mb_t *obj, uint8_t *value, int bytes) |
tsungta | 0:b7415ae44dac | 494 | { |
tsungta | 0:b7415ae44dac | 495 | spi_info_t *p_spi_info = SPI_INFO(obj); |
tsungta | 0:b7415ae44dac | 496 | MBED_ASSERT(!p_spi_info->master); |
tsungta | 0:b7415ae44dac | 497 | |
tsungta | 2:c520d7c7739d | 498 | // m_tx_buf = value;//Need TO FIX |
tsungta | 2:c520d7c7739d | 499 | // m_length = bytes;//Need TO FIX |
tsungta | 0:b7415ae44dac | 500 | } |
tsungta | 0:b7415ae44dac | 501 | |
tsungta | 0:b7415ae44dac | 502 | #if DEVICE_SPI_ASYNCH |
tsungta | 0:b7415ae44dac | 503 | |
tsungta | 0:b7415ae44dac | 504 | void spi_master_transfer_multibyte(spi_mb_t *obj, |
tsungta | 0:b7415ae44dac | 505 | const void *tx, size_t tx_length, |
tsungta | 0:b7415ae44dac | 506 | void *rx, size_t rx_length, uint8_t bit_width, |
tsungta | 0:b7415ae44dac | 507 | uint32_t handler, uint32_t event, DMAUsage hint) |
tsungta | 0:b7415ae44dac | 508 | { |
tsungta | 0:b7415ae44dac | 509 | spi_info_t *p_spi_info = SPI_INFO(obj); |
tsungta | 0:b7415ae44dac | 510 | MBED_ASSERT(p_spi_info->master); |
tsungta | 0:b7415ae44dac | 511 | (void)hint; |
tsungta | 0:b7415ae44dac | 512 | (void)bit_width; |
tsungta | 0:b7415ae44dac | 513 | |
tsungta | 0:b7415ae44dac | 514 | p_spi_info->handler = handler; |
tsungta | 0:b7415ae44dac | 515 | p_spi_info->event = event; |
tsungta | 0:b7415ae44dac | 516 | |
tsungta | 0:b7415ae44dac | 517 | p_spi_info->flag.busy = true; |
tsungta | 0:b7415ae44dac | 518 | (void)nrf_drv_spi_transfer(MASTER_INST(obj), |
tsungta | 0:b7415ae44dac | 519 | (uint8_t const *)tx, tx_length, |
tsungta | 0:b7415ae44dac | 520 | (uint8_t *)rx, rx_length); |
tsungta | 0:b7415ae44dac | 521 | } |
tsungta | 0:b7415ae44dac | 522 | |
tsungta | 0:b7415ae44dac | 523 | uint32_t spi_irq_handler_asynch_multibyte(spi_mb_t *obj) |
tsungta | 0:b7415ae44dac | 524 | { |
tsungta | 0:b7415ae44dac | 525 | spi_info_t *p_spi_info = SPI_INFO(obj); |
tsungta | 0:b7415ae44dac | 526 | MBED_ASSERT(p_spi_info->master); |
tsungta | 0:b7415ae44dac | 527 | return p_spi_info->event & SPI_EVENT_COMPLETE; |
tsungta | 0:b7415ae44dac | 528 | } |
tsungta | 0:b7415ae44dac | 529 | |
tsungta | 0:b7415ae44dac | 530 | uint8_t spi_active_multibyte(spi_mb_t *obj) |
tsungta | 0:b7415ae44dac | 531 | { |
tsungta | 0:b7415ae44dac | 532 | spi_info_t *p_spi_info = SPI_INFO(obj); |
tsungta | 0:b7415ae44dac | 533 | MBED_ASSERT(p_spi_info->master); |
tsungta | 0:b7415ae44dac | 534 | return p_spi_info->flag.busy; |
tsungta | 0:b7415ae44dac | 535 | } |
tsungta | 0:b7415ae44dac | 536 | |
tsungta | 0:b7415ae44dac | 537 | void spi_abort_asynch_multibyte(spi_mb_t *obj) |
tsungta | 0:b7415ae44dac | 538 | { |
tsungta | 0:b7415ae44dac | 539 | MBED_ASSERT(SPI_INFO(obj)->master); |
tsungta | 0:b7415ae44dac | 540 | nrf_drv_spi_abort(MASTER_INST(obj)); |
tsungta | 0:b7415ae44dac | 541 | } |
tsungta | 0:b7415ae44dac | 542 | |
tsungta | 0:b7415ae44dac | 543 | #endif // DEVICE_SPI_ASYNCH |
tsungta | 0:b7415ae44dac | 544 | |
tsungta | 0:b7415ae44dac | 545 | #endif // DEVICE_SPI |