Changeset - f7fad1196562
[Not reviewed]
default
0 3 0
mkroening@CL-ENS241-07.cedarville.edu - 12 years ago 2013-03-21 16:56:16
mkroening@CL-ENS241-07.cedarville.edu
Camera functions
3 files changed with 21 insertions and 11 deletions:
0 comments (0 inline, 0 general)
slave/slave/lib/cameras.c
Show inline comments
 
@@ -31,17 +31,12 @@
 
 void cameras_sendPulse()
 
 {
 
	 PORTA |= (1 << PA0);	// Pull pin on usb high
 
	 PORTA |= (1 << PA1);	// Pull pin on usb high
 
	 PORTA |= (1 << PA2);	// Pull pin on usb high
 
	 PORTA |= (1 << PA3);	// Pull pin on usb high
 
	 _delay_ms(250);
 
	 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
 
 }
 
 
 
 int8_t cameras_getAccelX()
 
 {
 
	 return xmsb;
 
 }
slave/slave/modules.c
Show inline comments
 
@@ -12,14 +12,16 @@
 
 #include <util/delay.h>
 
 #include "modules.h"
 
 #include "lib/spi.h"
 
 #include "lib/i2c.h"
 
 #include "lib/sensors.h"
 
 #include "lib/loopTimer.h"
 
 #include "lib/led.h"
 
 
 
 uint32_t lastPicture;
 
 uint8_t pulseOn;
 
 
 
 void modules_setup(uint8_t id)
 
 {
 
	switch(id)
 
	{
 
		case 0:
 
@@ -106,12 +108,15 @@
 
 }
 
  
 
  
 
  
 
 void modules_cameras_setup()
 
 {
 
	 lastPicture = time_millis();
 
	 pulseOn = time_millis();	 
 
	 
 
	 DDRA |= (1 << DDA0);	// Set PA0 to Output for Camera
 
	 DDRA |= (1 << DDA1);	// Set PA1 to Output for Camera
 
	 DDRA |= (1 << DDA2);	// Set PA2 to Output for Camera
 
	 DDRA |= (1 << DDA3);	// Set PA3 to Output for Camera
 
 }
 
  
 
@@ -140,18 +145,27 @@
 
	  
 
 }
 
  
 
 void modules_cameras()
 
 {
 
	// Gathers data and performs functions for cameras daughter board
 
 
		
 
		cameras_readAccelXYZ();
 
		
 
		if ((time_millis() - lastPicture) > CAMERA_FREQ)	// Frequency of photos
 
		if ((time_millis() - pulseOn) > CAMERA_PULSE)
 
		{
 
			cameras_sendPulse();
 
			lastPicture = time_millis();
 
			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
slave/slave/slave.c
Show inline comments
 
@@ -84,12 +84,13 @@ int main(void)
 
		masterComm_checkParser();	//Checks parser for data requests from master
 

	
 
		// Main slave operations
 
		if ((time_millis() - lastLoop) > SENSOR_LOOP)	// Uses program timer to run every so often. Time interval defined in config.h
 
		{
 
			led_on(0);
 
			
 
			sensors_readBatt();				// Read Battery level
 
			sensors_readBoardTemp();		// Read board temperature sensor (Common on all slaves) (Data Read)
 
			modules_run(io_getModuleId());	// Runs specific module functions (like data reading)
 
			
 
			io_regulateTemp();			// Gets board temperature and enables heater if below threshold
 

	
0 comments (0 inline, 0 general)