Damien Frost / SolarNanoGrid_Field

Fork of SolarNanoGridv3 by SONG Project

Revision:
11:87ab310924f0
Parent:
10:30c9e8df0032
Child:
13:de43f28c0365
--- a/SolarNanoGrid.h	Fri Jun 03 14:55:12 2016 +0000
+++ b/SolarNanoGrid.h	Wed Jun 08 22:12:52 2016 +0000
@@ -28,11 +28,14 @@
 #define SOLARNANOGRID_H
 #include <mbed.h>
 #include <pinmap.h>
+#include <RawSerial.h>
 #include "NRF2401P.h"
 #include "SDFileSystem.h"
 
 
 
+#define FUNCNAME "SNGC"
+#include "defs.h"
 
 /** \brief A library for the base of the solar nano grid controllers.
  *
@@ -49,8 +52,9 @@
     int chan;
     char dataRx[33];
     char dataTx[33];
+    Serial *pc;
 
-      DigitalOut *ledRed, *ledGreen, *ledBlue;
+    DigitalOut *ledRed, *ledGreen, *ledBlue;
 
     // *********************
     // * Public functions: *
@@ -62,14 +66,14 @@
      * Reads in config.ini and sets up the CommunityId, UserId, and the channel.
      */
 
-    SolarNanoGrid(FILE* fp);
+    SolarNanoGrid(FILE* fp, Serial *pc);
     /**
      * Asks the user for the time and sets the real time clock
      */
     void userSetRTCpc();
 
     // Main loop function:
-     void loop(void);
+    void loop(void);
 
     // spi pin assignments:
     /**
@@ -80,7 +84,7 @@
     /**
      * Turns SPI on for nrf
      */
-    void spiNrf(void);
+    void spiNRF(void);
 
 protected:
     // *********************
@@ -104,6 +108,16 @@
      */
     void nrfFlush();
 
+    /**
+     * Set NRF as RX and flush
+     */
+    void setAsRX(long long addr);
+
+    /**
+     * Sets NRF as TX and flushes the NRF
+     */
+    void  setAsTX(long long addr);
+
 private:
     // **********************
     // * Private variables: *
@@ -111,5 +125,4 @@
 
 };
 
-
 #endif  /* SOLARNANOGRID_H */