EFM32 Happy Gecko Software Documentation  efm32hg-doc-5.1.2
si1133.h File Reference

Detailed Description

Driver for the Si1133 Ambient Light and UV sensor.

Version
5.1.1

License

Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com

This file is licensed under the Silicon Labs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.

Definition in file si1133.h.

#include "si1133_config.h"

Go to the source code of this file.

Data Structures

struct  SI1133_Coeff_TypeDef
 Structure to store the calculation coefficients. More...
 
struct  SI1133_LuxCoeff_TypeDef
 Structure to store the coefficients used for Lux calculation. More...
 
struct  SI1133_Samples_TypeDef
 Structure to store the data measured by the Si1133. More...
 

Macros

#define SI1133_CMD_FORCE_CH   0x11
 
#define SI1133_CMD_NEW_ADDR   0x02
 
#define SI1133_CMD_PARAM_QUERY   0x40
 
#define SI1133_CMD_PARAM_SET   0x80
 
#define SI1133_CMD_PAUSE_CH   0x12
 
#define SI1133_CMD_RESET   0x01
 
#define SI1133_CMD_RESET_CMD_CTR   0x00
 
#define SI1133_CMD_START   0x13
 
#define SI1133_CONFIG_I2C_BUS_ADDRESS   (0xAA)
 
#define SI1133_CONFIG_I2C_DEVICE   (I2C0)
 
#define SI1133_ERROR_I2C_TRANSACTION_FAILED   0x0001
 
#define SI1133_ERROR_SLEEP_FAILED   0x0002
 
#define SI1133_I2C_DEVICE   (SI1133_CONFIG_I2C_DEVICE)
 
#define SI1133_I2C_DEVICE_BUS_ADDRESS   (SI1133_CONFIG_I2C_BUS_ADDRESS)
 
#define SI1133_OK   0x0000
 
#define SI1133_PARAM_ADCCONFIG0   0x02
 
#define SI1133_PARAM_ADCCONFIG1   0x06
 
#define SI1133_PARAM_ADCCONFIG2   0x0A
 
#define SI1133_PARAM_ADCCONFIG3   0x0E
 
#define SI1133_PARAM_ADCCONFIG4   0x12
 
#define SI1133_PARAM_ADCCONFIG5   0x16
 
#define SI1133_PARAM_ADCPOST0   0x04
 
#define SI1133_PARAM_ADCPOST1   0x08
 
#define SI1133_PARAM_ADCPOST2   0x0C
 
#define SI1133_PARAM_ADCPOST3   0x10
 
#define SI1133_PARAM_ADCPOST4   0x14
 
#define SI1133_PARAM_ADCPOST5   0x18
 
#define SI1133_PARAM_ADCSENS0   0x03
 
#define SI1133_PARAM_ADCSENS1   0x07
 
#define SI1133_PARAM_ADCSENS2   0x0B
 
#define SI1133_PARAM_ADCSENS3   0x0F
 
#define SI1133_PARAM_ADCSENS4   0x13
 
#define SI1133_PARAM_ADCSENS5   0x17
 
#define SI1133_PARAM_BURST   0x2B
 
#define SI1133_PARAM_CH_LIST   0x01
 
#define SI1133_PARAM_I2C_ADDR   0x00
 
#define SI1133_PARAM_MEASCONFIG0   0x05
 
#define SI1133_PARAM_MEASCONFIG1   0x09
 
#define SI1133_PARAM_MEASCONFIG2   0x0D
 
#define SI1133_PARAM_MEASCONFIG3   0x11
 
#define SI1133_PARAM_MEASCONFIG4   0x15
 
#define SI1133_PARAM_MEASCONFIG5   0x19
 
#define SI1133_PARAM_MEASCOUNT0   0x1C
 
#define SI1133_PARAM_MEASCOUNT1   0x1D
 
#define SI1133_PARAM_MEASCOUNT2   0x1E
 
#define SI1133_PARAM_MEASRATE_H   0x1A
 
#define SI1133_PARAM_MEASRATE_L   0x1B
 
#define SI1133_PARAM_THRESHOLD0_H   0x25
 
#define SI1133_PARAM_THRESHOLD0_L   0x26
 
#define SI1133_PARAM_THRESHOLD1_H   0x27
 
#define SI1133_PARAM_THRESHOLD1_L   0x28
 
#define SI1133_PARAM_THRESHOLD2_H   0x29
 
#define SI1133_PARAM_THRESHOLD2_L   0x2A
 
#define SI1133_REG_COMMAND   0x0B
 
#define SI1133_REG_HOSTIN0   0x0A
 
#define SI1133_REG_HOSTOUT0   0x13
 
#define SI1133_REG_HOSTOUT1   0x14
 
