s_light.h File Reference


Detailed Description

AVR32 UC3 Control Panel light sensor interface.

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

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.


Function Documentation

Bool b_light_get_value ( char *  buf,
U32 *  result 
)

Get the current light sensor value.

Parameters:
buf char buffer in which the light sensor value is stored.
result returns the light sensor value.
Returns:
TRUE upon success, FALSE if error.

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 }


Generated on Fri Feb 19 02:22:52 2010 for AVR32 - Control Panel demonstration. by  doxygen 1.5.5