Changeset - b0d10bd06ea7
[Not reviewed]
default
0 3 0
mkroening@CL-ENS241-07.cedarville.edu - 12 years ago 2013-04-03 16:53:51
mkroening@CL-ENS241-07.cedarville.edu
Camera fn in while1
3 files changed with 37 insertions and 16 deletions:
0 comments (0 inline, 0 general)
slave/slave/config.h
Show inline comments
 
@@ -20,27 +20,27 @@
 
 
// 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 77			// Temperature threshold in Fahrenheit where heater is activated
 
#define CAMERA_FREQ 10000		// Camera pulse frequency (Should be 30000 for 30 Secs)
 
#define CAMERA_PULSE 500			// Camera pulse duration
 
#define HEATER_THRESHOLD 0			// Temperature threshold in Fahrenheit where heater is activated
 
#define CAMERA_FREQ 5000		// Camera pulse frequency (Should be 30000 for 30 Secs)
 
#define CAMERA_PULSE 2500			// 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 0x27		// Read 0x28 - Write 0x27
 
 #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
 
 
 
slave/slave/modules.c
Show inline comments
 
@@ -142,30 +142,30 @@
 
 {
 
	// 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();
 
		
 
		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() - 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();
 
			}
 
		//	if ((time_millis() - lastPicture) > CAMERA_FREQ)	// Frequency of photos
 
		//	{
 
		//		cameras_sendPulse();
 
		//		lastPicture = time_millis();
 
		//	}
 
			
 
			pulseOn = time_millis();
 
		}
 
		//	pulseOn = time_millis();
 
		//}
 
		
 
 } 
 
  
 
\ No newline at end of file
slave/slave/slave.c
Show inline comments
 
@@ -28,24 +28,26 @@
 
#include "lib/led.h"
 
#include "lib/inputOutput.h"
 
#include "lib/i2c.h"
 
#include "lib/spi.h"
 
#include "lib/geiger.h"
 
#include "lib/sensors.h"
 
#include "lib/cameras.h"
 
#include "lib/loopTimer.h"
 
#include "lib/masterComm.h"
 
#include "lib/watchdog.h"
 

	
 
bool WDTreset = false;
 
 uint32_t lastPicture;
 
 uint8_t pulseOn;
 

	
 
void micro_setup()
 
{
 
	// Generic microcontroller config options
 
	WDTreset = ((MCUSR & 0b00001000) > 0);	// Check if WDT reset occured
 
	MCUSR = 0;		// Clear reset flags
 
	wdt_disable();	// Disable WDT
 
	_delay_ms(20);	// Power debounce
 
	sei();			// Enable interrupts
 
}
 

	
 

	
 
@@ -96,24 +98,43 @@ int main(void)
 

	
 
			snprintf(buff,128,"|ModuleID: %u |BoardTemp: %i |Millis: %lu |Lux: %lu |Press: %lu |Altitude: %lu |Batt: %u |Humidity: %u |spiTemp: %i \r\n ",io_getModuleId(),sensors_getBoardTemp(),time_millis(),sensors_getLux(),sensors_getPressure(),sensors_getAltitude(),sensors_getBatt(),sensors_getHumid(),sensors_getSpiTemp()); //DEBUG
 
			serial1_sendString(buff); //DEBUG
 
			
 
			led_off(0);
 
			lastLoop = time_millis();
 
			
 
// Writes ID to EEPROM, change for all modules and delete after programming
 
// 0 is for generic setup,	 1 is for sensors,	 2 is for Geiger,	3 is for cameras
 
//i2c_write(EEPROM_ADDR, 0x05, 0x03);			
 
			
 
		}
 
		
 
		if (io_getModuleId() == 3);
 
		{
 
			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();
 
			}
 
		}
 

	
 
    }
 
	
 
	return 0;
 
}
 

	
 

	
 

	
 

	
 

	
 
		/********Examples of data reading and getting******************
 
		x = geiger_getCpm();				//Data get
0 comments (0 inline, 0 general)