Definition in file s_light.h.
#include "compiler.h"
Go to the source code of this file.
Functions | |
Bool | b_light_get_value (char *buf, U32 *result) |
Get the current light sensor value. |
Bool b_light_get_value | ( | char * | buf, | |
U32 * | result | |||
) |
Get the current light sensor value.
buf | char buffer in which the light sensor value is stored. | |
result | returns the light sensor value. |
Definition at line 73 of file s_light.c.
References adc.
Referenced by device_full_custom_task().
00074 { 00075 int i_current_val; 00076 00077 00078 /* enable channel for sensor */ 00079 adc_enable( adc, ADC_LIGHT_CHANNEL ); 00080 /* start conversion */ 00081 adc_start( adc ); 00082 /* get value for sensor */ 00083 i_current_val = ( 00084 #ifdef EVK1100_REVA 00085 ADC_MAX_VALUE - 00086 #endif 00087 adc_get_value( adc, ADC_LIGHT_CHANNEL )) * 100 / ADC_MAX_VALUE; 00088 /* Disable channel for sensor */ 00089 adc_disable( adc, ADC_LIGHT_CHANNEL ); 00090 00091 sprintf( buf, "%d%%\r\n", i_current_val); 00092 00093 *result= i_current_val; 00094 return TRUE; 00095 }