Changeset - e159e0fa6e70
[Not reviewed]
default
0 6 0
kripperger@CL-SEC241-09.cedarville.edu - 12 years ago 2013-04-29 19:40:00
kripperger@CL-SEC241-09.cedarville.edu
Added generic cases for daughterboard expansion
6 files changed with 123 insertions and 14 deletions:
0 comments (0 inline, 0 general)
slave/slave/config.h
Show inline comments
 
@@ -26,6 +26,9 @@
 
#define DATATYPES_SENSOR 8
 
#define DATATYPES_GEIGER 4
 
#define DATATYPES_CAMERA 3
 
#define DATATYPES_CUSTOM1 3		// Modules already automatically send 3 values (temp, batt, and heater status.)
 
#define DATATYPES_CUSTOM2 3		//    Additional sensor readings should be added onto the 3
 
#define DATATYPES_CUSTOM3 3		//    For example a daughterboard with two sensors would be 3+2=5
 
 
//Sensors and IO
 
#define SENSOR_LOOP 200				// Frequency of sensor reads (in ms) (should be 200)
slave/slave/lib/masterComm.c
Show inline comments
 
@@ -60,6 +60,21 @@ void masterComm_types()
 
			dataTypes = DATATYPES_CAMERA;
 
			break;
 
			
 
		case 4:
 
			// Custom Daughterboard 1
 
			dataTypes = DATATYPES_CUSTOM1;
 
			break;
 
			
 
		case 5:
 
			// Custom Daughterboard 2
 
			dataTypes = DATATYPES_CUSTOM2;
 
			break;
 
		
 
		case 6:
 
			// Custom Daughterboard 3
 
			dataTypes = DATATYPES_CUSTOM3;
 
			break;
 
			
 
		default:
 
			dataTypes = DATATYPES_GENERIC;
 
			break;
 
@@ -136,8 +151,23 @@ void masterComm_modules()
 
		case 3:
 
			// Camera
 
			
 
			break;
 
 
		case 4:
 
			// Custom Daughterboard 1
 
			
 
			break;
 
			break;			
 
 
		case 5:
 
			// Custom Daughterboard 2
 
			
 
			break;	
 
			
 
		case 6:
 
			// Custom Daughterboard 3
 
			
 
			break;	
 
		
 
		
 
		default:
 
			
slave/slave/lib/sensors.c
Show inline comments
 
@@ -31,7 +31,9 @@ uint16_t batt;		// Read battery voltage 
 
uint16_t vBatt;		// battery voltage
 
 
int8_t analogL;		// Low byte of ADC
 
int16_t analog;		// Read analog voltage from ADC
 
int16_t analog[8];		// Read analog voltage from ADC
 
 
uint8_t digital;	// Byte that contains the digital inputs from PORTA
 
 
int16_t ac1;		// The following 11 variables are the calibration values for the BMP085
 
int16_t ac2;
 
@@ -242,18 +244,21 @@ void sensors_readAnalog(uint8_t pin)
 
	ADMUX |= pin;
 
	
 
	analogL = ADCL;				// Read low battery byte from ADC (all 8 bits)
 
	analog = ADCH;				// Read high battery byte from ADC (only two LSBs)
 
	analog[pin] = ADCH;				// Read high battery byte from ADC (only two LSBs)
 
	
 
	analogL = ADCL;				// Second Read low battery byte from ADC (all 8 bits)
 
	analog = ADCH;				// Second Read high battery byte from ADC (only two LSBs)
 
	analog[pin] = ADCH;				// Second Read high battery byte from ADC (only two LSBs)
 
	
 
	analog = analog << 8;
 
	analog |= analogL;
 
	analog = (analog * 10.0) / 67.4;
 
	analog[pin] = analog[pin] << 8;
 
	analog[pin] |= analogL;
 
	analog[pin] = (analog[pin] * 10.0) / 67.4;
 
}
 
 
 
 
void sensors_readDigital(uint8_t pin)
 
{
 
	DDRA &= ~(1 << pin);		// Set pin to input
 
	digital = PINA;
 
}
 
 
 
int16_t sensors_getSpiTemp(void)	// Gets spi temperature from variable
 
@@ -286,9 +291,14 @@ uint16_t sensors_getBatt(void)		// Gets 
 
	return vBatt;
 
}
 
 
int16_t sensors_getAnalog(void)		// Gets battery voltage from variable
 
