Si1145/6/7 UV/Ambient light/Proximity sensors

Device driver for the Si1145/6/7 sensors family. More...

Detailed Description

Device driver for the Si1145/6/7 sensors family.

This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.

Files

file  si114x.h
 Device driver interface for the Si114x sensors family.
 
file  si114x_internals.h
 Internal addresses, registers, constants for the Si114x sensors family.
 
file  si114x_params.h
 Default configuration for SI114x.
 

Data Structures

struct  si114x_params_t
 Device initialization parameters. More...
 
struct  si114x_t
 Device descriptor for the Si114x sensor. More...
 

Enumerations

enum  si114x_ret_code_t { SI114X_OK, SI114X_ERR_I2C, SI114X_ERR_NODEV }
 Initialization return codes.
 
enum  si114x_led_current_t {
  SI114X_PS_LED1 = 1, SI114X_PS_LED2, SI114X_PS_LED3, SI114X_PS_LED4,
  SI114X_PS_LED5, SI114X_PS_LED6, SI114X_PS_LED7, SI114X_PS_LED8,
  SI114X_PS_LED9, SI114X_PS_LED10, SI114X_PS_LED11, SI114X_PS_LED12,
  SI114X_PS_LED13, SI114X_PS_LED14, SI114X_PS_LED15
}
 Active LED current parameters. More...
 

Functions

int8_t si114x_init (si114x_t *dev, const si114x_params_t *params)
 Initialize the given Si114x device. More...
 
uint16_t si114x_read_uv (si114x_t *dev)
 Read UV index from the given Si114x device. More...
 
uint16_t si114x_read_ir (si114x_t *dev)
 Read IR light value from the given Si114x device, returned in lx. More...
 
uint16_t si114x_read_visible (si114x_t *dev)
 Read visible light value from the given Si114x device, returned in lx. More...
 
uint16_t si114x_read_distance (si114x_t *dev)
 Read distance measure from the given Si114x device, returned in ADC counts. More...
 
uint8_t si114x_read_response (si114x_t *dev)
 Read the response register. More...
 

Enumeration Type Documentation

◆ si114x_led_current_t

Active LED current parameters.

Enumerator
SI114X_PS_LED1 

5.6mA

SI114X_PS_LED2 

11.2mA

SI114X_PS_LED3 

22.4mA

SI114X_PS_LED4 

45mA

SI114X_PS_LED5 

67mA

SI114X_PS_LED6 

90mA

SI114X_PS_LED7 

112mA

SI114X_PS_LED8 

135mA

SI114X_PS_LED9 

157mA

SI114X_PS_LED10 

180mA

SI114X_PS_LED11 

202mA

SI114X_PS_LED12 

224mA

SI114X_PS_LED13 

269mA

SI114X_PS_LED14 

314mA

SI114X_PS_LED15 

359mA

Definition at line 47 of file si114x.h.

Function Documentation

◆ si114x_init()

int8_t si114x_init ( si114x_t dev,
const si114x_params_t params 
)

Initialize the given Si114x device.

Parameters
[out]devInitialized device descriptor of Si114x device
[in]paramsInitialization parameters
Returns
SI114X_OK: all good
-SI114X_ERR_I2C: I2C bus cannot be initialized
-SI114X_ERR_NODEV: not a valid Si114x device

◆ si114x_read_distance()

uint16_t si114x_read_distance ( si114x_t dev)

Read distance measure from the given Si114x device, returned in ADC counts.

Parameters
[in]devDevice descriptor of Si114x device to read from
Returns
Distance in ADC counts

◆ si114x_read_ir()

uint16_t si114x_read_ir ( si114x_t dev)

Read IR light value from the given Si114x device, returned in lx.

Parameters
[in]devDevice descriptor of Si114x device to read from
Returns
IR light in lx

◆ si114x_read_response()

uint8_t si114x_read_response ( si114x_t dev)

Read the response register.

Parameters
[in]devDevice descriptor of Si114x device to read from
Returns
Device response register contents

◆ si114x_read_uv()

uint16_t si114x_read_uv ( si114x_t dev)

Read UV index from the given Si114x device.

Parameters
[in]devDevice descriptor of Si114x device to read from
Returns
UV index

◆ si114x_read_visible()

uint16_t si114x_read_visible ( si114x_t dev)

Read visible light value from the given Si114x device, returned in lx.

Parameters
[in]devDevice descriptor of Si114x device to read from
Returns
Visible light in lx