CaryCoders / AS3935

Dependents:   zeus

Fork of AS3935 by valentin spanu

Revision:
12:ac6ba62a31c6
Parent:
11:ee2e7a573227
Child:
15:afbf7ba667e7
--- a/AS3935.cpp	Wed Jun 24 16:36:47 2015 +0000
+++ b/AS3935.cpp	Wed Jun 24 18:18:37 2015 +0000
@@ -222,7 +222,7 @@
     intrIn.rise(intrPulseCntr); 
     
     _SPITransfer2(0x3D, 0x96);                        // send command to calibrate the internal RC oscillators           
-    _SPITransfer2(8, 0x20);                           // put TRCO on the IRQ line for measurement   
+    registerWrite(AS3935_DISP_TRCO, 1);               // put TRCO on the IRQ line for measurement   
     wait_ms(20);                                      // wait for the chip to output the frequency, ususally ~2 ms 
     
     pulseTimer.reset(); 
@@ -234,13 +234,14 @@
     {
       timeNow = pulseTimer.read_ms(); 
     }
-    _SPITransfer2(8, 0);                              // stop the output of the frequncy on IRQ line       
+    
+    registerWrite(AS3935_DISP_TRCO, 0);               // stop the output of the frequncy on IRQ line       
     measFreq = sgIntrPulseCount << 1;                 // calculate the measure frequency based upon period of capture and freq scaler
 
     printf("timer RCO: %ld Hz\n\r", measFreq);
     
-    trco=registerRead(0x3A, 0x80);                      // Read out Calibration of TRCO done
-    srco=registerRead(0x3B, 0x80);                      // Readout Calibration of SRCO done
+    trco=registerRead(0x3A, 0x80);                    // Read out Calibration of TRCO done
+    srco=registerRead(0x3B, 0x80);                    // Readout Calibration of SRCO done
     if(trco != 0x00 && srco != 0x00)
     {
         rc = 1;
@@ -285,6 +286,7 @@
       {
         timeNow = pulseTimer.read_ms(); 
       }
+      
       _SPITransfer2(8, 0x00);                           // stop the output of the frequncy on IRQ line 
       
       measFreq = sgIntrPulseCount << 7;                 // calulate the measure frequency based upon period of capture and freq scaler