 // Firmware for the CIWS Residential Datalogger
 // Arduino IDE ver. 1.8.8
 // Utah Water Research Lab
-// Updated: 6/10/2019 (changed to be compatible with Pololu LIS3MDL sensor board)
+// Updated: 7/30/2019 (Updated comments)
 // Daniel Henshaw and Josh Tracy
 // Note: F("String") keeps string literals in program memory and out of RAM. Saves RAM space. Very good. Don't remove the F. I know it looks funny. But don't do it. Really. The program might crash if you do. And then you'll have dishonor on yourself, dishonor on your cow, and you'll find out your cricket ain't lucky.
 // Note: Be sure to process resulting data file as ASCII characters, not Unicode. 

  pinMode(4, OUTPUT); // For debugging
  digitalWrite(4, LOW);

  mag_init(); //magnetometerInit(&mag);         // Initialize Magnetometer    // changed out to new function.  4/17/19 by D.H.
  

  rtcTransfer(reg_Tmr_CLKOUT_ctrl, WRITE, 0x3A);                  // Setup RTC Timer

*          Update the time
*          Construct a timestamp
*          Write data
*        If the Magnetometer interrupted:
*          Read the magnetometer data and check for peaks.
*      Repeat Loop
*      
* Interrupts:
*   1. INT0_ISR()
*      Magnetometer Data Ready signal. When magnetometer data is ready, set State.readMag
*
*   2. INT1_ISR()
*      RTC Four Second signal. When four seconds pass, set State.flag4
\*****************************************************************/

#include <SPI.h>
