UART Driver to receive asynchronous Serial Comms from a Raspberry Pi and parse the results.
SerialComms.h@1:bf3fb80028d8, 2016-02-15 (annotated)
- Committer:
- sk398
- Date:
- Mon Feb 15 19:59:59 2016 +0000
- Revision:
- 1:bf3fb80028d8
- Parent:
- 0:8ac1280934b4
- Child:
- 2:cb74b330b285
changed to PinName constructer
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 | 0:8ac1280934b4 | 5 | #define NUM_BYTES_RECEIVING 4 |
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 | 0:8ac1280934b4 | 17 | int *returnMotorSpeeds(); |
sk398 | 0:8ac1280934b4 | 18 | |
sk398 | 0:8ac1280934b4 | 19 | private: |
sk398 | 0:8ac1280934b4 | 20 | bool dataUpdate; |
sk398 | 0:8ac1280934b4 | 21 | int receiverBuffer[NUM_BYTES_RECEIVING]; |
sk398 | 0:8ac1280934b4 | 22 | |
sk398 | 0:8ac1280934b4 | 23 | Serial *_HLC_Conn; |
sk398 | 0:8ac1280934b4 | 24 | |
sk398 | 0:8ac1280934b4 | 25 | void incoming(); |
sk398 | 0:8ac1280934b4 | 26 | |
sk398 | 0:8ac1280934b4 | 27 | protected: |
sk398 | 0:8ac1280934b4 | 28 | |
sk398 | 0:8ac1280934b4 | 29 | |
sk398 | 0:8ac1280934b4 | 30 | }; |
sk398 | 0:8ac1280934b4 | 31 | |
sk398 | 0:8ac1280934b4 | 32 | #endif |