Si1133 - Light and UV Sensor#

Driver for the Silicon Labs Si1133 ambient light and UV sensor.


Si1133 usage example code#

Basic example for measuring light and UV-index:

#include "sl_i2cspm_instances.h"
#include "sl_si1133.h"

int main( void )
{

  ...

  // Initialize sensor using i2cspm instance for sensor
  sl_si1133_init(sl_i2cspm_sensor);

  // Measure
  float lux;
  float uvi;

  sl_si1133_measure_lux_uvi(sl_i2cspm_sensor, &lux, &uvi);

  ...

} 

Modules#

sl_si1133_samples_t

Si1133 Details

Functions#

sl_status_t
sl_si1133_init(sl_i2cspm_t *i2cspm)

Initialize the Si1133 chip.

sl_status_t
sl_si1133_deinit(sl_i2cspm_t *i2cspm)

Stop the measurements on all channel and waits until the chip goes to sleep state.

sl_status_t
sl_si1133_measure_lux_uvi(sl_i2cspm_t *i2cspm, float *lux, float *uvi)

Measure lux and UV index using the Si1133 sensor.

sl_status_t
sl_si1133_get_hardware_id(sl_i2cspm_t *i2cspm, uint8_t *hardwareID)

Read Hardware ID from the SI1133 sensor.

sl_status_t
sl_si1133_reset(sl_i2cspm_t *i2cspm)

Reset the Si1133.

sl_status_t
sl_si1133_reset_command_counter(sl_i2cspm_t *i2cspm)

Send a RESET COMMAND COUNTER command to the Si1133.

sl_status_t
sl_si1133_force_measurement(sl_i2cspm_t *i2cspm)

Send a FORCE command to the Si1133.

sl_status_t
sl_si1133_pause_measurement(sl_i2cspm_t *i2cspm)

Send a PAUSE command to the Si1133.

sl_status_t
sl_si1133_start_measurement(sl_i2cspm_t *i2cspm)

Send a START command to the Si1133.

sl_status_t
sl_si1133_set_parameter(sl_i2cspm_t *i2cspm, uint8_t address, uint8_t value)

Write a byte to an Si1133 Parameter.

sl_status_t
sl_si1133_read_parameter(sl_i2cspm_t *i2cspm, uint8_t address)

Read a parameter from the Si1133.

sl_status_t
sl_si1133_read_samples(sl_i2cspm_t *i2cspm, sl_si1133_samples_t *samples)

Read samples from the Si1133 chip.

sl_status_t
sl_si1133_get_measurement(sl_i2cspm_t *i2cspm, float *lux, float *uvi)

Retrieve the sample values from the chip and convert them to lux and UV index values.

sl_status_t
sl_si1133_get_irq_status(sl_i2cspm_t *i2cspm, uint8_t *irqStatus)

Read the interrupt status register of the device.

Function Documentation#

sl_si1133_init#

sl_status_t sl_si1133_init (sl_i2cspm_t * i2cspm)

Initialize the Si1133 chip.

Parameters
[in]i2cspm

The I2C peripheral to use.


Definition at line 214 of file hardware/driver/si1133/inc/sl_si1133.h

sl_si1133_deinit#

sl_status_t sl_si1133_deinit (sl_i2cspm_t * i2cspm)

Stop the measurements on all channel and waits until the chip goes to sleep state.

Parameters
[in]i2cspm

The I2C peripheral to use.


Definition at line 227 of file hardware/driver/si1133/inc/sl_si1133.h

sl_si1133_measure_lux_uvi#

sl_status_t sl_si1133_measure_lux_uvi (sl_i2cspm_t * i2cspm, float * lux, float * uvi)

Measure lux and UV index using the Si1133 sensor.

Parameters
[in]i2cspm

The I2C peripheral to use.

[out]lux

The measured ambient light illuminance in lux

[out]uvi

The measured UV index


Definition at line 245 of file hardware/driver/si1133/inc/sl_si1133.h

sl_si1133_get_hardware_id#

sl_status_t sl_si1133_get_hardware_id (sl_i2cspm_t * i2cspm, uint8_t * hardwareID)

Read Hardware ID from the SI1133 sensor.

