# HG changeset patch # User mkroening@CL-ENS241-07.cedarville.edu # Date 2013-02-25 17:01:44 # Node ID 460153f9c03ffaf0c7de3ac14bf626a277aa954c # Parent 060b9e7d5676370b7bbf86fb9e9e8777ff576351 EEPROM attempt 1 diff --git a/slave/slave/lib/inputOutput.c b/slave/slave/lib/inputOutput.c --- a/slave/slave/lib/inputOutput.c +++ b/slave/slave/lib/inputOutput.c @@ -40,11 +40,7 @@ int8_t moduleID; // Slave Module ID from } - - - - - + void io_readModuleId() { // Get ID from rotary dip and return it. @@ -64,9 +60,10 @@ int8_t moduleID; // Slave Module ID from /* while(moduleID==0) { - moduleID = i2c_read(EEPROM_ADDR, 0x04); + moduleID = i2c_read(EEPROM_ADDR, 0x05); } */ + //moduleID = i2c_read(EEPROM_ADDR, 0x05); } diff --git a/slave/slave/slave.c b/slave/slave/slave.c --- a/slave/slave/slave.c +++ b/slave/slave/slave.c @@ -45,6 +45,10 @@ void micro_setup() int main(void) { + // 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 + + // Initialize micro_setup(); // Generic microcontroller config options time_setup(); // Setup loop timer and interrupts (TIMER0) @@ -77,6 +81,8 @@ int main(void) sensors_readBoardTemp(); // Read board temperature sensor (Common on all slaves) (Data Read) modules_run(io_getModuleId()); // Runs specific module functions (like data reading) + i2c_write(EEPROM_ADDR, 0x05, 0x01); + io_regulateTemp(); // Gets board temperature and enables heater if below threshold //snprintf(buff,128,"|ModuleID: %u |BoardTemp: %i |Millis: %lu |Lux: %lu |Pressure: %lu |Altitude: %lu |Battery: %u \r\n ",io_getModuleId(),sensors_getBoardTemp(),time_millis(),sensors_getLux(),sensors_getPressure(),sensors_getAltitude(),sensors_getBatt()); //DEBUG @@ -85,6 +91,7 @@ int main(void) _delay_ms(1); // Delay to prevent the sensor loop from running again before time_millis changes led_off(0); led_off(2); + led_output(i2c_read(EEPROM_ADDR, 0x05)); } }