# HG changeset patch # User kripperger@CL-SEC241-09.cedarville.edu # Date 2012-11-07 19:27:57 # Node ID af3d1c88dc4ae169b991af3b8980cd2332846a2a # Parent 764445936ccabbd1804cf17ecebeeabc50aab980 Adding i2c and io libs diff --git a/slave/slave/config.h b/slave/slave/config.h --- a/slave/slave/config.h +++ b/slave/slave/config.h @@ -1,5 +1,5 @@ /* - * IncFile1.h + * config.h * * Created: 10/25/2012 10:00:09 PM * Author: mkanning @@ -11,6 +11,6 @@ #define F_CPU 11059200 #define USART_BAUDRATE 19200 - #define MODULE_ID '2' + #define MODULE_ID '2' //TEMP #endif /* CONFIG_H_ */ \ No newline at end of file diff --git a/slave/slave/lib/i2c.c b/slave/slave/lib/i2c.c new file mode 100644 --- /dev/null +++ b/slave/slave/lib/i2c.c @@ -0,0 +1,6 @@ +/* + * i2c.c + * + * Created: 11/7/2012 7:18:23 PM + * Author: kripperger + */ diff --git a/slave/slave/lib/i2c.h b/slave/slave/lib/i2c.h new file mode 100644 --- /dev/null +++ b/slave/slave/lib/i2c.h @@ -0,0 +1,16 @@ +/* + * i2c.h + * + * Created: 11/7/2012 7:18:33 PM + * Author: kripperger + */ + + +#ifndef I2C_H_ +#define I2C_H_ + + + + + +#endif /* I2C_H_ */ \ No newline at end of file diff --git a/slave/slave/lib/io.c b/slave/slave/lib/io.c new file mode 100644 --- /dev/null +++ b/slave/slave/lib/io.c @@ -0,0 +1,6 @@ +/* + * io.c + * + * Created: 11/7/2012 7:17:52 PM + * Author: kripperger + */ diff --git a/slave/slave/lib/io.h b/slave/slave/lib/io.h new file mode 100644 --- /dev/null +++ b/slave/slave/lib/io.h @@ -0,0 +1,16 @@ +/* + * io.h + * + * Created: 11/7/2012 7:18:08 PM + * Author: kripperger + */ + + +#ifndef IO_H_ +#define IO_H_ + + + + + +#endif /* IO_H_ */ \ No newline at end of file diff --git a/slave/slave/lib/led.c b/slave/slave/lib/led.c --- a/slave/slave/lib/led.c +++ b/slave/slave/lib/led.c @@ -1,5 +1,5 @@ /* - * CFile1.c + * led.c * * Created: 10/25/2012 10:03:22 PM * Author: mkanning diff --git a/slave/slave/lib/led.h b/slave/slave/lib/led.h --- a/slave/slave/lib/led.h +++ b/slave/slave/lib/led.h @@ -1,5 +1,5 @@ /* - * IncFile1.h + * led.h * * Created: 10/25/2012 10:01:29 PM * Author: mkanning @@ -11,8 +11,8 @@ #define POWER 1 #define ERROR 2 - #define STAT 2 - #define OK 2 + #define STAT 3 + #define OK 4 void led_Configure(); void led_On(uint8_t led); diff --git a/slave/slave/lib/serial.c b/slave/slave/lib/serial.c deleted file mode 100644 --- a/slave/slave/lib/serial.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * CFile1.c - * - * Created: 10/25/2012 10:02:38 PM - * Author: mkanning - */ - - #include - - void serial_SendChar( char byte ) - { - while (!(UCSR0A & (1<> 8); // 0 - //UBRRL = BAUD_PRESCALE; // 8 - //UCSRA = 0; - //UCSRB = 0x18; - //UCSRC = 0x06; - //OCR0B = 0xff; - //OCR0A = 0xff; - //OCR1AL = 0xff; - //OCR1BL = 0xff; - } diff --git a/slave/slave/lib/serial.h b/slave/slave/lib/serial.h deleted file mode 100644 --- a/slave/slave/lib/serial.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * IncFile1.h - * - * Created: 10/25/2012 10:01:43 PM - * Author: mkanning - */ - - - #ifndef SERIAL_H_ - #define SERIAL_H_ - - #define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) -1 ) - - void serial_SendChar( char byte ); - void serial_SendCommand( char moduleID, char sensorID, uint8_t dataLength, char* data ); - void serial_SendResponseData(); - void serial_Configure(); - - #endif /* SERIAL_H_ */ \ No newline at end of file diff --git a/slave/slave/lib/serparser.c b/slave/slave/lib/serparser.c deleted file mode 100644 --- a/slave/slave/lib/serparser.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * serparser.c - * - * Created: 10/25/2012 10:04:09 PM - * Author: mkanning -*/ - - -// ************* Macros *************** -#define SERIAL_RX_HASBYTES UCSR0A & _BV(RXC) -#define MAX_CMD_LEN 16 -#define BROADCAST_ADDR 0 //public address -#include -#include "../config.h" - -//#define DEBUG - -// ************* Command Definitions *************** - -// Serial Commands -enum cmd // CMD ID# -{ - BOARDTEMP = 0, // 0 - PRESSURE, // 1 -}; - -// Incoming command buffer -uint8_t buffer[MAX_CMD_LEN+2]; - -// Current buffer location -uint8_t bufferPosition = 0; - -//ID of the sensor of most recent transmission -char sensorID; - -//checksum to be calculated and then compared to the received checksum -char checksumCalc; - -/* return char from UART (h/w buffer) */ -uint8_t uart_getchar(void) -{ - // Wait for chars - /* while (!(UCSRA & (1< - True - True - True - True - True - Optimize for size (-Os) - True - True - True - - - m - - - + True + True + True + True + True + Optimize for size (-Os) + True + True + True + + + m + + + - True - True - True - True - True - Optimize (-O1) - True - True - Default (-g2) - True - - - m - - - Default (-Wa,-g) - + True + True + True + True + True + Optimize (-O1) + True + True + Default (-g2) + True + + + m + + + Default (-Wa,-g) + compile + + compile + + + compile + + + compile + + + compile + compile