#define SI1133_REG_HOSTOUT10   0x1D
 
#define SI1133_REG_HOSTOUT11   0x1E
 
#define SI1133_REG_HOSTOUT12   0x1F
 
#define SI1133_REG_HOSTOUT13   0x20
 
#define SI1133_REG_HOSTOUT14   0x21
 
#define SI1133_REG_HOSTOUT15   0x22
 
#define SI1133_REG_HOSTOUT16   0x23
 
#define SI1133_REG_HOSTOUT17   0x24
 
#define SI1133_REG_HOSTOUT18   0x25
 
#define SI1133_REG_HOSTOUT19   0x26
 
#define SI1133_REG_HOSTOUT2   0x15
 
#define SI1133_REG_HOSTOUT20   0x27
 
#define SI1133_REG_HOSTOUT21   0x28
 
#define SI1133_REG_HOSTOUT22   0x29
 
#define SI1133_REG_HOSTOUT23   0x2A
 
#define SI1133_REG_HOSTOUT24   0x2B
 
#define SI1133_REG_HOSTOUT25   0x2C
 
#define SI1133_REG_HOSTOUT3   0x16
 
#define SI1133_REG_HOSTOUT4   0x17
 
#define SI1133_REG_HOSTOUT5   0x18
 
#define SI1133_REG_HOSTOUT6   0x19
 
#define SI1133_REG_HOSTOUT7   0x1A
 
#define SI1133_REG_HOSTOUT8   0x1B
 
#define SI1133_REG_HOSTOUT9   0x1C
 
#define SI1133_REG_HW_ID   0x01
 
#define SI1133_REG_IRQ_ENABLE   0x0F
 
#define SI1133_REG_IRQ_STATUS   0x12
 
#define SI1133_REG_PART_ID   0x00
 
#define SI1133_REG_RESPONSE0   0x11
 
#define SI1133_REG_RESPONSE1   0x10
 
#define SI1133_REG_REV_ID   0x02
 
#define SI1133_RSP0_CHIPSTAT_MASK   0xE0
 
#define SI1133_RSP0_COUNTER_MASK   0x1F
 
#define SI1133_RSP0_SLEEP   0x20
 

Functions

uint32_t SI1133_deInit (void)
 Stops the measurements on all channel and waits until the chip goes to sleep state. More...
 
uint32_t SI1133_getHardwareID (uint8_t *hardwareID)
 Reads Hardware ID from the SI1133 sensor. More...
 
uint32_t SI1133_getIrqStatus (uint8_t *irqStatus)
 Reads the interrupt status register of the device. More...
 
int32_t SI1133_getLux (int32_t vis_high, int32_t vis_low, int32_t ir, SI1133_LuxCoeff_TypeDef *lk)
 Compute lux value. More...
 
uint32_t SI1133_getMeasurement (float *lux, float *uvi)
 Retrieve the sample values from the chip and convert them to lux and UV index values. More...
 
int32_t SI1133_getUv (int32_t uv, SI1133_Coeff_TypeDef *uk)
 Compute UV index. More...
 
uint32_t SI1133_init (void)
 Initializes the Si1133 chip. More...
 
uint32_t SI1133_measureLuxUvi (float *lux, float *uvi)
 Measure lux and UV index using the Si1133 sensor. More...
 
uint32_t SI1133_measurementForce (void)
 Sends a FORCE command to the Si1133. More...
 
uint32_t SI1133_measurementGet (SI1133_Samples_TypeDef *samples)
 Read samples from the Si1133 chip. More...
 
static uint32_t SI1133_measurementPause (void)
 Sends a PAUSE command to the Si1133. More...
 
uint32_t SI1133_measurementStart (void)
 Sends a START command to the Si1133. More...
 
uint32_t SI1133_paramRead (uint8_t address)
 Reads a parameter from the Si1133. More...
 
uint32_t SI1133_paramSet (uint8_t address, uint8_t value)
 Writes a byte to an Si1133 Parameter. More...
 
uint32_t SI1133_registerBlockRead (uint8_t reg, uint8_t length, uint8_t *data)
 Reads a block of data from the Si1133 sensor. More...
 
uint32_t SI1133_registerBlockWrite (uint8_t reg, uint8_t length, uint8_t *data)
 Writes a block of data to the Si1133 sensor. More...
 
uint32_t SI1133_registerRead (uint8_t reg, uint8_t *data)
 Reads register from the Si1133 sensor. More...
 
uint32_t SI1133_registerWrite (uint8_t reg, uint8_t data)
 Writes register in the Si1133 sensor. More...
 
uint32_t SI1133_reset (void)
 Resets the Si1133. More...
 
uint32_t SI1133_resetCmdCtr (void)
 Sends a RESET COMMAND COUNTER command to the Si1133. More...