 #include <Adafruit_LSM9DS0.h>
 #include "Adafruit_MPR121.h"
 
-/* This driver uses the Adafruit unified sensor library (Adafruit_Sensor),
-   which provides a common 'type' for sensor data and some helper functions.
-
-   To use this driver you will also need to download the Adafruit_Sensor
-   library and include it in your libraries folder.
-
-   You should also assign a unique ID to this sensor for use with
-   the Adafruit Sensor API so that you can identify this particular
-   sensor in any data logs, etc.  To assign a unique ID, simply
-   provide an appropriate value in the constructor below (12345
-   is used by default in this example).
-
-   Connections (For default I2C)
-   ===========
-   Connect SCL to analog 5
-   Connect SDA to analog 4
-   Connect VDD to 5V DC
-   Connect GROUND to common ground
-
-   History
-   =======
-   2014/JULY/25  - First version (KTOWN)
-*/
-
-/* Assign a unique base ID for this sensor */
-
-// 9DOF
-Adafruit_LSM9DS0 lsm = Adafruit_LSM9DS0(1005);  // Use I2C, ID #1000
 #define LSM9DS0_XM_CS 10
 #define LSM9DS0_GYRO_CS 9
 #define LSM9DS0_SCLK 13
 #define LSM9DS0_MISO 12
 #define LSM9DS0_MOSI 11
 
-float xNormal = -3.0;
-float yNormal = 1;
+// LSM9DS0, use I2C, ID #1005
+Adafruit_LSM9DS0 lsm = Adafruit_LSM9DS0(1005);
+
+// MPR121, use I2C, ID #1000 
+Adafruit_MPR121 cap = Adafruit_MPR121();
+
+float xNormal = -3.0,
+      yNormal = 1,
+      // Clamp inputs to this range (m/s^2)
+      accelMax =  20,
+      accelMin = -20,
+      // Map inputs to this range (pixels)
+      outMin   =  200,
+      outMax   = -200;
+
 float xRange[] = {0,0};
 float yRange[] = {0,0};
 
-// MPR121
-// You can have up to 4 on one i2c bus but one is enough for testing!
-Adafruit_MPR121 cap = Adafruit_MPR121();
-
 uint16_t lasttouched = 0;
 uint16_t currtouched = 0;
 
 // Configures the gain and integration time for the TSL2561
-
 void configureSensor(void) {
   // 1.) Set the accelerometer range
   //lsm.setupAccel(lsm.LSM9DS0_ACCELRANGE_2G);

}

float clamp(float value, float min_, float max_) {
  return (value < min_)? min_ : (value > max_)? max_ : value;
}

void displaySensorDetails(void) {

void dof_setup() {
  if(!lsm.begin()) { while(1); }

  // Setup the sensor gain and integration time
  configureSensor();
  
  // Set a max and min value to not do anything
  // calibrate(accel.acceleration.x, accel.acceleration.y);
  sensors_event_t accel, mag, gyro, temp;
  lsm.getEvent(&accel, &mag, &gyro, &temp);  
}
