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/

Files at this revision

API Documentation at this revision

Comitter:
SomeRandomBloke
Date:
Wed Apr 16 08:03:48 2014 +0000
Parent:
1:8f3ec117823d
Child:
3:08f5e8989688
Commit message:
Added more comments

Changed in this revision

LLAPSerial.cpp Show annotated file Show diff for this revision Revisions of this file
LLAPSerial.h Show annotated file Show diff for this revision Revisions of this file
--- a/LLAPSerial.cpp	Tue Apr 15 22:10:17 2014 +0000
+++ b/LLAPSerial.cpp	Wed Apr 16 08:03:48 2014 +0000
@@ -1,8 +1,14 @@
-/** LLAP Serial for use with Ciseco SRF/XRF wireless modules
+/** 
+ * LLAP Serial for use with Ciseco SRF/XRF wireless modules
+ *
+ * @author Andrew Lindsay
+ *
+ * @section DESCRIPTION
+ *
  * Wireless modules available at http://shop.ciseco.co.uk/rf-module-range/
  * Library developped with ST Micro Nucleo F401 and Ciseco SRF shield.
  * Sheild needs to be modified as Tx/Rx on pins 0 and 1 conflict with the USB debug port.
- * They need linking to Rx - PA_12, Tx - PA_11 on the outer row of pins. 
+ * They need joining to Rx - PA_12, Tx - PA_11 on the outer row of pins. 
  * See http://mbed.org/platforms/ST-Nucleo-F401RE/ for pinouts.
  *
  * This code is based on the Ciseco LLAPSerial library for Arduino at https://github.com/CisecoPlc/LLAPSerial but updated to
@@ -10,9 +16,11 @@
  *
  * Converted and updated by Andrew Lindsay @AndrewDLindsay April 2014
  * 
+ * @section LICENSE
+ *
  * The MIT License (MIT)
  * 
- * Copyright (c) 2014 Andrew Lindsay
+ * Copyright (c) 2014 Andrew Lindsay (andrew [at] thiseldo [dot] co [dot] uk)
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
--- a/LLAPSerial.h	Tue Apr 15 22:10:17 2014 +0000
+++ b/LLAPSerial.h	Wed Apr 16 08:03:48 2014 +0000
@@ -1,5 +1,8 @@
 /** LLAPSerial.h
+ * @author Andrew Lindsay
  * 
+ * @section LICENSE
+ *
  * The MIT License (MIT)
  * 
  * Copyright (c) 2014 Andrew Lindsay
@@ -28,27 +31,69 @@
 
 #include "mbed.h"
 
+/** LLAP Serial class for communicating with Ciseco wireless devices
+ *
+ */
 class LLAPSerial
 {
  private:
     char cMessage[13];      // Raw receive buffer
-    
     char* inPtr;
+    bool checkDevID = false;
     void processMessage();
     void SerialEvent();
     Serial srf;
     
  public:
-    LLAPSerial(PinName txPin, PinName rxPin, char *dID = "--" );
+     /** Default Constructor
+     * @param txPin Pin name for UART TX
+     * @param rxPin Pin name for UART RX
+     * @param checkNodeID Check the incoming Device ID and ignore if it doesnt match
+     * @param dID ID for device, used in sending messages and if checkNodeID is true then only messages for this ID are accepted
+     */
+    LLAPSerial(PinName txPin, PinName rxPin, bool checkDevID = false, char *dID = "--" );
 
+    /** Send a message
+    * @param sToSend Character pointer to message to send, will be padded with - to full length or truncated if too long
+    */
     void sendMessage(char* sToSend);
+
+    /** Send a message with a value. Both are concatenated in the message with padding - if needed
+    * @param sToSend Character pointer to message to send
+    * @param valueToSend The value to send as a series of characters
+    */
     void sendMessage(char* sToSend, char* valueToSend);
+
+    /** Send an integer
+    * @param sToSend Character pointer to message to send
+    * @param value The value to send as a series of characters, will be padded with - to full length or truncated if too long
+    */
     void sendInt(char *sToSend, int value);
+
+    /** Send integer message to specified decimal places
+    * @param sToSend Character pointer to message to send
+    * @param value The value to send as a series of characters, will be padded with - to full length or truncated if too long
+    * @param decimalPlaces The number of decimal places to use.
+    */
     void sendIntWithDP(char *sToSend, int value, int decimalPlaces);
+
+    /** Set device ID
+    * @param cId New device ID to set
+    */
     void setDeviceId(char* cId);
-    
+
+    // Public variables for message processing by main application (ideally should be getter functions)    
+
+    /** ID of this device
+    */
     char deviceId[2];
+
+    /** Received message buffer
+    */
     char sMessage[15];      // Received message buffer
+
+    /** Flag to indicate a new message has been received, must be cleared after message processed
+    */
     bool bMsgReceived;
 };