Changeset - 69eb638df718
[Not reviewed]
Merge default
0 2 0
ethanzonca@CL-ENS241-08.cedarville.edu - 12 years ago 2013-02-12 16:03:21
ethanzonca@CL-ENS241-08.cedarville.edu
Merge
2 files changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
slave/slave/config.h
Show inline comments
 
@@ -7,38 +7,38 @@
 
 
 
 #ifndef CONFIG_H_
 
 #define CONFIG_H_
 
 
 #define F_CPU 11059200				// Clock frequency (used in calculations)
 
 
//Serial
 
#define USART0_BAUDRATE 115200
 
#define USART1_BAUDRATE 115200 
 
 
// Circular serial buffer size. Must be at least MAX_CMD_LEN + 5
 
#define BUFFER_SIZE 32
 
 
// Maximum payload size of command
 
#define MAX_PAYLOAD_LEN 16
 
 
// Number of datatypes to transmit per module type
 
#define DATATYPES_GENERIC 3
 
#define DATATYPES_SENSOR 8
 
#define DATATYPES_GEIGER 4
 
#define DATATYPES_CAMERA 3
 
 
//Sensors and IO
 
#define SENSOR_LOOP 3000				// Frequency of sensor reads (in ms) (should be 200)
 
#define SENSOR_LOOP 100				// Frequency of sensor reads (in ms) (should be 200)
 
#define HEATER_THRESHOLD 40			// Temperature threshold in Fahrenheit where heater is activated
 
 
 //I2C Addresses
 
 #define EEPROM_ADDR 0xA0		// Read 0xA1 - Write 0xA0
 
 #define BOARDTEMP_ADDR 0x90	// Read 0x91 - Write 0x90
 
 #define PRESSURE_ADDR 0xEF		// Read 0xEF - Write 0xEE
 
 #define HUMID_ADDR 0x27		// Read 0x27 - Write 0x26
 
 #define LIGHT_ADDR 0x95		// Read 0x95 - Write 0x94
 
 #define RTC_ADDR 0xB2			//DEBUG [Used for testing]      // Read 0xA3 - Write 0xA2
 
 
 
 
 #endif /* CONFIG_H_ */
 
\ No newline at end of file
slave/slave/slave.c
Show inline comments
 
@@ -61,50 +61,50 @@ int main(void)
 
	//uint8_t test2;	//Debug	
 
	
 
	
 
	// Serial output //DEBUG
 
	char buff[64];							//Buffer for serial output //DEBUG
 
	serial0_sendString("Starting Slave\r\n");
 
			
 
    while(1)
 
    {	
 
		
 
		// Master communication
 
		masterComm_checkParser();
 
			
 
		
 
		
 
		// Main slave operations
 
		if ((time_millis() % SENSOR_LOOP) == 0)	// Uses program timer to run every so often. Time interval defined in config.h
 
		{
 
			led_on(0);
 
			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
 

	
 
			snprintf(buff,64,"|ModuleID: %u |BoardTemp: %i |Millis: %lu |SpiTemp: %i\r\n",io_getModuleId(),sensors_getBoardTemp(),time_millis(),sensors_getSpiTemp()); //DEBUG
 
			serial0_sendString(buff); //DEBUG
 
			//snprintf(buff,64,"|ModuleID: %u |BoardTemp: %i |Millis: %lu |SpiTemp: %i\r\n",io_getModuleId(),sensors_getBoardTemp(),time_millis(),sensors_getSpiTemp()); //DEBUG
 
			//serial0_sendString(buff); //DEBUG
 

	
 
			_delay_ms(2);		// Delay to prevent the sensor loop from running again before time_millis changes
 
			led_off(0);
 
			led_off(2);
 
		}
 

	
 
    }
 
	
 
	return 0;
 
}
 

	
 

	
 

	
 

	
 

	
 
		/********Examples of data reading and getting******************
 
		x = geiger_getCpm();				//Data get
 
		x = sensors_getSpiTemp();			//Data get
 
		x = sensors_getBoardTemp();			//Data get
 
		
 
		sensors_readSpiTemp();				//Data Read
 
		sensors_readBoardTemp();			//Data Read
 
		
 
		led_output(0xFF);					//Output value to LED array
0 comments (0 inline, 0 general)