LLAP Library for Ciseco wireless products.

Dependents:   Ciseco_LLAP_Test Ciseco_SRF_Shield

Library for Ciseco wireless modules http://shop.ciseco.co.uk/rf-module-range/

Tested with Nucleo F401RE and http://shop.ciseco.co.uk/srf-shield-wireless-transciever-for-all-arduino-type-boards/

LLAPSerial.h

Committer:
SomeRandomBloke
Date:
2014-04-15
Revision:
1:8f3ec117823d
Parent:
0:c1b97c30cbc5
Child:
2:73b87761ce69

File content as of revision 1:8f3ec117823d:

/** LLAPSerial.h
 * 
 * The MIT License (MIT)
 * 
 * Copyright (c) 2014 Andrew Lindsay
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

#ifndef _LLAPSERIAL_h
#define _LLAPSERIAL_h

#include "mbed.h"

class LLAPSerial
{
 private:
    char cMessage[13];      // Raw receive buffer
    
    char* inPtr;
    void processMessage();
    void SerialEvent();
    Serial srf;
    
 public:
    LLAPSerial(PinName txPin, PinName rxPin, char *dID = "--" );

    void sendMessage(char* sToSend);
    void sendMessage(char* sToSend, char* valueToSend);
    void sendInt(char *sToSend, int value);
    void sendIntWithDP(char *sToSend, int value, int decimalPlaces);
    void setDeviceId(char* cId);
    
    char deviceId[2];
    char sMessage[15];      // Received message buffer
    bool bMsgReceived;
};

#endif