Sensor Example; Initializing Light Sensor - Bosch XDK110 Quick Start Manual

Cross-domain development kit
Hide thumbs Also See for XDK110:
Table of Contents

Advertisement

!

3. Sensor Example

Following the first own sensor measuring will be implemented. The reason why the light sensor will be
implemented is because the search for mistakes is relatively simple. As described before the example will be
implemented in the recommended XdkApplicationTemplate project.
Note:
appInitSystem()
To provide all necessary functions of the light sensor, the interface BCDS_LightSensor.h has to be included,
like it is shown in the following code 7. This interface contains all required functions to initialize and use the
light sensor.
Code 7: Including sensor specified header
/* Include this code in XdkApplicationTemplate.c */
#include
"BCDS_LightSensor.h"
!
Alternatively an interface can be included that holds references to all sensors of the XDK which makes them
accessible. Please not that this interface only needs to be included once, no matter how many sensors are
used. This is in contrast to the sensor specific interface where one is needed for each sensor in use.
Code 8: Including primary header
#include
"XdkSensorHandle.h"
!
Note: The interface
BCDS_LightSensor.h
XDK.

3.1 Initializing light sensor

The next step is to initialize the light sensor.
Code 9: Implementation of the initialization of the light sensor
/* Include this code in XdkApplicationTemplate.c */
static void
initLightSensor(void){
/* initialize light sensor */
Retcode_T
returnValue = LightSensor_init(xdkLightSensor_MAX44009_Handle);
if
(
RETCODE_OK
printf("Light Sensor initialization
}
}
!
XDK110
© Bosch Connected Devices and Solutions GmbH reserves all rights even in the event of industrial property rights. We reserve all rights of disposal such as
copying and passing on to third parties. BOSCH and the symbol are registered trademarks of Robert Bosch GmbH, Germany.
Note: Specifications within this document are subject to change without notice.
Workbench First Steps Guide XDK110
is required for the example and should not be deleted
XdkSensorHandle.h
of the light sensor too and it also contains the interfaces of all other sensors of the
returnValue = RETCODE_FAILURE;
!= returnValue){
has the advantage that it includes the header file
Failed\n\r");
Page ! 1 8
BCDS

Advertisement

Table of Contents
loading

Table of Contents