Library for using the LSR SiFlex/ProFlex RF modules with mbed.

Files at this revision

API Documentation at this revision

Comitter:
Issus
Date:
Mon Jul 25 18:01:26 2016 +0000
Parent:
3:8d794c196710
Child:
5:ae864b96eb5f
Commit message:
Added method for setting RF data rate

Changed in this revision

LsrModule.cpp Show annotated file Show diff for this revision Revisions of this file
LsrModule.h Show annotated file Show diff for this revision Revisions of this file
--- a/LsrModule.cpp	Mon Jul 25 17:03:28 2016 +0000
+++ b/LsrModule.cpp	Mon Jul 25 18:01:26 2016 +0000
@@ -533,6 +533,31 @@
 
 
 /**
+* Sends message type 0x19 (Set RF Data Rate) to the module via UART communication.  This will spark an ACK message 
+* from the module to the Arduino of type 0x98.  Subscribing to 0x98 in your main application will allow you to parse 
+* the response data.  See the description for SubscribeRxMsgCallback for more information.
+*
+*/
+void LsrModule::SetRfDataRateMsg(uint8_t u8RfDataRate ///< Data rate for module to use when communicating via radio:
+                                 ///< 0 = 1,200 bits/s
+                                 ///< 1 = 2,400 bits/s
+                                 ///< 2 = 4,800 bits/s
+                                 ///< 3 = 9,600 bits/s
+                                 ///< 4 = 19,200 bits/s
+                                 ///< 5 = 38,400 bits/s
+                                 ///< 6 = 57,600 bits/s
+                                 ///< 7 = 115,200 bits/s
+                                     )
+{
+    if (u8RfDataRate <= LSR_MODULE_RF_DATA_RATE_MAX)
+    {
+        AddSerialMsgHeader(LSR_MODULE_SET_RF_DATA_RATE_MSG_TYPE, 6);
+        AddSerialByteToMsgBuffer(u8RfDataRate);
+        AddSerialMsgTrailer();
+    }
+}   /*** End SetRfDataRateMsg ***/
+
+/**
 * Sends message type 0x20 (Send Simple Short Address RF Data Packet) to the module via UART communication.
 * This will spark an ACK message from the module to the Arduino of type 0xA0.  Subscribing to 0xA0 in 
 * your main application will allow you to parse the response data.  See the description for SubscribeRxMsgCallback
--- a/LsrModule.h	Mon Jul 25 17:03:28 2016 +0000
+++ b/LsrModule.h	Mon Jul 25 18:01:26 2016 +0000
@@ -76,6 +76,7 @@
 #define LSR_MODULE_QUERY_STATISTICS_MSG_TYPE                            0x15
 #define LSR_MODULE_CLEAR_STATISTICS_MSG_TYPE                            0x16
 #define LSR_MODULE_SET_HOST_DATA_RATE_MSG_TYPE                          0x18
+#define LSR_MODULE_SET_RF_DATA_RATE_MSG_TYPE                            0x19
 #define LSR_MODULE_SEND_SIMPLE_SHORT_RF_DATA_PACKET_MSG_TYPE            0x20
 #define LSR_MODULE_SEND_ADVANCED_SHORT_RF_DATA_PACKET_MSG_TYPE          0x22
 #define LSR_MODULE_SEND_SIMPLE_LONG_RF_DATA_PACKET_MSG_TYPE             0x24
@@ -152,6 +153,15 @@
 #define LSR_MODULE_10MS_UART_TIMEOUT                                    239
 
 /**
+* RF Data Rate Definitions.
+*
+*/
+#define LSR_MODULE_RF_DATA_RATE_BPSK_40KBPS             0
+#define LSR_MODULE_RF_DATA_RATE_OQPSK_SIN_250KBPS       1
+#define LSR_MODULE_RF_DATA_RATE_OQPSK_SIN_1MBPS         2
+#define LSR_MODULE_RF_DATA_RATE_MAX                     LSP_MODULE_RF_DATA_RATE_OQPSK_SIN_1MBPS
+
+/**
 * Channel Energy Scan Duration Definitions.
 *
 */
@@ -241,6 +251,8 @@
     void ClearStatisticsMsg(void);
     // 0x18
     void SetHostDataRateMsg(uint8_t u8HostDataRate);
+    // 0x18
+    void SetRfDataRateMsg(uint8_t u8RfDataRate);
     // 0x20
     void SendSimpleShortAddrRfDataPacketMsg(uint8_t* pu8Data, uint8_t u8DataLength, uint16_t u16DestAddress, uint8_t u8TxOptions, uint8_t u8PacketId);
     // 0x22