CCAux  2.20.0.0
CCAux API reference
Functions
Lightsensor functions

Functions

EXTERN_C CCAUXDLL_API LIGHTSENSORHANDLE CCAUXDLL_CALLING_CONV GetLightsensor (void)
 
EXTERN_C CCAUXDLL_API void CCAUXDLL_CALLING_CONV Lightsensor_release (LIGHTSENSORHANDLE)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Lightsensor_getIlluminance (LIGHTSENSORHANDLE, uint16_t *value)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Lightsensor_getIlluminance2 (LIGHTSENSORHANDLE, uint16_t *value, uint8_t *ch0, uint8_t *ch1)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Lightsensor_getAverageIlluminance (LIGHTSENSORHANDLE, uint16_t *value)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Lightsensor_startAverageCalc (LIGHTSENSORHANDLE, uint32_t averageWndSize, uint32_t rejectWndSize, uint32_t rejectDeltaInLux, LightSensorSamplingMode mode)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Lightsensor_stopAverageCalc (LIGHTSENSORHANDLE)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Lightsensor_getOperatingRange (LIGHTSENSORHANDLE, LightSensorOperationRange *range)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Lightsensor_setOperatingRange (LIGHTSENSORHANDLE, LightSensorOperationRange range)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Lightsensor_setActive (LIGHTSENSORHANDLE, ComponentLocation location)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Lightsensor_getActive (LIGHTSENSORHANDLE, ComponentLocation *location)
 

Detailed Description

Functions in the Lightsensor class

Function Documentation

◆ GetLightsensor()

EXTERN_C CCAUXDLL_API LIGHTSENSORHANDLE CCAUXDLL_CALLING_CONV CrossControl::GetLightsensor ( void  )

Factory function that creates instances of the Lightsensor object.

Supported Platform(s): XL, XL5, XM, XM9, XS, XA, VC, VA, VS, V700, Yukon, V510, V710, V1000, V1200, X1200

Returns
LIGHTSENSORHANDLE to an allocated Lightsensor object. The returned handle needs to be deallocated using the Lightsensor_release(LIGHTSENSORHANDLE) method when it's no longer needed. Returns NULL if it fails to allocate memory.

Example Usage:

assert(pLightSensor);
ls_example(pLightSensor);
Lightsensor_release(pLightSensor);
EXTERN_C CCAUXDLL_API void CCAUXDLL_CALLING_CONV Lightsensor_release(LIGHTSENSORHANDLE)
EXTERN_C CCAUXDLL_API LIGHTSENSORHANDLE CCAUXDLL_CALLING_CONV GetLightsensor(void)
void * LIGHTSENSORHANDLE
Definition: Lightsensor.h:43

◆ Lightsensor_getActive()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Lightsensor_getActive ( LIGHTSENSORHANDLE  ,
ComponentLocation location 
)

Get active lightsensor.

Supported Platform(s): Yukon, V510, V710, V1000, V1200, X1200

Parameters
locationLocation of the active Lightsensor.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

◆ Lightsensor_getAverageIlluminance()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Lightsensor_getAverageIlluminance ( LIGHTSENSORHANDLE  ,
uint16_t value 
)

Get average illuminance (light) value from light sensor.

Supported Platform(s): XL, XL5, XM, XM9, XS, XA, VC, VA, VS, V700, Yukon, V510, V710, V1000, V1200, X1200

Parameters
valueIlluminance value (Lux).
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

err = Lightsensor_getAverageIlluminance(pLightSensor, &value);
if (err != ERR_SUCCESS)
{
cout << "Error(" << err << ") in function getAverageIlluminance: " << GetErrorStringA(err) << endl;
}
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Lightsensor_getAverageIlluminance(LIGHTSENSORHANDLE, uint16_t *value)
EXTERN_C CCAUXDLL_API char_t const *CCAUXDLL_CALLING_CONV GetErrorStringA(eErr errCode)
@ ERR_SUCCESS
Definition: CCAuxTypes.h:163

◆ Lightsensor_getIlluminance()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Lightsensor_getIlluminance ( LIGHTSENSORHANDLE  ,
uint16_t value 
)

Get illuminance (light) value from light sensor.

Supported Platform(s): XL, XL5, XM, XM9, XS, XA, VC, VA, VS, V700, Yukon, V510, V710, V1000, V1200, X1200

Parameters
valueIlluminace value (Lux).
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

err = Lightsensor_getIlluminance(pLightSensor, &value);
if (err != ERR_SUCCESS)
{
cout << "Error(" << err << ") in function getIlluminance: " << GetErrorStringA(err) << endl;
}
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Lightsensor_getIlluminance(LIGHTSENSORHANDLE, uint16_t *value)

◆ Lightsensor_getIlluminance2()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Lightsensor_getIlluminance2 ( LIGHTSENSORHANDLE  ,
uint16_t value,
uint8_t ch0,
uint8_t ch1 
)

Get illuminance (light) value from light sensor. The parameters cho and ch1 are raw ADC values read from a TAOS TSL2550 lightsensor.

