Group 3_ESE519 / Mbed 2 deprecated lab5-gateway

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mfrede
Date:
Tue Nov 17 19:13:55 2015 +0000
Parent:
5:85fea4ceaa1f
Commit message:
add rssi to header/cpp for MRF24J40

Changed in this revision

MRF24J40/MRF24J40.cpp Show annotated file Show diff for this revision Revisions of this file
MRF24J40/MRF24J40.h Show annotated file Show diff for this revision Revisions of this file
gateway.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/MRF24J40/MRF24J40.cpp	Wed Nov 11 00:47:05 2015 +0000
+++ b/MRF24J40/MRF24J40.cpp	Tue Nov 17 19:13:55 2015 +0000
@@ -165,16 +165,16 @@
   WriteShort(TXNMTRIG, 0x01);
 }
 
-uint8_t MRF24J40::Receive(uint8_t *data, uint8_t maxLength)
+uint8_t MRF24J40::Receive(uint8_t *data, uint8_t maxLength, uint8_t *rssi)
 {
   uint8_t i, length;
-  uint8_t lqi, rssi;
+  uint8_t lqi;
   
   if(ReadShort(ISRSTS)& 0x08)
   {
     length = ReadLong(0x300);
     lqi = ReadLong(0x301 + length);
-    rssi = ReadLong(0x302 + length);
+    *rssi = ReadLong(0x302 + length);
     for(i=0; i<length; i++)
       if(i<maxLength)
           *data++ = ReadLong(0x301 + (uint16_t)i);
--- a/MRF24J40/MRF24J40.h	Wed Nov 11 00:47:05 2015 +0000
+++ b/MRF24J40/MRF24J40.h	Tue Nov 17 19:13:55 2015 +0000
@@ -141,7 +141,7 @@
      * @param maxLength Maximum amount of data to be placed in the buffer.
      * @param returns The number of bytes written into the buffer.
      */
-    uint8_t Receive(uint8_t *data, uint8_t maxLength);  // Receive data if ready.
+    uint8_t Receive(uint8_t *data, uint8_t maxLength, uint8_t *rssi);  // Receive data if ready.
     
      /** Sets the channel of the MRF24J40
      *
--- a/gateway.cpp	Wed Nov 11 00:47:05 2015 +0000
+++ b/gateway.cpp	Tue Nov 17 19:13:55 2015 +0000
@@ -31,9 +31,9 @@
 * @param data A pointer to a char array to hold the data
 * @param maxLength The max amount of data to read.
 */
-int rf_receive(char *data, uint8_t maxLength)
+int rf_receive(char *data, uint8_t maxLength, uint8_t *rssi)
 {
-    uint8_t len = mrf.Receive((uint8_t *)data, maxLength);
+    uint8_t len = mrf.Receive((uint8_t *)data, maxLength,rssi);
     uint8_t header[8]= {1, 8, 0, 0xA1, 0xB2, 0xC3, 0xD4, 0x00};
 
     if(len > 10) {