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

SerialComms.h

Committer:
sk398
Date:
2016-03-04
Revision:
10:55cb02b00338
Parent:
6:74b5ac7719f4
Child:
11:b5f4a9e69d96

File content as of revision 10:55cb02b00338:

/* #####################################################################
                            SerialComms.h
                            -------------
                
                          Surface Ship, Group 5
                          ---------------------
 
 Written by:        Steven Kay
 
 Date:              February 2016
 
 Function:          This 
 
 Version:           1.0
 
 Version History
 ---------------
 
 1.1                rgdfgdfgdfggdfgdg
 
 1.0                gdgddfdddgd
    
 ##################################################################### */

#ifndef SERIAL_COMMS_H
#define SERIAL_COMMS_H

#define SERIAL_BAUD_RATE 115200

#define TRUE 1
#define FALSE 0

#define MOTORS_FORWARD      0x09
#define MOTORS_BACKWARD     0x06
#define MOTORS_LEFT         0x05      
#define MOTORS_RIGHT        0x0A
#define MOTORS_ARM          0x01

#define MAGNET_ON           0x0D
#define MAGNET_OFF          0x0E

class SerialComms
{
    
public:   
    SerialComms(PinName tx,PinName rx);
    uint8_t getCommData();

private: 
    bool incomingDataUpdate;
    uint8_t receiverBuffer;
    
    void incomingDataISR();

protected:   
    RawSerial *_HLC_Conn;
    

   
};

#endif