/**
* @ingroup hal
* @{ 
* @file hal_Osram_SFH5711_ambient_light_sensor.c
*
* @brief Conversion routines for the Osram SFH5711 Ambient Light Sensor.
*
* @note Light sensor outputs current between 0 to 50uA. On the target board, load resistor = 47k Ohms.
* @note 0 to 100,000lx will generate 0 to 2350mV input into an Analog to Digital Converter (ADC).
* @note This particular light sensor is binned for a sensitivity of 27 to 30 uA @ 1000lux = 1269-1410 mV = ADC readings of 520-578counts 
* @note there are two versions of the convertAdcToLux() method: 
* - Use a lookup table. Faster and less code, but also less accurate.
* - Compute the value directly based on equation supplied by the manufacturer. 
* This is much more accurate but requires approximately 4.2kB more code for the pow() function in math.h.
*
* $Rev: 545 $
* $Author: dsmith $
* $Date: 2010-05-27 17:09:05 -0700 (Thu, 27 May 2010) $
*
* YOU ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY 
* OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, 
* TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL TEXAS INSTRUMENTS 
* OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, 
* BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
* INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, 
* LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY 
* CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*/

#ifndef HAL_OSRAM_SFH_LIGHT_INTERFACE_H
#define HAL_OSRAM_SFH_LIGHT_INTERFACE_H

/** Converts the raw ADC value to lux for the Osram SFH5711 light sensor using adcToLuxLookupTable[].
Iterates through the table until nearest value is found. Does not interpolate.
@param adc the raw reading from the Analog to Digital converter
@return the amount of light, in lux/10, or 0xFFFF if the adc value was larger than the table. 
This value should be nearly impossible to obtain othererwise unless you are on the sun.
*/
unsigned int convertAdcToLux(unsigned int adc); 


#endif


/* @} */
