Changeset - b882d646bb6d
[Not reviewed]
default
0 2 0
mkroening@CL-ENS241-07.cedarville.edu - 12 years ago 2013-02-27 16:30:53
mkroening@CL-ENS241-07.cedarville.edu
EEPROM work
2 files changed with 11 insertions and 10 deletions:
0 comments (0 inline, 0 general)
slave/slave/lib/inputOutput.c
Show inline comments
 
@@ -46,6 +46,7 @@ int8_t	moduleID;	// Slave Module ID from
 
	// Get ID from rotary dip and return it. 
 
	moduleID = 0;
 
	
 
	/*
 
	// This method is temporary as the next release will read the module ID from EEPROM
 
	PORTC |= (1 << PC2);	// Pull pins on rotary dip high
 
	PORTC |= (1 << PC3);	// Pull pins on rotary dip high
 
@@ -55,15 +56,16 @@ int8_t	moduleID;	// Slave Module ID from
 
	moduleID = ((PINC & 0b00011100) >> 2);		// Read Dip Encoder
 
	moduleID = ~moduleID;						//Invert Dip reading
 
	moduleID = (moduleID & 0b0111);				//Mask bits
 
 
	*/
 
 
/*
 
	/*
 
	while(moduleID==0)
 
	{
 
		moduleID = i2c_read(EEPROM_ADDR, 0x05);
 
	}
 
*/
 
 //moduleID = i2c_read(EEPROM_ADDR, 0x05);
 
	*/
 
	
 
	//moduleID = i2c_read(EEPROM_ADDR, 0x05);
 
 
 
 }
slave/slave/slave.c
Show inline comments
 
@@ -47,7 +47,7 @@ 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
 

	
 
	//i2c_write(EEPROM_ADDR, 0x05, 0x01);
 
		
 
	// Initialize		
 
	micro_setup();			// Generic microcontroller config options
 
@@ -81,17 +81,16 @@ 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
 
			//serial0_sendString(buff); //DEBUG
 
			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
 
			serial0_sendString(buff); //DEBUG
 

	
 
			_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));
 
			//led_output(i2c_read(EEPROM_ADDR, 0x05));	// Debugging, delete
 
			//led_output(io_getModuleId());
 
		}
 

	
 
    }
0 comments (0 inline, 0 general)