afLib 1.3 which is supporting both SPI and UART

Dependencies:   vt100 mbed afLib_1_3

Committer:
Rhyme
Date:
Mon Apr 23 06:15:26 2018 +0000
Revision:
0:87662653a3c6
First UART working version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 0:87662653a3c6 1 /**
Rhyme 0:87662653a3c6 2 * mbedSPI
Rhyme 0:87662653a3c6 3 *
Rhyme 0:87662653a3c6 4 * mbed spi class for afero afLib.
Rhyme 0:87662653a3c6 5 */
Rhyme 0:87662653a3c6 6 #ifndef _MBEDSPI_H_
Rhyme 0:87662653a3c6 7 #define _MBEDSPI_H_
Rhyme 0:87662653a3c6 8 #include "mbed.h"
Rhyme 0:87662653a3c6 9 #include "afSPI.h"
Rhyme 0:87662653a3c6 10 #include "StatusCommand.h"
Rhyme 0:87662653a3c6 11 #include "afTransport.h"
Rhyme 0:87662653a3c6 12
Rhyme 0:87662653a3c6 13 #define SPI_FRAME_LEN ((uint16_t)16)
Rhyme 0:87662653a3c6 14
Rhyme 0:87662653a3c6 15 class mbedSPI : public afTransport {
Rhyme 0:87662653a3c6 16 public:
Rhyme 0:87662653a3c6 17 mbedSPI(PinName mosi, PinName miso, PinName sckl, PinName cs) ;
Rhyme 0:87662653a3c6 18
Rhyme 0:87662653a3c6 19 virtual void checkForInterrupt(volatile int *interrupts_pending, bool idle);
Rhyme 0:87662653a3c6 20 virtual int exchangeStatus(StatusCommand *tx, StatusCommand *rx);
Rhyme 0:87662653a3c6 21 virtual int writeStatus(StatusCommand *c);
Rhyme 0:87662653a3c6 22 virtual void sendBytes(char *bytes, int len);
Rhyme 0:87662653a3c6 23 virtual void recvBytes(char *bytes, int len);
Rhyme 0:87662653a3c6 24 virtual void sendBytesOffset(char *bytes, uint16_t *bytesToSend, uint16_t *offset);
Rhyme 0:87662653a3c6 25 virtual void recvBytesOffset(char **bytes, uint16_t *bytesLen, uint16_t *bytesToRecv, uint16_t *offset);
Rhyme 0:87662653a3c6 26 // virtual void recvBytesOffset(char *bytes, uint16_t *bytesLen, uint16_t *bytesToRecv, uint16_t *offset);
Rhyme 0:87662653a3c6 27 private:
Rhyme 0:87662653a3c6 28 virtual void begin(void) ;
Rhyme 0:87662653a3c6 29 virtual void beginSPI(void) ;
Rhyme 0:87662653a3c6 30 virtual void endSPI(void) ;
Rhyme 0:87662653a3c6 31 virtual void transfer(char *bytes,int len) ;
Rhyme 0:87662653a3c6 32
Rhyme 0:87662653a3c6 33 SPI _spi ;
Rhyme 0:87662653a3c6 34 DigitalOut _cs ;
Rhyme 0:87662653a3c6 35 } ;
Rhyme 0:87662653a3c6 36
Rhyme 0:87662653a3c6 37
Rhyme 0:87662653a3c6 38 #endif /* _MBEDSPI_H_ */