UART Driver to receive asynchronous Serial Comms from a Raspberry Pi and parse the results.
SerialComms.h@6:74b5ac7719f4, 2016-03-04 (annotated)
- Committer:
- sk398
- Date:
- Fri Mar 04 05:53:11 2016 +0000
- Revision:
- 6:74b5ac7719f4
- Parent:
- 4:85353bd571f2
- Child:
- 10:55cb02b00338
Rewritten to accept only a single character over SerialComms and return a single uint8_t. No parsing has been written and is to be handled by higher level code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sk398 | 6:74b5ac7719f4 | 1 | /* ##################################################################### |
sk398 | 6:74b5ac7719f4 | 2 | SerialComms.h |
sk398 | 6:74b5ac7719f4 | 3 | ------------- |
sk398 | 6:74b5ac7719f4 | 4 | |
sk398 | 6:74b5ac7719f4 | 5 | Surface Ship, Group 5 |
sk398 | 6:74b5ac7719f4 | 6 | --------------------- |
sk398 | 6:74b5ac7719f4 | 7 | |
sk398 | 6:74b5ac7719f4 | 8 | Written by: Steven Kay |
sk398 | 6:74b5ac7719f4 | 9 | |
sk398 | 6:74b5ac7719f4 | 10 | Date: February 2016 |
sk398 | 6:74b5ac7719f4 | 11 | |
sk398 | 6:74b5ac7719f4 | 12 | Function: This |
sk398 | 6:74b5ac7719f4 | 13 | |
sk398 | 6:74b5ac7719f4 | 14 | Version: 1.0 |
sk398 | 6:74b5ac7719f4 | 15 | |
sk398 | 6:74b5ac7719f4 | 16 | Version History |
sk398 | 6:74b5ac7719f4 | 17 | --------------- |
sk398 | 6:74b5ac7719f4 | 18 | |
sk398 | 6:74b5ac7719f4 | 19 | 1.1 rgdfgdfgdfggdfgdg |
sk398 | 6:74b5ac7719f4 | 20 | |
sk398 | 6:74b5ac7719f4 | 21 | 1.0 gdgddfdddgd |
sk398 | 6:74b5ac7719f4 | 22 | |
sk398 | 6:74b5ac7719f4 | 23 | ##################################################################### */ |
sk398 | 6:74b5ac7719f4 | 24 | |
sk398 | 0:8ac1280934b4 | 25 | #ifndef SERIAL_COMMS_H |
sk398 | 0:8ac1280934b4 | 26 | #define SERIAL_COMMS_H |
sk398 | 0:8ac1280934b4 | 27 | |
sk398 | 0:8ac1280934b4 | 28 | #define SERIAL_BAUD_RATE 115200 |
sk398 | 0:8ac1280934b4 | 29 | |
sk398 | 0:8ac1280934b4 | 30 | #define TRUE 1 |
sk398 | 0:8ac1280934b4 | 31 | #define FALSE 0 |
sk398 | 0:8ac1280934b4 | 32 | |
sk398 | 0:8ac1280934b4 | 33 | |
sk398 | 0:8ac1280934b4 | 34 | class SerialComms |
sk398 | 0:8ac1280934b4 | 35 | { |
sk398 | 0:8ac1280934b4 | 36 | |
sk398 | 0:8ac1280934b4 | 37 | public: |
sk398 | 1:bf3fb80028d8 | 38 | SerialComms(PinName tx,PinName rx); |
sk398 | 6:74b5ac7719f4 | 39 | uint8_t getCommData(); |
sk398 | 0:8ac1280934b4 | 40 | |
sk398 | 2:cb74b330b285 | 41 | private: |
sk398 | 6:74b5ac7719f4 | 42 | bool incomingDataUpdate; |
sk398 | 6:74b5ac7719f4 | 43 | uint8_t receiverBuffer; |
sk398 | 6:74b5ac7719f4 | 44 | |
sk398 | 2:cb74b330b285 | 45 | void incomingDataISR(); |
sk398 | 2:cb74b330b285 | 46 | |
sk398 | 6:74b5ac7719f4 | 47 | protected: |
sk398 | 3:b608ee5b9b5d | 48 | RawSerial *_HLC_Conn; |
sk398 | 0:8ac1280934b4 | 49 | |
sk398 | 0:8ac1280934b4 | 50 | |
sk398 | 0:8ac1280934b4 | 51 | |
sk398 | 0:8ac1280934b4 | 52 | }; |
sk398 | 0:8ac1280934b4 | 53 | |
sk398 | 0:8ac1280934b4 | 54 | #endif |