XDK API  3.6.0
Documentation
Files | Data Structures | Typedefs | Enumerations | Functions

LightSensor Interface. More...

+ Collaboration diagram for LightSensor:

Files

file  BCDS_LightSensor.h
 

Data Structures

struct  LightSensor_Handle_S
 structure to represent corresponding light sensor handle More...
 
struct  LightSensor_InterruptCallback_S
 structure to represent corresponding light sensor interrupt callback More...
 
struct  LightSensor_SensorInfo_S
 

Typedefs

typedef void(* deferredInterruptCallback )(void *, uint32_t)
 
typedef void(* interruptCallback )(void)
 
typedef enum
LightSensor_ConfigBrightness_E 
LightSensor_ConfigBrightness_T
 
typedef enum
LightSensor_ConfigBrightness_E
LightSensor_ConfigBrightnessPtr_T
 
typedef enum
LightSensor_ConfigInterrupt_E 
LightSensor_ConfigInterrupt_T
 
typedef enum
LightSensor_ConfigInterrupt_E
LightSensor_ConfigInterruptPtr_T
 
typedef enum
LightSensor_ConfigMode_E 
LightSensor_ConfigMode_T
 
typedef enum
LightSensor_ConfigMode_E
LightSensor_ConfigModePtr_T
 
typedef struct LightSensor_Handle_S LightSensor_Handle_T
 
typedef struct
LightSensor_Handle_S
LightSensor_HandlePtr_T
 
typedef enum
LightSensor_IntegrationTime_E 
LightSensor_IntegrationTime_T
 
typedef enum
LightSensor_IntegrationTime_E
LightSensor_IntegrationTimePtr_T
 
typedef struct
LightSensor_InterruptCallback_S 
LightSensor_InterruptCallback_T
 
typedef enum LightSensor_SensorID_E LightSensor_SensorID_T
 
typedef struct
LightSensor_SensorInfo_S 
LightSensor_SensorInfo_T
 
typedef struct
LightSensor_SensorInfo_S
LightSensor_SensorInfoPtr_T
 

Enumerations

enum  LightSensor_ConfigBrightness_E
 
enum  LightSensor_ConfigInterrupt_E
 
enum  LightSensor_ConfigMode_E
 
enum  LightSensor_IntegrationTime_E
 
enum  LightSensor_SensorID_E
 

Functions

Retcode_T LightSensor_configureThresholdInterrupt (LightSensor_HandlePtr_T handle, uint32_t upperThreshold, uint32_t lowerThreshold, uint32_t thresholdTimer)
 function responsible to set interrupt conditions, that means, threshold boundaries and threshold timer for lightsensor interrupt. Interrupt will be fired if the light intensity is crossed threshold boundaries for a window period defined in threshold timer.User must register the callback before calling configuring interrupt More...
 
Retcode_T LightSensor_deInit (LightSensor_HandlePtr_T handle)
 DeInitializes the light sensor referenced by the passed handle. More...
 
Retcode_T LightSensor_disableInterrupt (LightSensor_HandlePtr_T handle)
 Disable Interrupt type on the handle. More...
 
Retcode_T LightSensor_getInterruptStatus (LightSensor_HandlePtr_T handle, LightSensor_ConfigInterruptPtr_T interruptStatus)
 function to read light sensor interrupt status register More...
 
Retcode_T LightSensor_init (LightSensor_HandlePtr_T handle)
 Initializes the LightSensor referenced by the passed handle. More...
 
Retcode_T LightSensor_readLuxData (LightSensor_HandlePtr_T handle, uint32_t *luxData)
 function to read sensor data in milli lux. More...
 
Retcode_T LightSensor_readRawData (LightSensor_HandlePtr_T handle, uint16_t *luxData)
 Reads raw sensor data from light sensor referenced by the passed handle. More...
 
Retcode_T LightSensor_registerDeferredCallback (LightSensor_HandlePtr_T handle, deferredInterruptCallback deferredCallback)
 function responsible to register deferred interrupt handler for light sensor. When user registers deferred callback their callback will be executed in timer daemon context, where there is no restriction of using delay functions and/or APIs related to bus access. More...
 
