afLib 1.3 which is supporting both SPI and UART
Dependencies: vt100 mbed afLib_1_3
af_utils/mbedUART.h@0:87662653a3c6, 2018-04-23 (annotated)
- Committer:
- Rhyme
- Date:
- Mon Apr 23 06:15:26 2018 +0000
- Revision:
- 0:87662653a3c6
First UART working version
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Rhyme | 0:87662653a3c6 | 1 | #ifndef _MBEDUART_H_ |
| Rhyme | 0:87662653a3c6 | 2 | #define _MBEDUART_H_ |
| Rhyme | 0:87662653a3c6 | 3 | #include "mbed.h" |
| Rhyme | 0:87662653a3c6 | 4 | #include "afTransport.h" |
| Rhyme | 0:87662653a3c6 | 5 | #include "edgeSerial.h" |
| Rhyme | 0:87662653a3c6 | 6 | |
| Rhyme | 0:87662653a3c6 | 7 | #define INT_CHAR 0x32 |
| Rhyme | 0:87662653a3c6 | 8 | |
| Rhyme | 0:87662653a3c6 | 9 | class mbedUART : public afTransport { |
| Rhyme | 0:87662653a3c6 | 10 | public: |
| Rhyme | 0:87662653a3c6 | 11 | mbedUART(PinName rxPin, PinName txPin, Serial *theLog) ; |
| Rhyme | 0:87662653a3c6 | 12 | ~mbedUART(void) ; |
| Rhyme | 0:87662653a3c6 | 13 | |
| Rhyme | 0:87662653a3c6 | 14 | virtual void checkForInterrupt(volatile int *interrupts_pending, bool idle); |
| Rhyme | 0:87662653a3c6 | 15 | virtual int exchangeStatus(StatusCommand *tx, StatusCommand *rx); |
| Rhyme | 0:87662653a3c6 | 16 | virtual int writeStatus(StatusCommand *c); |
| Rhyme | 0:87662653a3c6 | 17 | virtual void sendBytes(char *bytes, int len); |
| Rhyme | 0:87662653a3c6 | 18 | virtual void recvBytes(char *bytes, int len); |
| Rhyme | 0:87662653a3c6 | 19 | virtual void sendBytesOffset(char *bytes, uint16_t *bytesToSend, uint16_t *offset); |
| Rhyme | 0:87662653a3c6 | 20 | virtual void recvBytesOffset(char **bytes, uint16_t *bytesLen, uint16_t *bytesToRecv, uint16_t *offset); |
| Rhyme | 0:87662653a3c6 | 21 | // virtual void recvBytesOffset(char *bytes, uint16_t *bytesLen, uint16_t *bytesToRecv, uint16_t *offset); |
| Rhyme | 0:87662653a3c6 | 22 | private: |
| Rhyme | 0:87662653a3c6 | 23 | edgeSerial *_uart ; |
| Rhyme | 0:87662653a3c6 | 24 | // Serial *_uart ; |
| Rhyme | 0:87662653a3c6 | 25 | // Stream *_uart ; |
| Rhyme | 0:87662653a3c6 | 26 | Serial *_theLog ; |
| Rhyme | 0:87662653a3c6 | 27 | uint8_t *_buf ; |
| Rhyme | 0:87662653a3c6 | 28 | |
| Rhyme | 0:87662653a3c6 | 29 | int available(void); |
| Rhyme | 0:87662653a3c6 | 30 | char peek(void); |
| Rhyme | 0:87662653a3c6 | 31 | void read(uint8_t *buffer, int len); |
| Rhyme | 0:87662653a3c6 | 32 | char read(void); |
| Rhyme | 0:87662653a3c6 | 33 | void write(uint8_t *buffer, int len); |
| Rhyme | 0:87662653a3c6 | 34 | }; |
| Rhyme | 0:87662653a3c6 | 35 | #endif /* _MBEDUART_H_ */ |