Changeset - 73b3e9205de4
[Not reviewed]
default
0 3 2
kripperger@CL-SEC241-09.cedarville.edu - 12 years ago 2012-11-09 11:47:07
kripperger@CL-SEC241-09.cedarville.edu
Adding module functions
5 files changed with 58 insertions and 10 deletions:
0 comments (0 inline, 0 general)
slave/slave/config.h
Show inline comments
 
@@ -12,16 +12,13 @@
 
 #define F_CPU 11059200
 
 #define USART_BAUDRATE 19200
 
 
 
 //I2C Addresses
 
 #define BOARDTEMP_ADDR 0xA5	//THIS VALUE IS WRONG
 
 
 
 #define PRESSURE_ADDR 0xA1		//THIS VALUE IS WRONG
 
   
 
 #define HUMID_ADDR 0xA4		//THIS VALUE IS WRONG
 
 
 #define RTC_ADDR 0xA2			//DEBUG       //read A3 - write A2
 
 
 
 
 #endif /* CONFIG_H_ */
 
\ No newline at end of file
slave/slave/modules.c
Show inline comments
 
new file 100644
 
/*
 
 * modules.c
 
 *
 
 * Created: 11/9/2012 11:44:22 AM
 
 *  Author: kripperger
 
 */ 
 
 
 #include <avr/io.h>
 
 #include "modules.h"
 
\ No newline at end of file
slave/slave/modules.h
Show inline comments
 
new file 100644
 
/*
 
 * modules.h
 
 *
 
 * Created: 11/9/2012 11:44:36 AM
 
 *  Author: kripperger
 
 */ 
 
 
 
#ifndef MODULES_H_
 
#define MODULES_H_
 
 
 
 
 
 
#endif /* MODULES_H_ */
 
\ No newline at end of file
slave/slave/slave.c
Show inline comments
 
@@ -9,39 +9,43 @@
 
 * Matthew Kroening
 
 *
 
 */
 
 
 
#include "config.h"
 
#include "modules.h"
 
 
#include <inttypes.h>
 
#include <avr/io.h>
 
#include <util/delay.h>
 
#include <compat/twi.h>
 
 
//#include "lib/serial.h"
 
//#include "lib/serial.h"		//Not made yet
 
#include "lib/led.h"
 
#include "lib/inputOutput.h"
 
#include "lib/i2c.h"
 
 
 
void micro_setup()
 
{
 
	// Generic microcontroller config options
 
	
 
	DDRA=0xFF; //PORTA is output //DEBUG
 
	
 
}
 
 
 
 
int main(void)
 
{
 
	// Initialize
 
	micro_setup();			// Generic microcontroller config options
 
	led_configure();		//
 
	i2c_init();				// Setup I2C
 
	//serial_setup();		// Config serial ports
 
	
 
	uint8_t moduleID = io_getModuleId(); // Slave Module ID from rotary dip switch
 
	
 
	
 
	uint8_t temp;	//DEBUG
 
	
 
	
 
@@ -49,22 +53,38 @@ int main(void)
 
	
 
    while(1)
 
    {
 
		
 
        //serial_SendCommand('0','A',0,0);	//DEBUG: EXAMPLE
 
		
 
		
 
		
 
		//i2c_write(RTC_ADDR, 0x05, 0x3A);	//DEBUG: EXAMPLE
 
 
		_delay_ms(10);
 
 
		temp = i2c_read(RTC_ADDR, 0x02);		//DEBUG: EXAMPLE: seconds
 
		
 
		//_delay_ms(10);
 
		PORTA = temp;
 
 
 
		switch(moduleID)
 
		{
 
			case 0:
 
				break;
 
			
 
			case 1:
 
				break;
 
		
 
		//PORTA = temp;
 
		PORTA = 0xFF;
 
			case 2:
 
				break;
 
			
 
			case 3:
 
				break;
 
				
 
			default:
 
				break;
 
		}
 
 
 
 
    }
 
	
 
	return 0;
 
}
 
\ No newline at end of file
slave/slave/slave.cproj
Show inline comments
 
@@ -129,12 +129,18 @@
 
    <Compile Include="lib\led.c">
 
      <SubType>compile</SubType>
 
    </Compile>
 
    <Compile Include="lib\led.h">
 
      <SubType>compile</SubType>
 
    </Compile>
 
    <Compile Include="modules.c">
 
      <SubType>compile</SubType>
 
    </Compile>
 
    <Compile Include="modules.h">
 
      <SubType>compile</SubType>
 
    </Compile>
 
    <Compile Include="slave.c">
 
      <SubType>compile</SubType>
 
    </Compile>
 
  </ItemGroup>
 
  <ItemGroup>
 
    <Folder Include="lib" />
0 comments (0 inline, 0 general)