Device driver interface for the VCNL40X0 Proximity and Ambient Light Sensors. More...
Device driver interface for the VCNL40X0 Proximity and Ambient Light Sensors.
Files | |
file | vcnl40x0.h |
Device driver interface for the VCNL40X0 sensors family. | |
file | vcnl40x0_internals.h |
Internal addresses, registers, constants for the VCNL40X0 devices. | |
file | vcnl40x0_params.h |
Default configuration for VCNL40X0 devices. | |
Data Structures | |
struct | vcnl40x0_params_t |
Device initialization parameters. More... | |
struct | vcnl40x0_t |
Device descriptor for the VCNL40X0 sensor. More... | |
Enumerations | |
enum | { VCNL40X0_PROXIMITY_RATE_2 = 0 , VCNL40X0_PROXIMITY_RATE_4 , VCNL40X0_PROXIMITY_RATE_8 , VCNL40X0_PROXIMITY_RATE_16 , VCNL40X0_PROXIMITY_RATE_31 , VCNL40X0_PROXIMITY_RATE_62 , VCNL40X0_PROXIMITY_RATE_125 , VCNL40X0_PROXIMITY_RATE_250 } |
Proximity measure rate. More... | |
enum | { VCNL40X0_AMBIENT_RATE_1 = 0 , VCNL40X0_AMBIENT_RATE_2 , VCNL40X0_AMBIENT_RATE_3 , VCNL40X0_AMBIENT_RATE_4 , VCNL40X0_AMBIENT_RATE_5 , VCNL40X0_AMBIENT_RATE_6 , VCNL40X0_AMBIENT_RATE_8 , VCNL40X0_AMBIENT_RATE_10 } |
Ambient light measurement rate. More... | |
enum | { VCNL40X0_AMBIENT_AVERAGE_1 = 0 , VCNL40X0_AMBIENT_AVERAGE_2 , VCNL40X0_AMBIENT_AVERAGE_4 , VCNL40X0_AMBIENT_AVERAGE_8 , VCNL40X0_AMBIENT_AVERAGE_16 , VCNL40X0_AMBIENT_AVERAGE_32 , VCNL40X0_AMBIENT_AVERAGE_64 , VCNL40X0_AMBIENT_AVERAGE_128 } |
Ambient light number of conversions during one measurement cycle. More... | |
enum | { VCNL40X0_OK = 0 , VCNL40X0_ERR_I2C , VCNL40X0_ERR_NODEV } |
Status and error return codes. More... | |
Functions | |
int | vcnl40x0_init (vcnl40x0_t *dev, const vcnl40x0_params_t *params) |
Initialize the given VCNL40X0 device. | |
uint16_t | vcnl40x0_read_proximity (const vcnl40x0_t *dev) |
Read proximity value from the vcnl40X0 device. | |
uint16_t | vcnl40x0_read_ambient_light (const vcnl40x0_t *dev) |
Read ambient light value from the vcnl40X0 device. | |
uint16_t | vcnl40x0_read_illuminance (const vcnl40x0_t *dev) |
Read illuminance value from the vcnl40X0 device. | |
anonymous enum |
Proximity measure rate.
Definition at line 36 of file vcnl40x0.h.
anonymous enum |
Ambient light measurement rate.
Definition at line 50 of file vcnl40x0.h.
anonymous enum |
Ambient light number of conversions during one measurement cycle.
Number of conversions = 2^decimal value
Definition at line 66 of file vcnl40x0.h.
anonymous enum |
Status and error return codes.
Enumerator | |
---|---|
VCNL40X0_OK | Everything was fine. |
VCNL40X0_ERR_I2C | Error initializing the I2C bus. |
VCNL40X0_ERR_NODEV | Error wrong device. |
Definition at line 80 of file vcnl40x0.h.
int vcnl40x0_init | ( | vcnl40x0_t * | dev, |
const vcnl40x0_params_t * | params | ||
) |
Initialize the given VCNL40X0 device.
[out] | dev | Initialized device descriptor of VCNL40X0 device |
[in] | params | The parameters for the VCNL40X0 device |
uint16_t vcnl40x0_read_ambient_light | ( | const vcnl40x0_t * | dev | ) |
Read ambient light value from the vcnl40X0 device.
[in] | dev | Device descriptor of VCNL40X0 device to read from |
uint16_t vcnl40x0_read_illuminance | ( | const vcnl40x0_t * | dev | ) |
Read illuminance value from the vcnl40X0 device.
[in] | dev | Device descriptor of VCNL40X0 device to read from |
uint16_t vcnl40x0_read_proximity | ( | const vcnl40x0_t * | dev | ) |
Read proximity value from the vcnl40X0 device.
[in] | dev | Device descriptor of VCNL40X0 device to read from |