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#
Functions#
Initialize the Si1133 chip.
Stop the measurements on all channel and waits until the chip goes to sleep state.
Measure lux and UV index using the Si1133 sensor.
Read Hardware ID from the SI1133 sensor.
Reset the Si1133.
Send a RESET COMMAND COUNTER command to the Si1133.
Send a FORCE command to the Si1133.
Send a PAUSE command to the Si1133.
Send a START command to the Si1133.
Write a byte to an Si1133 Parameter.
Read a parameter from the Si1133.
Read samples from the Si1133 chip.
Retrieve the sample values from the chip and convert them to lux and UV index values.
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.
[in] | i2cspm | The I2C peripheral to use. |
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.
[in] | i2cspm | The I2C peripheral to use. |
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.
[in] | i2cspm | The I2C peripheral to use. |
[out] | lux | The measured ambient light illuminance in lux |
[out] | uvi | The measured UV index |
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.
[in] | i2cspm | The I2C peripheral to use. |
[out] | hardwareID | The Hardware ID of the chip (should be 0x33) |
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.
[in] | i2cspm | The I2C peripheral to use. |
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.
[in] | i2cspm | The I2C peripheral to use. |
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.
[in] | i2cspm | The I2C peripheral to use. |
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.
[in] | i2cspm | The I2C peripheral to use. |
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.
[in] | i2cspm | The I2C peripheral to use. |
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.
[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.
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.
[in] | i2cspm | The I2C peripheral to use. |
[in] | address | The address of the parameter. |
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.
[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 |
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.
[in] | i2cspm | The I2C peripheral to use. |
[out] | lux | The measured ambient light illuminance in lux |
[out] | uvi | UV index |
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.
[in] | i2cspm | The I2C peripheral to use. |
[out] | irqStatus | The content of the IRQ status register |
495
of file hardware/driver/si1133/inc/sl_si1133.h