Retcode_T LightSensor_registerRealTimeCallback (LightSensor_HandlePtr_T handle, interruptCallback realTimeCallback)
 function responsible to register real time interrupt handler for light sensor. When user registers real time callback their callback will be executed in ISR context. User must not use any delay functions or bus access in ISR context. More...
 
Retcode_T LightSensor_setBrightness (LightSensor_HandlePtr_T handle, LightSensor_ConfigBrightness_T brightness)
 function to set brightness to low or high for light sensor More...
 
Retcode_T LightSensor_setContinuousMode (LightSensor_HandlePtr_T handle, LightSensor_ConfigMode_T continuousMode)
 Function to enable/disable the Continuous mode for the light sensor referenced by the passed handle. More...
 
Retcode_T LightSensor_setIntegrationTime (LightSensor_HandlePtr_T handle, LightSensor_IntegrationTime_T integrationTime)
 function to configure integration time of light sensor. More...
 
Retcode_T LightSensor_setManualMode (LightSensor_HandlePtr_T handle, LightSensor_ConfigMode_T manualMode)
 Function to enable/disable the Manual mode for the light sensor referenced by the passed handle. More...
 

Detailed Description

The interface header exports advance Sensor API's which are used to Initialize Light sensor, Configure Real Time Interrupts, Differed Interrupts, Modes, Threshold Level & Integration time. Also has API's for reading sensor values, Threshold level & Mode Settings.


Data Structure Documentation

struct LightSensor_Handle_S
+ Collaboration diagram for LightSensor_Handle_S:

Data Fields

LightSensor_InterruptCallback_T MaxInterrupt
 
LightSensor_SensorInfo_T SensorInformation
 
void * SensorPtr
 

Field Documentation

Structure for interruptcallback in light sensor

LightSensor_SensorInfo_T SensorInformation

Structure to hold logical identity to light sensor

void* SensorPtr

Pointer to structure containing hardware specific configuration

struct LightSensor_InterruptCallback_S

Data Fields

deferredInterruptCallback deferredCallback
 
interruptCallback rtCallback
 

Field Documentation

deferredInterruptCallback deferredCallback
interruptCallback rtCallback
struct LightSensor_SensorInfo_S

to hold the light sensor type and its initialization status

Data Fields

uint8_t initializationStatus
 
LightSensor_SensorID_T sensorID
 

Field Documentation

uint8_t initializationStatus

value to indicate whether the light sensor is properly initialized before

logical sensor ID to represents physical light sensor

Typedef Documentation

typedef void(* deferredInterruptCallback)(void *, uint32_t)

function pointer type used in deferred interrupt callback registration

typedef void(* interruptCallback)(void)

function pointer type used in real time interrupt callback registration

Enumeration Type Documentation

enum to represent Ambient light sensor supported brightness configurations

Enumerator
LIGHTSENSOR_NORMAL_BRIGHTNESS 

normal brightness

LIGHTSENSOR_HIGH_BRIGHTNESS 

high brightness

LIGHTSENSOR_BRIGHTNESS_OUT_OF_RANGE 

This Specifies maximum number of enum elements and it is used only for error handling

enum values to represent the interrupt status

Enumerator
LIGHTSENSOR_DISABLE_INTERRUPT 

interrupt disable

LIGHTSENSOR_ENABLE_INTERRUPT 

enable interrupt

LIGHTSENSOR_CONFIG_INTERRUPT_OUT_OF_RANGE 

This Specifies maximum number of enum elements and it is used only for error handling

enum values to configure the mode of the light sensor

Enumerator
LIGHTSENSOR_MAX44009_ENABLE_MODE 

ID to enable the manual/continuous mode of the light sensor

LIGHTSENSOR_MAX44009_DISABLE_MODE 

ID to disable the manual/continuous mode of the light sensor

LIGHTSENSOR_MODE_OUT_OF_RANGE 

This Specifies maximum number of enum elements and it is used only for error handling

enum values to represent the supported integration time values by the ambient light sensor

Enumerator
LIGHTSENSOR_800_MS 

