Changeset - 6023002a8b9e
[Not reviewed]
default
0 4 0
ethanzonca@CL-SEC241-08.cedarville.edu - 12 years ago 2012-11-30 16:41:40
ethanzonca@CL-SEC241-08.cedarville.edu
Serial rate increased to 115.2, removed debug output causing freezes
4 files changed with 11 insertions and 10 deletions:
0 comments (0 inline, 0 general)
master/master/config.h
Show inline comments
 
@@ -60,8 +60,8 @@
 
// USART config (serial.c)
 
// --------------------------------------------------------------------------
 
 
#define USART0_BAUDRATE 9600
 
#define USART1_BAUDRATE 9600
 
#define USART0_BAUDRATE 115200
 
#define USART1_BAUDRATE 115200
 
 
 
// --------------------------------------------------------------------------
master/master/lib/looptime.c
Show inline comments
 
@@ -11,13 +11,13 @@
 
 */
 
 
#include "../config.h"
 
#include "looptime.h"
 
#include <avr/io.h>
 
#include <avr/interrupt.h>
 
#include <util/delay.h>
 
 
volatile uint32_t millis = 0; // Milliseconds since initialization
 

	
 

	
 

	
 
void time_setup() 
 
{
 
	DDRA = 0xff;
 
@@ -31,7 +31,6 @@ void time_setup()
 
	TIMSK0 |= (1 << TOIE0); // enable overflow interrupt
 
}
 

	
 

	
 
ISR(TIMER0_OVF_vect) 
 
{
 
	millis = millis + 1;
master/master/lib/looptime.h
Show inline comments
 
@@ -13,9 +13,9 @@
 
#ifndef LOOPTIME_H_
 
#define LOOPTIME_H_
 
 
#include <inttypes.h>
 

	
 
void time_setup();
 

	
 
uint32_t time_millis();
 
 
#endif /* LOOPTIME_H_ */
 
\ No newline at end of file
master/master/lib/serparser.c
Show inline comments
 
@@ -32,7 +32,7 @@ uint8_t parserState = STATE_RESET;
 
uint8_t lastParserState = STATE_RESET;
 
 
// Length of current payload data (and checksum)
 
int dataLength = 0;
 
uint8_t dataLength = 0;
 
 
// Data and checksum of most recent transmission
 
char receivedPayload[MAX_PAYLOAD_LEN];
 
@@ -69,8 +69,8 @@ ISR(USART0__RX_vect)
 
	led_on(POWER);
 
	buffer[bufferDataPosition % BUFFER_SIZE] = UDR0;
 
	bufferDataPosition = (bufferDataPosition + 1) % BUFFER_SIZE;
 
	sprintf(buffmeh, "bdp: %d, bpp: %d \r\n", bufferDataPosition, bufferParsePosition);
 
	serial0_sendString((buffmeh));
 
	/*sprintf(buffmeh, "bdp: %d, bpp: %d \r\n", bufferDataPosition, bufferParsePosition);
 
	serial0_sendString((buffmeh)); */
 
}
 
 
 
@@ -146,6 +146,8 @@ int serparser_parse(void)
 
			{
 
				#ifdef DEBUG
 
				serial0_sendString("eof ok\r\n");
 
				sprintf(buffmeh, "recvd %d bytes data\r\n", dataLength);
 
				serial0_sendString((buffmeh));
 
				#endif
 
				if(bufferParsePosition == bufferDataPosition) 
 
				{
 
@@ -173,7 +175,7 @@ int serparser_parse(void)
 
				// Data buffer overrun protection
 
				if(dataLength > MAX_PAYLOAD_LEN) {
 
					#ifdef DEBUG
 
					serial0_sendString("buf ovf\r\n");
 
					serial0_sendString("data ovf\r\n");
 
					#endif
 
					setParserState(STATE_RESET);
 
					return PARSERESULT_FAIL;
0 comments (0 inline, 0 general)