# HG changeset patch # User mkroening@CL-ENS241-07.cedarville.edu # Date 2013-03-21 16:56:16 # Node ID f7fad1196562712e7e14d1688c22d6f24cf62288 # Parent 9b507ed828baa51a6ab498d64c9562540424189a Camera functions diff --git a/slave/slave/lib/cameras.c b/slave/slave/lib/cameras.c --- a/slave/slave/lib/cameras.c +++ b/slave/slave/lib/cameras.c @@ -34,11 +34,6 @@ 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() diff --git a/slave/slave/modules.c b/slave/slave/modules.c --- a/slave/slave/modules.c +++ b/slave/slave/modules.c @@ -15,8 +15,10 @@ #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) { @@ -109,6 +111,9 @@ 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 @@ -143,15 +148,24 @@ 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 diff --git a/slave/slave/slave.c b/slave/slave/slave.c --- a/slave/slave/slave.c +++ b/slave/slave/slave.c @@ -87,6 +87,7 @@ int main(void) 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)