Microchip® Advanced Software Framework

sfh5712.h File Reference

Osram SFH5712 light sensor driver.

This file contains functions for initializing and reading data from a Osram SFH5712 light sensor.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>

Macros

#define SFH5712_DATA_RESOLUTION   (16)
 
#define SFH5712_TWI_ADDR   (0x29)
 
#define SFH5712_ALS_CONTROL   (0x80) /* ambient light sensor control */
 SFH5712 Register Addresses. More...
 
#define SFH5712_PART_ID   (0x8A) /* part id & revision */
 
#define SFH5712_MAN_ID   (0x8B) /* manufacturer id */
 
#define SFH5712_ALS_DATA_LSB   (0x8C) /* light meas data (low 8 bits) */
 
#define SFH5712_ALS_DATA_MSB   (0x8D) /* light meas data (high 8 bits) */
 
#define ALS_MODE_MASK   (0x03) /* light sensor mode mask */
 SFH5712 Register Bit Definitions. More...
 
#define ALS_MODE_STANDBY   (0x00) /* standby mode (default) */
 
#define ALS_MODE_ACTIVE   (0x03) /* active mode */
 
#define PART_REV_MASK   (0x0F) /* SFH5712 chip revision bit mask */
 
#define PART_ID_MASK   (0xF0) /* SFH5712 chip id bit mask */
 
#define PART_ID_SHIFT
 
#define SFH5712_PART_ID_VAL   (0x80) /* expected chip id field value */
 
#define SFH5712_PART_REV_VAL
 
#define SFH5712_MAN_ID_VAL   (0x03) /* expected manufacturer id value */
 

Functions

bool sfh5712_init (sensor_t *, int)
 Osram SFH5712 light sensor driver initialization. More...
 

#define ALS_MODE_ACTIVE   (0x03) /* active mode */

Referenced by sfh5712_init(), and sfh5712_set_state().

#define ALS_MODE_MASK   (0x03) /* light sensor mode mask */

SFH5712 Register Bit Definitions.

#define ALS_MODE_STANDBY   (0x00) /* standby mode (default) */
#define PART_ID_MASK   (0xF0) /* SFH5712 chip id bit mask */
#define PART_ID_SHIFT
Value:
(0x04) /* bit shift for part ID (upper 4
* bits) */

Referenced by sfh5712_device_id(), and sfh7770_device_id().

#define PART_REV_MASK   (0x0F) /* SFH5712 chip revision bit mask */
#define SFH5712_ALS_CONTROL   (0x80) /* ambient light sensor control */

SFH5712 Register Addresses.

Referenced by sfh5712_init(), and sfh5712_set_state().

#define SFH5712_ALS_DATA_LSB   (0x8C) /* light meas data (low 8 bits) */

Referenced by sfh5712_get_light().

#define SFH5712_ALS_DATA_MSB   (0x8D) /* light meas data (high 8 bits) */
#define SFH5712_DATA_RESOLUTION   (16)

Referenced by sfh5712_init().

#define SFH5712_MAN_ID   (0x8B) /* manufacturer id */
#define SFH5712_MAN_ID_VAL   (0x03) /* expected manufacturer id value */
#define SFH5712_PART_ID   (0x8A) /* part id & revision */

Referenced by sfh5712_device_id(), and sfh5712_init().

#define SFH5712_PART_ID_VAL   (0x80) /* expected chip id field value */

Referenced by sfh5712_init().

#define SFH5712_PART_REV_VAL
Value:
(0x04) /* expected chip revision field
* value */

Referenced by sfh5712_init().

#define SFH5712_TWI_ADDR   (0x29)

bool sfh5712_init ( sensor_t sensor,
int  resvd 
)

Osram SFH5712 light sensor driver initialization.

This is the main initialization function for the SFH5712 device.

Parameters
sensorAddress of a sensor device descriptor.
resvdReserved value.
Returns
bool true if the call succeeds, else false is returned.

References ALS_MODE_ACTIVE, sensor_desc::drv, sensor_device_t::func, sensor_desc::hal, sensor_funcs_t::read, sensor_hal::resolution, sensor_bus_get, sensor_bus_put, SENSOR_SCALE_one, SENSOR_UNITS_lux, SENSOR_VENDOR_OSRAM, SFH5712_ALS_CONTROL, SFH5712_DATA_RESOLUTION, sfh5712_ioctl(), SFH5712_PART_ID, SFH5712_PART_ID_VAL, SFH5712_PART_REV_VAL, sfh5712_read(), and status.