V148

Fork of RadioHead-148 by David Rimer

Committer:
davidr99
Date:
Thu Oct 15 01:27:00 2015 +0000
Revision:
0:ab4e012489ef
Child:
1:b7641da2b203
Messy start, but a port for RadioHead.; Currently the SPI modulus are the only ones that work.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
davidr99 0:ab4e012489ef 1 // RHHardwareSPI.h
davidr99 0:ab4e012489ef 2 // Author: Mike McCauley (mikem@airspayce.com)
davidr99 0:ab4e012489ef 3 // Copyright (C) 2011 Mike McCauley
davidr99 0:ab4e012489ef 4 // Contributed by Joanna Rutkowska
davidr99 0:ab4e012489ef 5 // $Id: RHHardwareSPI.cpp,v 1.12 2015/07/01 00:46:05 mikem Exp $
davidr99 0:ab4e012489ef 6
davidr99 0:ab4e012489ef 7 #include <RHHardwareSPI.h>
davidr99 0:ab4e012489ef 8
davidr99 0:ab4e012489ef 9 // Declare a single default instance of the hardware SPI interface class
davidr99 0:ab4e012489ef 10 RHHardwareSPI hardware_spi;
davidr99 0:ab4e012489ef 11
davidr99 0:ab4e012489ef 12 #ifdef RH_HAVE_HARDWARE_SPI
davidr99 0:ab4e012489ef 13
davidr99 0:ab4e012489ef 14 #if (RH_PLATFORM == RH_PLATFORM_STM32) // Maple etc
davidr99 0:ab4e012489ef 15 // Declare an SPI interface to use
davidr99 0:ab4e012489ef 16 HardwareSPI _SPI(1);
davidr99 0:ab4e012489ef 17 #elif (RH_PLATFORM == RH_PLATFORM_STM32STD) // STM32F4 Discovery
davidr99 0:ab4e012489ef 18 // Declare an SPI interface to use
davidr99 0:ab4e012489ef 19 HardwareSPI _SPI(1);
davidr99 0:ab4e012489ef 20 #elif (RH_PLATFORM == RH_PLATFORM_MBED) // MBed
davidr99 0:ab4e012489ef 21 // Declare an SPI interface to use
davidr99 0:ab4e012489ef 22 #define SPI_MOSI PB_15
davidr99 0:ab4e012489ef 23 #define SPI_MISO PB_14
davidr99 0:ab4e012489ef 24 #define SPI_CLK PB_13
davidr99 0:ab4e012489ef 25
davidr99 0:ab4e012489ef 26 SPI _SPI(SPI_MOSI, SPI_MISO, SPI_CLK);
davidr99 0:ab4e012489ef 27
davidr99 0:ab4e012489ef 28 #define REVERSE_BITS(byte) (((reverse_lookup[(byte & 0x0F)]) << 4) + reverse_lookup[((byte & 0xF0) >> 4)])
davidr99 0:ab4e012489ef 29
davidr99 0:ab4e012489ef 30 static const uint8_t reverse_lookup[] = { 0, 8, 4, 12, 2, 10, 6, 14,1, 9, 5, 13,3, 11, 7, 15 };
davidr99 0:ab4e012489ef 31
davidr99 0:ab4e012489ef 32 #endif
davidr99 0:ab4e012489ef 33
davidr99 0:ab4e012489ef 34 // Arduino Due has default SPI pins on central SPI headers, and not on 10, 11, 12, 13
davidr99 0:ab4e012489ef 35 // as per otherArduinos
davidr99 0:ab4e012489ef 36 // http://21stdigitalhome.blogspot.com.au/2013/02/arduino-due-hardware-SPI.html
davidr99 0:ab4e012489ef 37 #if defined (__arm__) && !defined(CORE_TEENSY)
davidr99 0:ab4e012489ef 38 // Arduino Due in 1.5.5 has no definitions for SPI dividers
davidr99 0:ab4e012489ef 39 // SPI clock divider is based on MCK of 84MHz
davidr99 0:ab4e012489ef 40 #define SPI_CLOCK_DIV16 (VARIANT_MCK/84000000) // 1MHz
davidr99 0:ab4e012489ef 41 #define SPI_CLOCK_DIV8 (VARIANT_MCK/42000000) // 2MHz
davidr99 0:ab4e012489ef 42 #define SPI_CLOCK_DIV4 (VARIANT_MCK/21000000) // 4MHz
davidr99 0:ab4e012489ef 43 #define SPI_CLOCK_DIV2 (VARIANT_MCK/10500000) // 8MHz
davidr99 0:ab4e012489ef 44 #define SPI_CLOCK_DIV1 (VARIANT_MCK/5250000) // 16MHz
davidr99 0:ab4e012489ef 45 #endif
davidr99 0:ab4e012489ef 46
davidr99 0:ab4e012489ef 47 RHHardwareSPI::RHHardwareSPI(Frequency frequency, BitOrder bitOrder, DataMode dataMode)
davidr99 0:ab4e012489ef 48 :
davidr99 0:ab4e012489ef 49 RHGenericSPI(frequency, bitOrder, dataMode)
davidr99 0:ab4e012489ef 50 {
davidr99 0:ab4e012489ef 51 }
davidr99 0:ab4e012489ef 52
davidr99 0:ab4e012489ef 53 uint8_t RHHardwareSPI::transfer(uint8_t data)
davidr99 0:ab4e012489ef 54 {
davidr99 0:ab4e012489ef 55 #if (RH_PLATFORM == RH_PLATFORM_MBED)
davidr99 0:ab4e012489ef 56 if (_bitOrder == BitOrderLSBFirst)
davidr99 0:ab4e012489ef 57 data = REVERSE_BITS(data);
davidr99 0:ab4e012489ef 58
davidr99 0:ab4e012489ef 59 return _SPI.write(data);
davidr99 0:ab4e012489ef 60 #else
davidr99 0:ab4e012489ef 61 return _SPI.transfer(data);
davidr99 0:ab4e012489ef 62 #endif
davidr99 0:ab4e012489ef 63 }
davidr99 0:ab4e012489ef 64
davidr99 0:ab4e012489ef 65 void RHHardwareSPI::attachInterrupt()
davidr99 0:ab4e012489ef 66 {
davidr99 0:ab4e012489ef 67 #if (RH_PLATFORM == RH_PLATFORM_ARDUINO)
davidr99 0:ab4e012489ef 68 _SPI.attachInterrupt();
davidr99 0:ab4e012489ef 69 #endif
davidr99 0:ab4e012489ef 70 }
davidr99 0:ab4e012489ef 71
davidr99 0:ab4e012489ef 72 void RHHardwareSPI::detachInterrupt()
davidr99 0:ab4e012489ef 73 {
davidr99 0:ab4e012489ef 74 #if (RH_PLATFORM == RH_PLATFORM_ARDUINO)
davidr99 0:ab4e012489ef 75 _SPI.detachInterrupt();
davidr99 0:ab4e012489ef 76 #endif
davidr99 0:ab4e012489ef 77 }
davidr99 0:ab4e012489ef 78
davidr99 0:ab4e012489ef 79 void RHHardwareSPI::begin()
davidr99 0:ab4e012489ef 80 {
davidr99 0:ab4e012489ef 81 // Sigh: there are no common symbols for some of these SPI options across all platforms
davidr99 0:ab4e012489ef 82 #if (RH_PLATFORM == RH_PLATFORM_ARDUINO) || (RH_PLATFORM == RH_PLATFORM_UNO32)
davidr99 0:ab4e012489ef 83 uint8_t dataMode;
davidr99 0:ab4e012489ef 84 if (_dataMode == DataMode0)
davidr99 0:ab4e012489ef 85 dataMode = SPI_MODE0;
davidr99 0:ab4e012489ef 86 else if (_dataMode == DataMode1)
davidr99 0:ab4e012489ef 87 dataMode = SPI_MODE1;
davidr99 0:ab4e012489ef 88 else if (_dataMode == DataMode2)
davidr99 0:ab4e012489ef 89 dataMode = SPI_MODE2;
davidr99 0:ab4e012489ef 90 else if (_dataMode == DataMode3)
davidr99 0:ab4e012489ef 91 dataMode = SPI_MODE3;
davidr99 0:ab4e012489ef 92 else
davidr99 0:ab4e012489ef 93 dataMode = SPI_MODE0;
davidr99 0:ab4e012489ef 94 #if (RH_PLATFORM == RH_PLATFORM_ARDUINO) && defined(__arm__) && defined(CORE_TEENSY)
davidr99 0:ab4e012489ef 95 // Temporary work-around due to problem where avr_emulation.h does not work properly for the setDataMode() cal
davidr99 0:ab4e012489ef 96 SPCR &= ~SPI_MODE_MASK;
davidr99 0:ab4e012489ef 97 #else
davidr99 0:ab4e012489ef 98 _SPI.setDataMode(dataMode);
davidr99 0:ab4e012489ef 99 #endif
davidr99 0:ab4e012489ef 100
davidr99 0:ab4e012489ef 101 #if (RH_PLATFORM == RH_PLATFORM_ARDUINO) && defined (__arm__) && !defined(CORE_TEENSY)
davidr99 0:ab4e012489ef 102 // Arduino Due in 1.5.5 has its own BitOrder :-(
davidr99 0:ab4e012489ef 103 ::BitOrder bitOrder;
davidr99 0:ab4e012489ef 104 #else
davidr99 0:ab4e012489ef 105 uint8_t bitOrder;
davidr99 0:ab4e012489ef 106 #endif
davidr99 0:ab4e012489ef 107 if (_bitOrder == BitOrderLSBFirst)
davidr99 0:ab4e012489ef 108 bitOrder = LSBFIRST;
davidr99 0:ab4e012489ef 109 else
davidr99 0:ab4e012489ef 110 bitOrder = MSBFIRST;
davidr99 0:ab4e012489ef 111 _SPI.setBitOrder(bitOrder);
davidr99 0:ab4e012489ef 112
davidr99 0:ab4e012489ef 113 uint8_t divider;
davidr99 0:ab4e012489ef 114 switch (_frequency)
davidr99 0:ab4e012489ef 115 {
davidr99 0:ab4e012489ef 116 case Frequency1MHz:
davidr99 0:ab4e012489ef 117 default:
davidr99 0:ab4e012489ef 118 #if F_CPU == 8000000
davidr99 0:ab4e012489ef 119 divider = SPI_CLOCK_DIV8;
davidr99 0:ab4e012489ef 120 #else
davidr99 0:ab4e012489ef 121 divider = SPI_CLOCK_DIV16;
davidr99 0:ab4e012489ef 122 #endif
davidr99 0:ab4e012489ef 123 break;
davidr99 0:ab4e012489ef 124
davidr99 0:ab4e012489ef 125 case Frequency2MHz:
davidr99 0:ab4e012489ef 126 #if F_CPU == 8000000
davidr99 0:ab4e012489ef 127 divider = SPI_CLOCK_DIV4;
davidr99 0:ab4e012489ef 128 #else
davidr99 0:ab4e012489ef 129 divider = SPI_CLOCK_DIV8;
davidr99 0:ab4e012489ef 130 #endif
davidr99 0:ab4e012489ef 131 break;
davidr99 0:ab4e012489ef 132
davidr99 0:ab4e012489ef 133 case Frequency4MHz:
davidr99 0:ab4e012489ef 134 #if F_CPU == 8000000
davidr99 0:ab4e012489ef 135 divider = SPI_CLOCK_DIV2;
davidr99 0:ab4e012489ef 136 #else
davidr99 0:ab4e012489ef 137 divider = SPI_CLOCK_DIV4;
davidr99 0:ab4e012489ef 138 #endif
davidr99 0:ab4e012489ef 139 break;
davidr99 0:ab4e012489ef 140
davidr99 0:ab4e012489ef 141 case Frequency8MHz:
davidr99 0:ab4e012489ef 142 divider = SPI_CLOCK_DIV2; // 4MHz on an 8MHz Arduino
davidr99 0:ab4e012489ef 143 break;
davidr99 0:ab4e012489ef 144
davidr99 0:ab4e012489ef 145 case Frequency16MHz:
davidr99 0:ab4e012489ef 146 divider = SPI_CLOCK_DIV2; // Not really 16MHz, only 8MHz. 4MHz on an 8MHz Arduino
davidr99 0:ab4e012489ef 147 break;
davidr99 0:ab4e012489ef 148
davidr99 0:ab4e012489ef 149 }
davidr99 0:ab4e012489ef 150 _SPI.setClockDivider(divider);
davidr99 0:ab4e012489ef 151 _SPI.begin();
davidr99 0:ab4e012489ef 152
davidr99 0:ab4e012489ef 153 #elif (RH_PLATFORM == RH_PLATFORM_STM32) // Maple etc
davidr99 0:ab4e012489ef 154 spi_mode dataMode;
davidr99 0:ab4e012489ef 155 // Hmmm, if we do this as a switch, GCC on maple gets v confused!
davidr99 0:ab4e012489ef 156 if (_dataMode == DataMode0)
davidr99 0:ab4e012489ef 157 dataMode = SPI_MODE_0;
davidr99 0:ab4e012489ef 158 else if (_dataMode == DataMode1)
davidr99 0:ab4e012489ef 159 dataMode = SPI_MODE_1;
davidr99 0:ab4e012489ef 160 else if (_dataMode == DataMode2)
davidr99 0:ab4e012489ef 161 dataMode = SPI_MODE_2;
davidr99 0:ab4e012489ef 162 else if (_dataMode == DataMode3)
davidr99 0:ab4e012489ef 163 dataMode = SPI_MODE_3;
davidr99 0:ab4e012489ef 164 else
davidr99 0:ab4e012489ef 165 dataMode = SPI_MODE_0;
davidr99 0:ab4e012489ef 166
davidr99 0:ab4e012489ef 167 uint32 bitOrder;
davidr99 0:ab4e012489ef 168 if (_bitOrder == BitOrderLSBFirst)
davidr99 0:ab4e012489ef 169 bitOrder = LSBFIRST;
davidr99 0:ab4e012489ef 170 else
davidr99 0:ab4e012489ef 171 bitOrder = MSBFIRST;
davidr99 0:ab4e012489ef 172
davidr99 0:ab4e012489ef 173 SPIFrequency frequency; // Yes, I know these are not exact equivalents.
davidr99 0:ab4e012489ef 174 switch (_frequency)
davidr99 0:ab4e012489ef 175 {
davidr99 0:ab4e012489ef 176 case Frequency1MHz:
davidr99 0:ab4e012489ef 177 default:
davidr99 0:ab4e012489ef 178 frequency = SPI_1_125MHZ;
davidr99 0:ab4e012489ef 179 break;
davidr99 0:ab4e012489ef 180
davidr99 0:ab4e012489ef 181 case Frequency2MHz:
davidr99 0:ab4e012489ef 182 frequency = SPI_2_25MHZ;
davidr99 0:ab4e012489ef 183 break;
davidr99 0:ab4e012489ef 184
davidr99 0:ab4e012489ef 185 case Frequency4MHz:
davidr99 0:ab4e012489ef 186 frequency = SPI_4_5MHZ;
davidr99 0:ab4e012489ef 187 break;
davidr99 0:ab4e012489ef 188
davidr99 0:ab4e012489ef 189 case Frequency8MHz:
davidr99 0:ab4e012489ef 190 frequency = SPI_9MHZ;
davidr99 0:ab4e012489ef 191 break;
davidr99 0:ab4e012489ef 192
davidr99 0:ab4e012489ef 193 case Frequency16MHz:
davidr99 0:ab4e012489ef 194 frequency = SPI_18MHZ;
davidr99 0:ab4e012489ef 195 break;
davidr99 0:ab4e012489ef 196
davidr99 0:ab4e012489ef 197 }
davidr99 0:ab4e012489ef 198 _SPI.begin(frequency, bitOrder, dataMode);
davidr99 0:ab4e012489ef 199
davidr99 0:ab4e012489ef 200 #elif (RH_PLATFORM == RH_PLATFORM_STM32STD) // STM32F4 discovery
davidr99 0:ab4e012489ef 201 uint8_t dataMode;
davidr99 0:ab4e012489ef 202 if (_dataMode == DataMode0)
davidr99 0:ab4e012489ef 203 dataMode = SPI_MODE0;
davidr99 0:ab4e012489ef 204 else if (_dataMode == DataMode1)
davidr99 0:ab4e012489ef 205 dataMode = SPI_MODE1;
davidr99 0:ab4e012489ef 206 else if (_dataMode == DataMode2)
davidr99 0:ab4e012489ef 207 dataMode = SPI_MODE2;
davidr99 0:ab4e012489ef 208 else if (_dataMode == DataMode3)
davidr99 0:ab4e012489ef 209 dataMode = SPI_MODE3;
davidr99 0:ab4e012489ef 210 else
davidr99 0:ab4e012489ef 211 dataMode = SPI_MODE0;
davidr99 0:ab4e012489ef 212
davidr99 0:ab4e012489ef 213 uint32_t bitOrder;
davidr99 0:ab4e012489ef 214 if (_bitOrder == BitOrderLSBFirst)
davidr99 0:ab4e012489ef 215 bitOrder = LSBFIRST;
davidr99 0:ab4e012489ef 216 else
davidr99 0:ab4e012489ef 217 bitOrder = MSBFIRST;
davidr99 0:ab4e012489ef 218
davidr99 0:ab4e012489ef 219 SPIFrequency frequency; // Yes, I know these are not exact equivalents.
davidr99 0:ab4e012489ef 220 switch (_frequency)
davidr99 0:ab4e012489ef 221 {
davidr99 0:ab4e012489ef 222 case Frequency1MHz:
davidr99 0:ab4e012489ef 223 default:
davidr99 0:ab4e012489ef 224 frequency = SPI_1_3125MHZ;
davidr99 0:ab4e012489ef 225 break;
davidr99 0:ab4e012489ef 226
davidr99 0:ab4e012489ef 227 case Frequency2MHz:
davidr99 0:ab4e012489ef 228 frequency = SPI_2_625MHZ;
davidr99 0:ab4e012489ef 229 break;
davidr99 0:ab4e012489ef 230
davidr99 0:ab4e012489ef 231 case Frequency4MHz:
davidr99 0:ab4e012489ef 232 frequency = SPI_5_25MHZ;
davidr99 0:ab4e012489ef 233 break;
davidr99 0:ab4e012489ef 234
davidr99 0:ab4e012489ef 235 case Frequency8MHz:
davidr99 0:ab4e012489ef 236 frequency = SPI_10_5MHZ;
davidr99 0:ab4e012489ef 237 break;
davidr99 0:ab4e012489ef 238
davidr99 0:ab4e012489ef 239 case Frequency16MHz:
davidr99 0:ab4e012489ef 240 frequency = SPI_21_0MHZ;
davidr99 0:ab4e012489ef 241 break;
davidr99 0:ab4e012489ef 242
davidr99 0:ab4e012489ef 243 }
davidr99 0:ab4e012489ef 244 _SPI.begin(frequency, bitOrder, dataMode);
davidr99 0:ab4e012489ef 245 #elif (RH_PLATFORM == RH_PLATFORM_RASPI) // Raspberry PI
davidr99 0:ab4e012489ef 246 uint8_t dataMode;
davidr99 0:ab4e012489ef 247 if (_dataMode == DataMode0)
davidr99 0:ab4e012489ef 248 dataMode = BCM2835_SPI_MODE0;
davidr99 0:ab4e012489ef 249 else if (_dataMode == DataMode1)
davidr99 0:ab4e012489ef 250 dataMode = BCM2835_SPI_MODE1;
davidr99 0:ab4e012489ef 251 else if (_dataMode == DataMode2)
davidr99 0:ab4e012489ef 252 dataMode = BCM2835_SPI_MODE2;
davidr99 0:ab4e012489ef 253 else if (_dataMode == DataMode3)
davidr99 0:ab4e012489ef 254 dataMode = BCM2835_SPI_MODE3;
davidr99 0:ab4e012489ef 255
davidr99 0:ab4e012489ef 256 uint8_t bitOrder;
davidr99 0:ab4e012489ef 257 if (_bitOrder == BitOrderLSBFirst)
davidr99 0:ab4e012489ef 258 bitOrder = BCM2835_SPI_BIT_ORDER_LSBFIRST;
davidr99 0:ab4e012489ef 259 else
davidr99 0:ab4e012489ef 260 bitOrder = BCM2835_SPI_BIT_ORDER_MSBFIRST;
davidr99 0:ab4e012489ef 261
davidr99 0:ab4e012489ef 262 uint32_t divider;
davidr99 0:ab4e012489ef 263 switch (_frequency)
davidr99 0:ab4e012489ef 264 {
davidr99 0:ab4e012489ef 265 case Frequency1MHz:
davidr99 0:ab4e012489ef 266 default:
davidr99 0:ab4e012489ef 267 divider = BCM2835_SPI_CLOCK_DIVIDER_256;
davidr99 0:ab4e012489ef 268 break;
davidr99 0:ab4e012489ef 269 case Frequency2MHz:
davidr99 0:ab4e012489ef 270 divider = BCM2835_SPI_CLOCK_DIVIDER_128;
davidr99 0:ab4e012489ef 271 break;
davidr99 0:ab4e012489ef 272 case Frequency4MHz:
davidr99 0:ab4e012489ef 273 divider = BCM2835_SPI_CLOCK_DIVIDER_64;
davidr99 0:ab4e012489ef 274 break;
davidr99 0:ab4e012489ef 275 case Frequency8MHz:
davidr99 0:ab4e012489ef 276 divider = BCM2835_SPI_CLOCK_DIVIDER_32;
davidr99 0:ab4e012489ef 277 break;
davidr99 0:ab4e012489ef 278 case Frequency16MHz:
davidr99 0:ab4e012489ef 279 divider = BCM2835_SPI_CLOCK_DIVIDER_16;
davidr99 0:ab4e012489ef 280 break;
davidr99 0:ab4e012489ef 281 }
davidr99 0:ab4e012489ef 282 _SPI.begin(divider, bitOrder, dataMode);
davidr99 0:ab4e012489ef 283 #elif (RH_PLATFORM == RH_PLATFORM_MBED) // MBed
davidr99 0:ab4e012489ef 284 uint8_t dataMode;
davidr99 0:ab4e012489ef 285 if (_dataMode == DataMode0)
davidr99 0:ab4e012489ef 286 dataMode = 0;
davidr99 0:ab4e012489ef 287 else if (_dataMode == DataMode1)
davidr99 0:ab4e012489ef 288 dataMode = 1;
davidr99 0:ab4e012489ef 289 else if (_dataMode == DataMode2)
davidr99 0:ab4e012489ef 290 dataMode = 2;
davidr99 0:ab4e012489ef 291 else if (_dataMode == DataMode3)
davidr99 0:ab4e012489ef 292 dataMode = 3;
davidr99 0:ab4e012489ef 293
davidr99 0:ab4e012489ef 294 _SPI.format(8, dataMode);
davidr99 0:ab4e012489ef 295
davidr99 0:ab4e012489ef 296 int frequency;
davidr99 0:ab4e012489ef 297 switch (_frequency)
davidr99 0:ab4e012489ef 298 {
davidr99 0:ab4e012489ef 299 case Frequency1MHz:
davidr99 0:ab4e012489ef 300 default:
davidr99 0:ab4e012489ef 301 frequency = 1000000;
davidr99 0:ab4e012489ef 302 break;
davidr99 0:ab4e012489ef 303
davidr99 0:ab4e012489ef 304 case Frequency2MHz:
davidr99 0:ab4e012489ef 305 frequency = 2000000;
davidr99 0:ab4e012489ef 306 break;
davidr99 0:ab4e012489ef 307
davidr99 0:ab4e012489ef 308 case Frequency4MHz:
davidr99 0:ab4e012489ef 309 frequency = 4000000;
davidr99 0:ab4e012489ef 310 break;
davidr99 0:ab4e012489ef 311
davidr99 0:ab4e012489ef 312 case Frequency8MHz:
davidr99 0:ab4e012489ef 313 frequency = 8000000;
davidr99 0:ab4e012489ef 314 break;
davidr99 0:ab4e012489ef 315
davidr99 0:ab4e012489ef 316 case Frequency16MHz:
davidr99 0:ab4e012489ef 317 frequency = 16000000;
davidr99 0:ab4e012489ef 318 break;
davidr99 0:ab4e012489ef 319 }
davidr99 0:ab4e012489ef 320 _SPI.frequency(frequency);
davidr99 0:ab4e012489ef 321 #else
davidr99 0:ab4e012489ef 322 #warning RHHardwareSPI does not support this platform yet. Consider adding it and contributing a patch.
davidr99 0:ab4e012489ef 323 #endif
davidr99 0:ab4e012489ef 324 }
davidr99 0:ab4e012489ef 325
davidr99 0:ab4e012489ef 326 void RHHardwareSPI::end()
davidr99 0:ab4e012489ef 327 {
davidr99 0:ab4e012489ef 328 #if (RH_PLATFORM == RH_PLATFORM_MBED)
davidr99 0:ab4e012489ef 329 // no end for SPI
davidr99 0:ab4e012489ef 330 #else
davidr99 0:ab4e012489ef 331 return _SPI.end();
davidr99 0:ab4e012489ef 332 #endif
davidr99 0:ab4e012489ef 333 }
davidr99 0:ab4e012489ef 334
davidr99 0:ab4e012489ef 335 #endif
davidr99 0:ab4e012489ef 336