Files @ 48acfcb35ad3
Branch filter:

Location: seniordesign-firmware/slave/slave/lib/sensors.c

ethanzonca@CL-SEC241-08.cedarville.edu
Added slave parser library, added infrastructure for requesting data from slave nodes
/*
 * sensors.c
 *
 * Created: 11/19/2012 9:25:01 PM
 *  Author: kripperger
 */ 


#include <inttypes.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include "../config.h"
#include <util/delay.h>
#include "sensors.h"
#include "spi.h"


uint8_t readSpiTemp()
{
	// select TEMP wait 100 microseconds then read four bytes
	SELECT_TEMP;
	_delay_us(100);
	unsigned char one = send_spi(0xFF);
	_delay_us(100);
	unsigned char two = send_spi(0xFF);
	_delay_us(100);
	unsigned char three = send_spi(0xFF);
	_delay_us(100);
	unsigned char four = send_spi(0xFF);
	DESELECT_TEMP;
	
	
	//return ((0x1F & one) << 7) | (two >> 1);
	return 0;	//DEBUG
}