Changeset - e9fb1e1bfee0
[Not reviewed]
default
0 3 0
mkroening@CL-ENS241-07.cedarville.edu - 12 years ago 2013-03-25 16:38:51
mkroening@CL-ENS241-07.cedarville.edu
Camera functions
3 files changed with 7 insertions and 7 deletions:
0 comments (0 inline, 0 general)
slave/slave/config.h
Show inline comments
 
@@ -9,39 +9,39 @@
 
 #ifndef CONFIG_H_
 
 #define CONFIG_H_
 
 
 #define F_CPU 11059200				// Clock frequency (used in calculations)
 
 
//Serial
 
#define USART0_BAUDRATE 115200
 
#define USART1_BAUDRATE 115200 
 
 
// Circular serial buffer size. Must be at least MAX_CMD_LEN + 5
 
#define BUFFER_SIZE 32
 
 
// Maximum payload size of command
 
#define MAX_PAYLOAD_LEN 16
 
 
// Number of datatypes to transmit per module type
 
#define DATATYPES_GENERIC 3
 
#define DATATYPES_SENSOR 8
 
#define DATATYPES_GEIGER 4
 
#define DATATYPES_CAMERA 3
 
 
//Sensors and IO
 
#define SENSOR_LOOP 200				// Frequency of sensor reads (in ms) (should be 200)
 
#define HEATER_THRESHOLD 0			// Temperature threshold in Fahrenheit where heater is activated
 
#define CAMERA_FREQ 30000		// Camera pulse frequency
 
#define CAMERA_PULSE 50			// Camera pulse duration
 
#define CAMERA_FREQ 10000		// Camera pulse frequency (Should be 30000 for 30 Secs)
 
#define CAMERA_PULSE 500			// Camera pulse duration
 
 
 //I2C Addresses
 
 #define EEPROM_ADDR 0xA0		// Read 0xA1 - Write 0xA0
 
 #define BOARDTEMP_ADDR 0x90	// Read 0x91 - Write 0x90
 
 #define PRESSURE_ADDR 0xEE		// Read 0xEF - Write 0xEE
 
 #define HUMID_ADDR 0x26		// Read 0x27 - Write 0x26
 
 #define LIGHT_ADDR 0x94		// Read 0x95 - Write 0x94
 
 #define ACCEL_ADDR	0x38		// Read 0x39 - Write 0x38
 
 #define RTC_ADDR 0xB2			//DEBUG [Used for testing]      // Read 0xA3 - Write 0xA2
 
 
 
 
 #endif /* CONFIG_H_ */
 
\ No newline at end of file
slave/slave/lib/inputOutput.c
Show inline comments
 
@@ -36,52 +36,52 @@ int8_t	moduleID;	// Slave Module ID from
 
	ADCSRB &= ~((1 << ADTS2) | (1 << ADTS1) | (1 << ADTS0));// Set ADC auto trigger source to free running mode
 
	ADCSRA |= (1 << ADEN);									// Enable ADC
 
	ADCSRA |= (1 << ADSC);									// Start ADC measurements.  ADC should now continuously run conversions, which are stored in ADCH 0x79
 
	
 
 }
 
 
 
  
 
 void io_readModuleId()
 
 {
 
	// Get ID from rotary dip and return it. 
 
	moduleID = 0;
 
	
 
	/*
 
	// This method is temporary as the next release will read the module ID from EEPROM
 
	PORTC |= (1 << PC2);	// Pull pins on rotary dip high
 
	PORTC |= (1 << PC3);	// Pull pins on rotary dip high
 
	PORTC |= (1 << PC4);	// Pull pins on rotary dip high
 
	PORTC |= (1 << PC5);	// Pull pins on rotary dip high
 
	
 
	moduleID = ((PINC & 0b00011100) >> 2);		// Read Dip Encoder
 
	moduleID = ~moduleID;						//Invert Dip reading
 
	moduleID = (moduleID & 0b0111);				//Mask bits
 
	*/
 
 
//	while(moduleID==0)           //UNCOMMENT ALL THIS
 
//	{
 
//		moduleID = i2c_read(EEPROM_ADDR, 0x05);
 
//	}
 
	while(moduleID==0)           //UNCOMMENT ALL THIS
 
	{
 
		moduleID = i2c_read(EEPROM_ADDR, 0x05);
 
	}
 
 }
 
 
 
 
 
 uint8_t io_getModuleId()
 
 {
 
	return moduleID;
 
 }
 
 
 
 
 
 void io_heaterOn()
 
 {		
 
	PORTB |= (1 << PB4);	//ON
 
 }
 
 
 
 void io_heaterOff()
 
 {
 
	PORTB &= ~(1 << PB4);	//OFF
 
 }
 
 
 
 uint8_t io_heaterStatus()
 
 {
 
	 uint8_t state;
 
	 state = 0;
 
	 
slave/slave/modules.c
Show inline comments
 
@@ -128,44 +128,44 @@
 
 }
 
  
 
 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_readLux();				//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
 
		
 
		cameras_readAccelXYZ();
 
		//cameras_readAccelXYZ();
 
		
 
		if ((time_millis() - pulseOn) > CAMERA_PULSE)
 
		{
 
			PORTA &= ~(1 << PA0);	// Pull pin on usb low
 
			PORTA &= ~(1 << PA1);	// Pull pin on usb low
 
			PORTA &= ~(1 << PA2);	// Pull pin on usb low
 
			PORTA &= ~(1 << PA3);	// Pull pin on usb low
 
			
 
			if ((time_millis() - lastPicture) > CAMERA_FREQ)	// Frequency of photos
 
			{
 
				cameras_sendPulse();
 
				lastPicture = time_millis();
 
			}
 
			
 
			pulseOn = time_millis();
 
		}
 
		
 
 } 
 
  
 
\ No newline at end of file
0 comments (0 inline, 0 general)