800 ms integration time(time taken for capturing lux intensity)

LIGHTSENSOR_400MS 

400 ms integration time

LIGHTSENSOR_200MS 

200 ms integration time

LIGHTSENSOR_100MS 

100 ms integration time

LIGHTSENSOR_50MS 

50 ms integration time

LIGHTSENSOR_25MS 

25 ms integration time

LIGHTSENSOR_12P5MS 

12.5 ms integration time

LIGHTSENSOR_6P5MS 

6.5 ms integration time

LIGHTSENSOR_TIME_OUT_OF_RANGE 

This Specifies maximum number of enum elements and it is used only for error handling

enum values to represent light sensor types supported

Enumerator
LIGHTSENSOR_MAX44009 

ID to represents light sensor

LIGHTSENSOR_INVALID_ID 

This Specifies maximum number of enum elements and it is used only for error handling

Function Documentation

Retcode_T LightSensor_configureThresholdInterrupt ( LightSensor_HandlePtr_T  handle,
uint32_t  upperThreshold,
uint32_t  lowerThreshold,
uint32_t  thresholdTimer 
)
Parameters
[in]handleglobal handle of sensor
[in]upperThresholdupper threshold value to be programmed in upper threshold register for light sensor interrupt.
[in]lowerThresholdlower threshold value to be programmed in lower threshold register for light sensor interrupt.
[in]thresholdTimerthreshold timer value to be programmed in threshold timer register for light sensor interrupt.
Return values
RETCODE_SUCCESSInterrupt Configuration success.
RETCODE_UNINITIALIZEDif called without initializing the sensor.
RETCODE_INVALID_PARAMIn case of invalid sensor handle.
Returns
In case of other failures refer Max44009Utils_configInterrupt API's.
Note
The return value consist of (First 1 MSByte represents Package ID, Next byte represents Severity and Last 2 LSBytes represents error code).
Pass the return value of this function to BCDS_getSensorErrorCode API to know the sensor return code present in BCDS_SensorErrorType_E.

+ Here is the call graph for this function:

Retcode_T LightSensor_deInit ( LightSensor_HandlePtr_T  handle)
Parameters
[in]handleHandle to the light sensor object
Return values
RETCODE_SUCCESSSensor De-initialization success.
RETCODE_INVALID_PARAMIn case of invalid sensor handle.
Returns
In case of any other error refer Max44009Utils_uninitialize error codes.
Note
The return value consist of (First 1 MSByte represents Package ID, Next byte represents Severity and Last 2 LSBytes represents error code).
Pass the return value of this function to BCDS_getSensorErrorCode API to know the sensor return code present in BCDS_SensorErrorType_E.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Retcode_T LightSensor_disableInterrupt ( LightSensor_HandlePtr_T  handle)
Parameters
[in]handleHandle to the lightSensor object
Return values
RETCODE_SUCCESSDisable interrupt status is success.
RETCODE_UNINITIALIZEDif called without initializing the sensor.
RETCODE_INVALID_PARAMIn case of invalid sensor handle.
Returns
In case of other failures refer Max44009Utils_disableInterrupt API's.
Note
The return value consist of (First 1 MSByte represents Package ID, Next byte represents Severity and Last 2 LSBytes represents error code).
Pass the return value of this function to BCDS_getSensorErrorCode API to know the sensor return code present in BCDS_SensorErrorType_E.

+ Here is the call graph for this function:

Retcode_T LightSensor_getInterruptStatus ( LightSensor_HandlePtr_T  handle,
LightSensor_ConfigInterruptPtr_T  interruptStatus 
)
Parameters
[in]handleglobal handle of sensor
[out]interruptStatusholds the interrupt configuration that is configured
Return values
RETCODE_SUCCESSget interrupt status is success.
RETCODE_UNINITIALIZEDif called without initializing the sensor.
RETCODE_INVALID_PARAMIn case of invalid sensor handle.
RETCODE_NOT_SUPPORTEDIn case of getting interrupt status value other than LightSensor_ConfigInterrupt_E.
Note
The return value consist of (First 1 MSByte represents Package ID, Next byte represents Severity and Last 2 LSBytes represents error code).
Pass the return value of this function to BCDS_getSensorErrorCode API to know the sensor return code present in BCDS_SensorErrorType_E.