int16_t sensors_getAnalog(uint8_t pin)		// Gets battery voltage from variable
 
{
 
	return analog;
 
	return analog[pin];
 
}
 
 
uint8_t sensors_getDigital(uint8_t pin)		// Gets battery voltage from variable
 
{
 
	return ((digital >> pin) & 1);
 
}
 
 
uint32_t sensors_getAltitude(void)
slave/slave/lib/sensors.h
Show inline comments
 
@@ -18,6 +18,7 @@ void sensors_readHumid(void);		// Reads 
 
void sensors_readLux(void);			// Reads lux
 
void sensors_readBatt(void);		// Reads battery voltage from ADC
 
void sensors_readAnalog(uint8_t pin);	// Reads generic analog voltage from ADC
 
void sensors_readDigital(uint8_t pin);	// Reads generic analog voltage from ADC
 
 
int16_t sensors_getSpiTemp(void);	// Gets spi temperature from variable
 
int8_t sensors_getBoardTemp(void);	// Gets board temperature from variable
 
@@ -25,7 +26,8 @@ int32_t sensors_getPressure(void);	// Ge
 
uint16_t sensors_getHumid(void);	// Gets humidity from variable
 
uint32_t sensors_getLux(void);		// Gets lux from variable
 
uint16_t sensors_getBatt(void);		// Gets battery voltage from variable
 
int16_t sensors_getAnalog(void);		// Gets battery voltage from variable
 
uint32_t sensors_getAltitude(void);	// Gets altitude from variable
 
int16_t sensors_getAnalog(uint8_t pin);		// Gets battery voltage from variable
 
uint8_t sensors_getDigital(uint8_t pin);		// Gets battery voltage from variable
 
 
#endif /* SENSORS_H_ */
 
\ No newline at end of file
slave/slave/modules.c
Show inline comments
 
@@ -41,6 +41,18 @@
 
			modules_cameras_setup();
 
			break;
 
			
 
		case 4:
 
			modules_custom1_setup();
 
			break;
 
		
 
		case 5:
 
			modules_custom2_setup();
 
			break;
 
			
 
		case 6:
 
			modules_custom3_setup();
 
			break;
 
			
 
		default:
 
			modules_generic_setup();
 
			break;
 
@@ -67,7 +79,19 @@
 
		case 3:
 
			modules_cameras();
 
			break;
 
		  
 
			
 
		case 4:
 
			modules_custom1();
 
			break;
 
		
 
		case 5:
 
			modules_custom2();
 
			break;
 
		
 
		case 6:
 
			modules_custom3();
 
			break;
 
			  
 
		default:
 
			modules_generic();
 
			break;
 
@@ -123,6 +147,26 @@
 
 }
 
  
 
 
 void modules_custom1_setup()
 
 {
 
	 
 
 }
 
 
 void modules_custom2_setup()
 
 {
 
	 
 
 }
 
 
 void modules_custom3_setup()
 
 {
 
	 
 
 }
 
 
 
 
 
 
 
 void modules_generic()
 
 {
 
	// Gathers data and performs functions for generic daughter board
 
@@ -182,4 +226,18 @@
 
			PORTA &= ~(1 << PA3);	// Pull pin on usb low
 
		}		
 
 } 
 
  
 
\ No newline at end of file
 
  
 
  void modules_custom1()
 
  {
 
	   
 
  }
 
 
  void modules_custom2()
 
  {
 
   
 
  }
 
 
  void modules_custom3()
 
  {
 
   
 
  }
 
\ No newline at end of file
slave/slave/modules.h
Show inline comments
 
@@ -17,12 +17,18 @@
 
 void modules_sensors_setup();
 
 void modules_geiger_setup();
 
 void modules_cameras_setup();
 
 void modules_custom1_setup();
 
 void modules_custom2_setup();
 
 void modules_custom3_setup();
 
 
 // Data acquisition for specific daughter board
 
 void modules_generic();
 
 void modules_sensors();
 
 void modules_geiger();
 
 void modules_cameras();
 
 void modules_custom1();
 
 void modules_custom2();
 
 void modules_custom3();
 
 
 
#endif /* MODULES_H_ */
 
\ No newline at end of file
0 comments (0 inline, 0 general)