UART Driver to receive asynchronous Serial Comms from a Raspberry Pi and parse the results.

Committer:
sk398
Date:
Fri Mar 04 23:07:43 2016 +0000
Revision:
10:55cb02b00338
Parent:
6:74b5ac7719f4
Child:
11:b5f4a9e69d96
Beginnings of checking included into getCommData method.; ; Need to add in legal ballast commands

Who changed what in which revision?

UserRevisionLine numberNew 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 10:55cb02b00338 33 #define MOTORS_FORWARD 0x09
sk398 10:55cb02b00338 34 #define MOTORS_BACKWARD 0x06
sk398 10:55cb02b00338 35 #define MOTORS_LEFT 0x05
sk398 10:55cb02b00338 36 #define MOTORS_RIGHT 0x0A
sk398 10:55cb02b00338 37 #define MOTORS_ARM 0x01
sk398 10:55cb02b00338 38
sk398 10:55cb02b00338 39 #define MAGNET_ON 0x0D
sk398 10:55cb02b00338 40 #define MAGNET_OFF 0x0E
sk398 0:8ac1280934b4 41
sk398 0:8ac1280934b4 42 class SerialComms
sk398 0:8ac1280934b4 43 {
sk398 0:8ac1280934b4 44
sk398 0:8ac1280934b4 45 public:
sk398 1:bf3fb80028d8 46 SerialComms(PinName tx,PinName rx);
sk398 6:74b5ac7719f4 47 uint8_t getCommData();
sk398 0:8ac1280934b4 48
sk398 2:cb74b330b285 49 private:
sk398 6:74b5ac7719f4 50 bool incomingDataUpdate;
sk398 6:74b5ac7719f4 51 uint8_t receiverBuffer;
sk398 6:74b5ac7719f4 52
sk398 2:cb74b330b285 53 void incomingDataISR();
sk398 2:cb74b330b285 54
sk398 6:74b5ac7719f4 55 protected:
sk398 3:b608ee5b9b5d 56 RawSerial *_HLC_Conn;
sk398 0:8ac1280934b4 57
sk398 0:8ac1280934b4 58
sk398 0:8ac1280934b4 59
sk398 0:8ac1280934b4 60 };
sk398 0:8ac1280934b4 61
sk398 0:8ac1280934b4 62 #endif