UART Driver to receive asynchronous Serial Comms from a Raspberry Pi and parse the results.
SerialComms.h@4:85353bd571f2, 2016-02-20 (annotated)
- Committer:
- sk398
- Date:
- Sat Feb 20 13:26:51 2016 +0000
- Revision:
- 4:85353bd571f2
- Parent:
- 3:b608ee5b9b5d
- Child:
- 6:74b5ac7719f4
Asynch receiving works. No methods added for transmission of sensor data. Parser of data needs added into receiver to breakdown pointer.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sk398 | 0:8ac1280934b4 | 1 | #ifndef SERIAL_COMMS_H |
sk398 | 0:8ac1280934b4 | 2 | #define SERIAL_COMMS_H |
sk398 | 0:8ac1280934b4 | 3 | |
sk398 | 0:8ac1280934b4 | 4 | #define SERIAL_BAUD_RATE 115200 |
sk398 | 4:85353bd571f2 | 5 | #define NUM_BYTES_RECEIVING 5 |
sk398 | 0:8ac1280934b4 | 6 | |
sk398 | 0:8ac1280934b4 | 7 | #define TRUE 1 |
sk398 | 0:8ac1280934b4 | 8 | #define FALSE 0 |
sk398 | 0:8ac1280934b4 | 9 | |
sk398 | 0:8ac1280934b4 | 10 | |
sk398 | 0:8ac1280934b4 | 11 | |
sk398 | 0:8ac1280934b4 | 12 | class SerialComms |
sk398 | 0:8ac1280934b4 | 13 | { |
sk398 | 0:8ac1280934b4 | 14 | |
sk398 | 0:8ac1280934b4 | 15 | public: |
sk398 | 1:bf3fb80028d8 | 16 | SerialComms(PinName tx,PinName rx); |
sk398 | 4:85353bd571f2 | 17 | int *returnCommData(); |
sk398 | 0:8ac1280934b4 | 18 | |
sk398 | 2:cb74b330b285 | 19 | private: |
sk398 | 2:cb74b330b285 | 20 | void incomingDataISR(); |
sk398 | 2:cb74b330b285 | 21 | |
sk398 | 2:cb74b330b285 | 22 | protected: |
sk398 | 2:cb74b330b285 | 23 | int dataCheck; |
sk398 | 2:cb74b330b285 | 24 | bool incomingDataUpdate; |
sk398 | 0:8ac1280934b4 | 25 | int receiverBuffer[NUM_BYTES_RECEIVING]; |
sk398 | 3:b608ee5b9b5d | 26 | RawSerial *_HLC_Conn; |
sk398 | 0:8ac1280934b4 | 27 | |
sk398 | 0:8ac1280934b4 | 28 | |
sk398 | 0:8ac1280934b4 | 29 | |
sk398 | 0:8ac1280934b4 | 30 | }; |
sk398 | 0:8ac1280934b4 | 31 | |
sk398 | 0:8ac1280934b4 | 32 | #endif |