General testings

Dependencies:   mbed

Fork of BEACON_CODE_NEW by Mohamed Azad

Files at this revision

API Documentation at this revision

Comitter:
shekhar
Date:
Thu Oct 22 04:43:42 2015 +0000
Parent:
14:4d1e378ec6e5
Child:
16:cc5fdb4a8436
Commit message:
Removed AFClimiter from set frequency() since it is used for receiver settings. Also changed datatype of frequency from float to double

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
tx.h Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Oct 07 04:35:16 2015 +0000
+++ b/main.cpp	Thu Oct 22 04:43:42 2015 +0000
@@ -245,23 +245,17 @@
     writereg(RF22_REG_08_OPERATING_MODE2,0x01);
     writereg(RF22_REG_08_OPERATING_MODE2,0x00);
 }
-int setFrequency(float centre,float afcPullInRange)
+int setFrequency(double centre)
 {
     //freq setting begins 
     uint8_t fbsel = 0x40;
-    uint8_t afclimiter;
     if (centre >= 480.0)
     {
         centre /= 2;
         fbsel |= 0x20;
-        afclimiter = afcPullInRange * 1000000.0 / 1250.0;
     }
     else
-    {
-        if (afcPullInRange < 0.0 || afcPullInRange > 0.159375)
-            return false;
-        afclimiter = afcPullInRange * 1000000.0 / 625.0;
-    }
+    return false;
     centre /= 10.0;
     float integerPart = floor(centre);
     float fractionalPart = centre - integerPart;
@@ -274,7 +268,6 @@
     writereg(RF22_REG_75_FREQUENCY_BAND_SELECT, fbsel);
     writereg(RF22_REG_76_NOMINAL_CARRIER_FREQUENCY1, fc >> 8);
     writereg(RF22_REG_77_NOMINAL_CARRIER_FREQUENCY0, fc & 0xff);
-    writereg(RF22_REG_2A_AFC_LIMITER, afclimiter);
     return 0;
 }
 
@@ -318,7 +311,7 @@
     // spiWrite(RF22_REG_05_INTERRUPT_ENABLE1, RF22_ENTXFFAEM |RF22_ENRXFFAFULL | RF22_ENPKSENT |RF22_ENPKVALID| RF22_ENCRCERROR);
     // spiWrite(RF22_REG_06_INTERRUPT_ENABLE2, RF22_ENPREAVAL);
 
-    setFrequency(435.0, 0.05);
+    setFrequency(435.0);
 
     //This may not be required
     if((readreg(RF22_REG_02_DEVICE_STATUS)& 0x08)!= 0x00)
--- a/tx.h	Wed Oct 07 04:35:16 2015 +0000
+++ b/tx.h	Thu Oct 22 04:43:42 2015 +0000
@@ -36,7 +36,7 @@
 void writereg(uint8_t reg,uint8_t val);
 uint8_t readreg(uint8_t reg);
 void clearTxBuf();
-int setFrequency(float,float);
+int setFrequency(double);
 bool Check_ACK_RECEIVED();
 
 #define RF22_MAX_MESSAGE_LEN 255