+ Here is the call graph for this function:

Retcode_T LightSensor_init ( LightSensor_HandlePtr_T  handle)
Parameters
[in]handleHandle to the light sensor object
Return values
RETCODE_SUCCESSLight sensor initialization success.
RETCODE_INVALID_PARAMIn case of invalid sensor handle.
Returns
In case of any other error refer Max44009Utils_initialize error codes.
Warning
This function needs to be called before calling any other light sensor API.
Note
The return value consist of (First 1 MSByte represents Package ID, Next byte represents Severity and Last 2 LSBytes represents error code).
Pass the return value of this function to BCDS_getSensorErrorCode API to know the sensor return code present in BCDS_SensorErrorType_E.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Retcode_T LightSensor_readLuxData ( LightSensor_HandlePtr_T  handle,
uint32_t *  luxData 
)
Parameters
[in]handleglobal handle of sensor
[out]luxDataholds sensor data in milli lux
Return values
RETCODE_SUCCESSReading lux data success.
RETCODE_UNINITIALIZEDif called without initializing the sensor.
RETCODE_INVALID_PARAMIn case of invalid sensor handle or NULL pointer arguments.
Returns
In case of other failures refer #MAX44009_getSensorData API's.
Note
The return value consist of (First 1 MSByte represents Package ID, Next byte represents Severity and Last 2 LSBytes represents error code).
Pass the return value of this function to BCDS_getSensorErrorCode API to know the sensor return code present in BCDS_SensorErrorType_E.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Retcode_T LightSensor_readRawData ( LightSensor_HandlePtr_T  handle,
uint16_t *  luxData 
)
Parameters
[in]handleglobal handle of sensor
[out]luxDataholds sensor data
Return values
RETCODE_SUCCESSReading raw data success.
RETCODE_UNINITIALIZEDif called without initializing the sensor.
RETCODE_INVALID_PARAMIn case of invalid sensor handle or NULL pointer arguments.
Returns
In case of other failures refer #MAX44009_getSensorData API's.
Note
The return value consist of (First 1 MSByte represents Package ID, Next byte represents Severity and Last 2 LSBytes represents error code).
Pass the return value of this function to BCDS_getSensorErrorCode API to know the sensor return code present in BCDS_SensorErrorType_E.

+ Here is the call graph for this function:

Retcode_T LightSensor_registerDeferredCallback ( LightSensor_HandlePtr_T  handle,
deferredInterruptCallback  deferredCallback 
)
Parameters
[in]handleglobal handle of sensor
[in]deferredInterruptCallbackfunction handle to register
Return values
RETCODE_SUCCESSRegistering deferred time callback is success.
RETCODE_UNINITIALIZEDif called without initializing the sensor.
RETCODE_INVALID_PARAMIn case of invalid sensor handle or NULL callback.
Note
The return value consist of (First 1 MSByte represents Package ID, Next byte represents Severity and Last 2 LSBytes represents error code).
Pass the return value of this function to BCDS_getSensorErrorCode API to know the sensor return code present in BCDS_SensorErrorType_E.

+ Here is the call graph for this function:

Retcode_T LightSensor_registerRealTimeCallback ( LightSensor_HandlePtr_T  handle,
interruptCallback  realTimeCallback 
)
Parameters
[in]handleglobal handle of sensor
[in]realTimeCallbackfunction handle to register
Return values
RETCODE_SUCCESSRegistering real time callback is success.
RETCODE_UNINITIALIZEDif called without initializing the sensor.
RETCODE_INVALID_PARAMIn case of invalid sensor handle or NULL callback.
Note
The return value consist of (First 1 MSByte represents Package ID, Next byte represents Severity and Last 2 LSBytes represents error code).
Pass the return value of this function to BCDS_getSensorErrorCode API to know the sensor return code present in BCDS_SensorErrorType_E.

+ Here is the call graph for this function:

Retcode_T LightSensor_setBrightness ( LightSensor_HandlePtr_T  handle,
LightSensor_ConfigBrightness_T  brightness 
)
Parameters
[in]handleglobal handle of sensor
[in]brightnessLightSensor_ConfigBrightness_T holds brightness configuration
Return values
RETCODE_SUCCESSSetting brightness success.
RETCODE_UNINITIALIZEDif called without initializing the sensor.
RETCODE_INVALID_PARAMIn case of invalid sensor handle.
RETCODE_NOT_SUPPORTEDIn case of setting brightness other than LightSensor_ConfigBrightness_E.
Returns
In case of other failures refer #MAX44009_setCdr API's.
Note
The return value consist of (First 1 MSByte represents Package ID, Next byte represents Severity and Last 2 LSBytes represents error code).
Pass the return value of this function to BCDS_getSensorErrorCode API to know the sensor return code present in BCDS_SensorErrorType_E.

+ Here is the call graph for this function:

Retcode_T LightSensor_setContinuousMode ( LightSensor_HandlePtr_T  handle,
LightSensor_ConfigMode_T  continuousMode 
)
Parameters
[in]handleHandle to the lightSensor object
[in]continuousModeThis variable holds the Continuous mode configuration
Return values
RETCODE_SUCCESSSetting continuous mode success.
RETCODE_UNINITIALIZEDif called without initializing the sensor.
RETCODE_INVALID_PARAMIn case of invalid sensor handle.
RETCODE_NOT_SUPPORTEDIn case of setting mode other than LightSensor_ConfigMode_E.
Returns
In case of other failures refer #MAX44009_setContinousModeReg API's.
Note
The return value consist of (First 1 MSByte represents Package ID, Next byte represents Severity and Last 2 LSBytes represents error code).
Pass the return value of this function to BCDS_getSensorErrorCode API to know the sensor return code present in BCDS_SensorErrorType_E.

+ Here is the call graph for this function:

Retcode_T LightSensor_setIntegrationTime ( LightSensor_HandlePtr_T  handle,
LightSensor_IntegrationTime_T  integrationTime 
)
Parameters
[in]handleglobal handle of sensor
[in]integrationTimeLightSensor_IntegrationTime_T holds the integration time configuration
Return values
RETCODE_SUCCESSSetting Integration time success.
RETCODE_UNINITIALIZEDif called without initializing the sensor.
RETCODE_INVALID_PARAMIn case of invalid sensor handle.
RETCODE_NOT_SUPPORTEDIn case of setting integration time other than LightSensor_IntegrationTime_E.
Returns
In case of other failures refer #MAX44009_setIntegrationTime API's.
Note
The return value consist of (First 1 MSByte represents Package ID, Next byte represents Severity and Last 2 LSBytes represents error code).
Pass the return value of this function to BCDS_getSensorErrorCode API to know the sensor return code present in BCDS_SensorErrorType_E.

+ Here is the call graph for this function:

Retcode_T LightSensor_setManualMode ( LightSensor_HandlePtr_T  handle,
LightSensor_ConfigMode_T  manualMode 
)
Parameters
[in]handleHandle to the lightSensor object
[in]manualModeThis variable holds the manual mode configuration
Return values
RETCODE_SUCCESSSetting manual mode success.
RETCODE_UNINITIALIZEDif called without initializing the sensor.
RETCODE_INVALID_PARAMIn case of invalid sensor handle.
RETCODE_NOT_SUPPORTEDIn case of setting mode other than LightSensor_ConfigMode_E.
Returns
In case of other failures refer #MAX44009_setManualModeReg API's.
Note
The return value consist of (First 1 MSByte represents Package ID, Next byte represents Severity and Last 2 LSBytes represents error code).
Pass the return value of this function to BCDS_getSensorErrorCode API to know the sensor return code present in BCDS_SensorErrorType_E.

+ Here is the call graph for this function:


All rights reserved. The use is subject to the XDK SDK EULA by Bosch Connected Devices and Solutions GmbH.
This documentation file has been automatically generated on Thu Mar 14 2019 19:12:51 by doxygen 1.8.8