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

SerialComms.h

Committer:
sk398
Date:
2016-03-05
Revision:
11:b5f4a9e69d96
Parent:
10:55cb02b00338

File content as of revision 11:b5f4a9e69d96:

/* #####################################################################
                            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 MOTORS_OFF          0x00

#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