Parameters
[in]i2cspm

The I2C peripheral to use.

[out]hardwareID

The Hardware ID of the chip (should be 0x33)


Definition at line 260 of file hardware/driver/si1133/inc/sl_si1133.h

sl_si1133_reset#

sl_status_t sl_si1133_reset (sl_i2cspm_t * i2cspm)

Reset the Si1133.

Parameters
[in]i2cspm

The I2C peripheral to use.


Definition at line 356 of file hardware/driver/si1133/inc/sl_si1133.h

sl_si1133_reset_command_counter#

sl_status_t sl_si1133_reset_command_counter (sl_i2cspm_t * i2cspm)

Send a RESET COMMAND COUNTER command to the Si1133.

Parameters
[in]i2cspm

The I2C peripheral to use.


Definition at line 368 of file hardware/driver/si1133/inc/sl_si1133.h

sl_si1133_force_measurement#

sl_status_t sl_si1133_force_measurement (sl_i2cspm_t * i2cspm)

Send a FORCE command to the Si1133.

Parameters
[in]i2cspm

The I2C peripheral to use.


Definition at line 380 of file hardware/driver/si1133/inc/sl_si1133.h

sl_si1133_pause_measurement#

sl_status_t sl_si1133_pause_measurement (sl_i2cspm_t * i2cspm)

Send a PAUSE command to the Si1133.

Parameters
[in]i2cspm

The I2C peripheral to use.


Definition at line 392 of file hardware/driver/si1133/inc/sl_si1133.h

sl_si1133_start_measurement#

sl_status_t sl_si1133_start_measurement (sl_i2cspm_t * i2cspm)

Send a START command to the Si1133.

Parameters
[in]i2cspm

The I2C peripheral to use.


Definition at line 404 of file hardware/driver/si1133/inc/sl_si1133.h

sl_si1133_set_parameter#

sl_status_t sl_si1133_set_parameter (sl_i2cspm_t * i2cspm, uint8_t address, uint8_t value)

Write a byte to an Si1133 Parameter.

Parameters
[in]i2cspm

The I2C peripheral to use.

[in]address

The parameter address

[in]value

The byte value to be written to the Si1133 parameter

Note

  • This function ensures that the Si1133 is idle and ready to receive a command before writing the parameter. Furthermore, command completion is checked. If setting parameter is not done properly, no measurements will occur. This is the most common error. It is highly recommended that host code make use of this function.


Definition at line 430 of file hardware/driver/si1133/inc/sl_si1133.h

sl_si1133_read_parameter#

sl_status_t sl_si1133_read_parameter (sl_i2cspm_t * i2cspm, uint8_t address)

Read a parameter from the Si1133.

Parameters
[in]i2cspm

The I2C peripheral to use.

[in]address

The address of the parameter.


Definition at line 445 of file hardware/driver/si1133/inc/sl_si1133.h

sl_si1133_read_samples#

sl_status_t sl_si1133_read_samples (sl_i2cspm_t * i2cspm, sl_si1133_samples_t * samples)

Read samples from the Si1133 chip.

Parameters
[in]i2cspm

The I2C peripheral to use.

[out]samples

Retrieves interrupt status and measurement data for channel 0..3 and converts the data to int32_t format


Definition at line 461 of file hardware/driver/si1133/inc/sl_si1133.h

sl_si1133_get_measurement#

sl_status_t sl_si1133_get_measurement (sl_i2cspm_t * i2cspm, float * lux, float * uvi)

Retrieve the sample values from the chip and convert them to lux and UV index values.

Parameters
[in]i2cspm

The I2C peripheral to use.

[out]lux

The measured ambient light illuminance in lux

[out]uvi

UV index


Definition at line 480 of file hardware/driver/si1133/inc/sl_si1133.h

sl_si1133_get_irq_status#

sl_status_t sl_si1133_get_irq_status (sl_i2cspm_t * i2cspm, uint8_t * irqStatus)

Read the interrupt status register of the device.

Parameters
[in]i2cspm

The I2C peripheral to use.

[out]irqStatus

The content of the IRQ status register


Definition at line 495 of file hardware/driver/si1133/inc/sl_si1133.h