Changeset - 7d5c2f8392e7
[Not reviewed]
default
0 2 0
mkroening@CL-ENS241-07.cedarville.edu - 12 years ago 2013-01-30 17:11:35
mkroening@CL-ENS241-07.cedarville.edu
Started writing pressure config
2 files changed with 45 insertions and 2 deletions:
0 comments (0 inline, 0 general)
slave/slave/lib/sensors.c
Show inline comments
 
@@ -48,27 +48,30 @@ void sensors_readSpiTemp()
 
	spiTemp = temperature;
 
}
 

	
 
void sensors_readBoardTemp()
 
{
 
	boardTemp = i2c_read(BOARDTEMP_ADDR, 0x00);		// Read only the first byte of data (we don't need the resolution here)
 
	boardTemp = ((boardTemp*18)/10) + (32);			// Converting Celsius to Fahrenheit
 
	boardTemp = boardTemp - 3;						// Linear offset
 
}
 

	
 
void sensors_readPressure()
 
{//needs editing
 
	//write 0x34 + (oss<<6) into 0xF4 (write is 0xEE), wait
 
	pressure = i2c_read(PRESSURE_ADDR, 0xF6);
 
	pressure = pressure << 8;
 
	pressure = pressure | i2c_read(PRESSURE_ADDR, 0xF7);
 
	//pressure = (MSB<<16 + LSB<<8 + XLSB(NOT USED)) >> (8-oss)
 
	//calculate true pressure with calibration data from modules.c, maybe write own function used here
 
}
 

	
 
void sensors_readHumid()
 
{
 
	//humid = i2c_read(HUMID_ADDR, 0xXX);
 
}
 

	
 
void sensors_readLight()
 
{
 
	light = i2c_read(LIGHT_ADDR, 0x03);
 
	// light = light << 4;
 
	// light = light | (0x0F & i2c_read(LIGHT_ADDR, 0x04));  //  This can be used to read in the 4 LSBs from the second register
slave/slave/modules.c
Show inline comments
 
@@ -69,24 +69,25 @@
 
 }
 
 
 
 
 
 void modules_generic_setup()
 
 {
 
	  
 
 }
 
  
 
 void modules_sensors_setup()
 
 {
 
	 DESELECT_TEMP;
 
	 setup_spi();
 
	//setup_pressure();
 
 }
 
  
 
 void modules_geiger_setup()
 
 {
 
	// Pin setup
 
	DDRA &= ~(1 << DDA0);	// PA0 is an input
 
	
 
	
 
	 
 
	// Setup for interrupt input on PA0 (PCINT0)
 
	PCMSK0 |= (1 << PCINT0);	// Enable interrupt for PA0
 
	PCICR |= (1 << PCIE0);		// Enable ioc section PCIF0
 
@@ -112,29 +113,68 @@
 
 
 void modules_generic()
 
 {
 
	// Gathers data and performs functions for generic daughter board
 
	
 
 }
 
  
 
 void modules_sensors()
 
 {
 
	// Gathers data and performs functions for sensor daughter board
 
	sensors_readBoardTemp();		//Data Read
 
	sensors_readSpiTemp();			//Data Read
 
 
	sensors_readPressure();			//Data Read
 
	sensors_readHumid();			//Data Read
 
	sensors_readLight();			//Data Read
 
	 
 
 }
 
  
 
 void modules_geiger()
 
 {
 
	// No data gatering function needed for geiger daughter board
 
		// This is taken care of in interrupt (See geiger.c)
 
	  
 
 }
 
  
 
 void modules_cameras()
 
 {
 
	// Gathers data and performs functions for cameras daughter board
 
  
 
 } 
 
  
 
\ No newline at end of file
 
  
 
  ///////////do I need to change .h file?
 
  void setup_pressure()
 
  {
 
	  int16_t ac1 = i2c_read(PRESSURE_ADDR, 0xAA);
 
	  ac1 = ac1 << 8;
 
	  ac1 = ac1 | i2c_read(PRESSURE_ADDR, 0xAB);
 
	  int16_t ac2 = i2c_read(PRESSURE_ADDR, 0xAC);
 
	  ac2 = ac2 << 8;
 
	  ac2 = ac2 | i2c_read(PRESSURE_ADDR, 0xAD);	  
 
	  int16_t ac3 = i2c_read(PRESSURE_ADDR, 0xAE);
 
	  ac3 = ac3 << 8;
 
	  ac3 = ac3 | i2c_read(PRESSURE_ADDR, 0xAF);
 
	  uint16_t ac4 = i2c_read(PRESSURE_ADDR, 0xB0);
 
	  ac4 = ac4 << 8;
 
	  ac4 = ac4 | i2c_read(PRESSURE_ADDR, 0xB1);
 
	  uint16_t ac5 = i2c_read(PRESSURE_ADDR, 0xB2);
 
	  ac5 = ac5 << 8;
 
	  ac5 = ac5 | i2c_read(PRESSURE_ADDR, 0xB3);
 
	  uint16_t ac6 = i2c_read(PRESSURE_ADDR, 0xB4);
 
	  ac6 = ac6 << 8;
 
	  ac6 = ac6 | i2c_read(PRESSURE_ADDR, 0xB5);
 
	  int16_t b1 = i2c_read(PRESSURE_ADDR, 0xB6);
 
	  b1 = b1 << 8;
 
	  b1 = b1 | i2c_read(PRESSURE_ADDR, 0xB7);
 
	  int16_t b2 = i2c_read(PRESSURE_ADDR, 0xB8);
 
	  b2 = b2 << 8;
 
	  b2 = b2 | i2c_read(PRESSURE_ADDR, 0xB9);
 
	  int16_t mb = i2c_read(PRESSURE_ADDR, 0xBA);
 
	  mb = mb << 8;
 
	  mb = mb | i2c_read(PRESSURE_ADDR, 0xBB);
 
	  int16_t mc = i2c_read(PRESSURE_ADDR, 0xBC);
 
	  mc = mc << 8;
 
	  mc = mc | i2c_read(PRESSURE_ADDR, 0xBD);
 
	  int16_t md = i2c_read(PRESSURE_ADDR, 0xBE);
 
	  md = md << 8;
 
	  md = md | i2c_read(PRESSURE_ADDR, 0xBF);
 
  }
 
\ No newline at end of file
0 comments (0 inline, 0 general)