Supported Platform(s): XL, XL5, XM, XM9, XS, XA, VC, VA, VS, V700, Yukon, V510, V710, V1000, V1200, X1200

Parameters
valueIlluminance value (Lux).
ch0Channel0 value. (Not applicable on VC platform - always 0)
ch1Channel1 value. (Not applicable on VC platform - always 0)
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

◆ Lightsensor_getOperatingRange()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Lightsensor_getOperatingRange ( LIGHTSENSORHANDLE  ,
LightSensorOperationRange range 
)

Get operating range. The light sensor can operate in two ranges. Standard and extended range. In standard range, the range is smaller but resolution higher. See the TSL2550 data sheet for more information. On the VC platform, the ranges correspond to 1000 and 4000 lux maximum value.

Supported Platform(s): XL, XL5, XM, XM9, XS, XA, VC, VA, VS, Yukon, V510, V710, V1000, V1200, X1200

Parameters
rangeOperating range. RangeStandard or RangeExtended.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code.

◆ Lightsensor_release()

EXTERN_C CCAUXDLL_API void CCAUXDLL_CALLING_CONV CrossControl::Lightsensor_release ( LIGHTSENSORHANDLE  )

Delete the Lightsensor object.

Supported Platform(s): XL, XL5, XM, XM9, XS, XA, VC, VA, VS, V700, Yukon, V510, V710, V1000, V1200, X1200

Returns
-

Example Usage:

assert(pLightSensor);
ls_example(pLightSensor);
Lightsensor_release(pLightSensor);

◆ Lightsensor_setActive()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Lightsensor_setActive ( LIGHTSENSORHANDLE  ,
ComponentLocation  location 
)

Set active lightsensor.

Supported Platform(s): Yukon, V510, V710, V1000, V1200

Parameters
locationLocation of the Lightsensor to set Active. Max number depends from platform.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

◆ Lightsensor_setOperatingRange()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Lightsensor_setOperatingRange ( LIGHTSENSORHANDLE  ,
LightSensorOperationRange  range 
)

Set operating range. The light sensor can operate in two ranges. Standard and extended range. In standard range, the range is smaller but resolution higher. See the TSL2550 data sheet for more information. On the VC platform, the ranges correspond to 1000 and 4000 lux maximum value.

Supported Platform(s): XL, XL5, XM, XM9, XS, XA, VC, VA, VS, Yukon, V510, V710, V1000, V1200, X1200

Parameters
rangeOperating range to set. RangeStandard or RangeExtended.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

◆ Lightsensor_startAverageCalc()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Lightsensor_startAverageCalc ( LIGHTSENSORHANDLE  ,
uint32_t  averageWndSize,
uint32_t  rejectWndSize,
uint32_t  rejectDeltaInLux,
LightSensorSamplingMode  mode 
)

Start average calculation. The average calculation works by calculating the average from a number of consecutive samples, the average window size. The reject window is used to discard sudden changes or single extreme values of the measurement. If the difference of the maximum value and the minimum value in the number of samples in the reject delta window is larger than the reject delta, those samples are discarded.

Supported Platform(s): XL, XL5, XM, XM9, XS, XA, VC, VA, VS, V700, Yukon, V510, V710, V1000, V1200, X1200

Parameters
averageWndSizeThe average window size in nr of samples.
rejectWndSizeThe reject window size in nr of samples.
rejectDeltaInLuxThe reject delta in lux.
modeThe configured sampling mode.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

// Start the average calculation background function
// This cannot be used if the automatic backlihgt function is running.
err = Lightsensor_startAverageCalc(pLightSensor, 5, 5, 50, SamplingModeAuto);
{
cout << "Error(" << err << ") in function startAverageCalc: " << GetErrorStringA(err) << endl;
cout << endl << "Please turn off Automatic backlight! (CCsettings - Display tab)" << endl;
return;
}
else if (err != ERR_SUCCESS)
{
cout << "Error(" << err << ") in function startAverageCalc: " << GetErrorStringA(err) << endl;
}
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Lightsensor_startAverageCalc(LIGHTSENSORHANDLE, uint32_t averageWndSize, uint32_t rejectWndSize, uint32_t rejectDeltaInLux, LightSensorSamplingMode mode)
@ SamplingModeAuto
Definition: CCAuxTypes.h:145
@ ERR_AVERAGE_CALC_STARTED
Definition: CCAuxTypes.h:183

◆ Lightsensor_stopAverageCalc()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Lightsensor_stopAverageCalc ( LIGHTSENSORHANDLE  )

Stop average calculation.

Supported Platform(s): XL, XL5, XM, XM9, XS, XA, VC, VA, VS, V700, Yukon, V510, V710, V1000, V1200, X1200

Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

err = Lightsensor_stopAverageCalc(pLightSensor);
if (err != ERR_SUCCESS)
{
cout << "Error(" << err << ") in function stopAverageCalc: " << GetErrorStringA(err) << endl;
}
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Lightsensor_stopAverageCalc(LIGHTSENSORHANDLE)