Changeset - 006bbb89fd70
[Not reviewed]
default
0 3 0
mkroening@CL-ENS241-07.cedarville.edu - 12 years ago 2013-03-20 17:04:51
mkroening@CL-ENS241-07.cedarville.edu
Camera control
3 files changed with 25 insertions and 2 deletions:
0 comments (0 inline, 0 general)
slave/slave/lib/cameras.c
Show inline comments
 
@@ -19,24 +19,37 @@
 
 int8_t ymsb;	// Acceleration data in y-direction (MSB)
 
 int8_t zmsb;	// Acceleration data in z-direction (MSB)
 
 
 
 
 
 
 
 void cameras_readAccelXYZ()
 
 {
 
	 xmsb = i2c_read(ACCEL_ADDR, 0x01);
 
	 ymsb = i2c_read(ACCEL_ADDR, 0x03);
 
	 zmsb = i2c_read(ACCEL_ADDR, 0x05);
 
 }
 
 
 
 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;
 
 }
 
 
 
 int8_t cameras_getAccelY()
 
 {
 
	 return ymsb;
 
 }
 
 
 
 int8_t cameras_getAccelZ()
 
 {
slave/slave/lib/cameras.h
Show inline comments
 
@@ -2,18 +2,19 @@
 
 * cameras.h
 
 *
 
 * Created: 11/19/2012 9:25:36 PM
 
 *  Author: kripperger
 
 */ 
 
 
 
#ifndef CAMERAS_H_
 
#define CAMERAS_H_
 
 
 
void cameras_readAccelXYZ(void);	// Reads acceleration values
 
void cameras_sendPulse(void);
 
 
int8_t cameras_getAccelX(void);		// Returns x-acceleration
 
int8_t cameras_getAccelY(void);		// Returns y-acceleration
 
int8_t cameras_getAccelZ(void);		// Returns z-acceleration
 
 
#endif /* CAMERAS_H_ */
 
\ No newline at end of file
slave/slave/modules.c
Show inline comments
 
@@ -97,25 +97,28 @@
 
	ASSR &= ~(1 << EXCLK);	// Disable external clock input (enabling crystal use)
 
	ASSR |= (1 << AS2);		// Enable timer2 async mode with an external crystal	
 
	_delay_ms(250);			// Let external 32KHz crystal stabilize
 
	TCCR2B = 0x05;			// Set the prescaler to 128: 32.768kHz / 128 = 1Hz overflow
 
	TIFR2 = 0x01;			// Reset timer2 overflow interrupt flag
 
	TIMSK2 = 0x01;			// Enable interrupt on overflow
 
 }
 
  
 
  
 
  
 
 void modules_cameras_setup()
 
 {
 
	  	  
 
	 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
 
 }
 
  
 
 
 void modules_generic()
 
 {
 
	// Gathers data and performs functions for generic daughter board
 
	
 
 }
 
  
 
 void modules_sensors()
 
 {
 
	// Gathers data and performs functions for sensor daughter board
 
@@ -128,16 +131,22 @@
 
 }
 
  
 
 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
 
	int16_t pcount;
 
	if pcount == 1000
 
	{
 
	cameras_readAccelXYZ();
 
  
 
		cameras_sendPulse();
 
		pcount = 0;
 
 } 
 
	pcount	++;  
 
 } 
 
  
 
\ No newline at end of file
0 comments (0 inline, 0 general)