
/*
 * SharpGP2.h
 *
 * Created: 27.08.2011 00:59:52
 *  Author: Tavin
 */ 


#ifndef SHARPGP2_H_
#define SHARPGP2_H_


#define DISTANCE_SENSOR_UNKNOWN			0
#define DISTANCE_SENSOR_GP2D120			1	
#define DISTANCE_SENSOR_GP2D12			2
#define DISTANCE_SENSOR_GP2Y0A2			3



typedef struct{
	uint8_t a:1;
}SharpSensorStatus_t;


typedef struct {
	SharpSensorStatus_t status;
	int32_t			offset; 
	int32_t			gradient;
	uint16_t		distance;
} SharpSensor_t;


SharpSensor_t SharpSensorData[SHARP_SENSOR_COUNT];




void SharpGP2_ConfigureSensor(uint8_t index, int16_t distanceA,int16_t distanceB,int16_t valueA, int16_t valueB);
uint16_t SharpGP2_calculateDistance(uint8_t index, uint16_t value);



uint16_t static inline SharpGP2_getDistanceasMilimeters(uint8_t index)
{
	return(SharpSensorData[index].distance);
}
#endif /* SHARPGP2_H_ */