monoZ docs
MZ_Addon_Si1133.h File Reference
#include "stdio.h"
#include "math.h"
#include "stdlib.h"
#include "stdint.h"

Go to the source code of this file.

Data Structures

struct  Si1133_coeff
 
struct  Si1133_LuxCoeff
 

Enumerations

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

Functions

struct __attribute ((packed))
 Structure to store the data measured by the Si1133. More...
 
Si1133_error SI1133_init (void)
 
Si1133_error SI1133_deinit (void)
 
Si1133_error SI1133_get_hardware_id (uint8_t *hardware_id)
 
Si1133_error SI1133_measure_lux_uv (float *lux, float *uvi)
 
Si1133_error SI1133_get_measurement (float *lux, float *uvi)
 
float SI1133_get_light_level (void)
 
float SI1133_get_uv_index (void)
 

Variables

 Si1133_samples
 

Enumeration Type Documentation

◆ Si1133_register

Enumerator
SI1133_REG_PART_ID 

Part ID.

SI1133_REG_HW_ID 

Hardware ID.

SI1133_REG_REV_ID 

Hardware revision.

SI1133_REG_INFO0 

Info 0.

SI1133_REG_INFO1 

Info 1.

SI1133_REG_HOSTIN3 

Host 3.

SI1133_REG_HOSTIN2 

Host 2.

SI1133_REG_HOSTIN1 

Host 1.

SI1133_REG_HOSTIN0 

Host 0 -Data for parameter table on PARAM_SET write to COMMAND register.

SI1133_REG_COMMAND 

Initiated action in Sensor when specific codes written here.

SI1133_REG_IRQ_ENABLE 

Interrupt enable

SI1133_REG_RESPONSE1 

Contains the readback value from a query or a set command.

SI1133_REG_RESPONSE0 

Chip state and error status.

SI1133_REG_IRQ_STATUS 

Interrupt status.

SI1133_REG_HOSTOUT0 

Captured Sensor Data.

SI1133_REG_HOSTOUT1 

Captured Sensor Data.

SI1133_REG_HOSTOUT2 

Captured Sensor Data.

SI1133_REG_HOSTOUT3 

Captured Sensor Data.

SI1133_REG_HOSTOUT4 

Captured Sensor Data.

SI1133_REG_HOSTOUT5 

Captured Sensor Data.

SI1133_REG_HOSTOUT6 

Captured Sensor Data.

SI1133_REG_HOSTOUT7 

Captured Sensor Data.

SI1133_REG_HOSTOUT8 

Captured Sensor Data.

SI1133_REG_HOSTOUT9 

Captured Sensor Data.

SI1133_REG_HOSTOUT10 

Captured Sensor Data.

SI1133_REG_HOSTOUT11 

Captured Sensor Data.

SI1133_REG_HOSTOUT12 

Captured Sensor Data.

SI1133_REG_HOSTOUT13 

Captured Sensor Data.

SI1133_REG_HOSTOUT14 

Captured Sensor Data.

SI1133_REG_HOSTOUT15 

Captured Sensor Data.

SI1133_REG_HOSTOUT16 

Captured Sensor Data.

SI1133_REG_HOSTOUT17 

Captured Sensor Data.

SI1133_REG_HOSTOUT18 

Captured Sensor Data.

SI1133_REG_HOSTOUT19 

Captured Sensor Data.

SI1133_REG_HOSTOUT20 

Captured Sensor Data.

SI1133_REG_HOSTOUT21 

Captured Sensor Data.

SI1133_REG_HOSTOUT22 

Captured Sensor Data.

SI1133_REG_HOSTOUT23 

Captured Sensor Data.

SI1133_REG_HOSTOUT24 

Captured Sensor Data.

SI1133_REG_HOSTOUT25 

Captured Sensor Data.

Definition at line 23 of file MZ_Addon_Si1133.h.

◆ Si1133_parameter

Enumerator
SI1133_PARAM_I2C_ADDR 

I2C address.

SI1133_PARAM_CH_LIST 

Channel list.

SI1133_PARAM_ADCCONFIG0 

ADC config for Channel 0.

SI1133_PARAM_ADCSENS0 

ADC sensitivity setting for Channel 0.

SI1133_PARAM_ADCPOST0 

ADC resolution, shift and threshold settings for Channel 0.

SI1133_PARAM_MEASCONFIG0 

ADC measurement counter selection for Channel 0.

SI1133_PARAM_ADCCONFIG1 

ADC config for Channel 1.

SI1133_PARAM_ADCSENS1 

ADC sensitivity setting for Channel 1.

SI1133_PARAM_ADCPOST1 

ADC resolution, shift and threshold settings for Channel 1.

SI1133_PARAM_MEASCONFIG1 

ADC measurement counter selection for Channel 1.

SI1133_PARAM_ADCCONFIG2 

ADC config for Channel 2.

SI1133_PARAM_ADCSENS2 

ADC sensitivity setting for Channel 2.

SI1133_PARAM_ADCPOST2 

ADC resolution, shift and threshold settings for Channel 2.

SI1133_PARAM_MEASCONFIG2 

ADC measurement counter selection for Channel 2.

SI1133_PARAM_ADCCONFIG3 

ADC config for Channel 3

SI1133_PARAM_ADCSENS3 

ADC sensitivity setting for Channel 3.

SI1133_PARAM_ADCPOST3 

ADC resolution, shift and threshold settings for Channel 3.

SI1133_PARAM_MEASCONFIG3 

ADC measurement counter selection for Channel 3.

SI1133_PARAM_ADCCONFIG4 

ADC config for Channel 4.

SI1133_PARAM_ADCSENS4 

ADC sensitivity setting for Channel 4.

SI1133_PARAM_ADCPOST4 

ADC resolution, shift and threshold settings for Channel 4.

SI1133_PARAM_MEASCONFIG4 

ADC measurement counter selection for Channel 4.

SI1133_PARAM_ADCCONFIG5 

ADC config for Channel 5.

SI1133_PARAM_ADCSENS5 

ADC sensitivity setting for Channel 5.

SI1133_PARAM_ADCPOST5 

ADC resolution, shift and threshold settings for Channel 5.

SI1133_PARAM_MEASCONFIG5 

ADC measurement counter selection for Channel 5.

SI1133_PARAM_MEASRATE_H 

Main measurement rate counter MSB.

SI1133_PARAM_MEASRATE_L 

Main measurement rate counter LSB.

SI1133_PARAM_MEASCOUNT0 

Measurement rate extension counter 0.

SI1133_PARAM_MEASCOUNT1 

Measurement rate extension counter 1.

SI1133_PARAM_MEASCOUNT2 

Measurement rate extension counter 2.

SI1133_PARAM_THRESHOLD0_H 

Threshold level 0 MSB.

SI1133_PARAM_THRESHOLD0_L 

Threshold level 0 LSB.

SI1133_PARAM_THRESHOLD1_H 

Threshold level 1 MSB.

SI1133_PARAM_THRESHOLD1_L 

Threshold level 1 LSB.

SI1133_PARAM_THRESHOLD2_H 

Threshold level 2 MSB.

SI1133_PARAM_THRESHOLD2_L 

Threshold level 2 LSB.

SI1133_PARAM_BURST 

Burst enable and burst count.

Definition at line 67 of file MZ_Addon_Si1133.h.

◆ Si1133_command

Enumerator
SI1133_CMD_RESET_CMD_CTR 

Resets the command counter.

SI1133_CMD_RESET 

Forces a Reset.

SI1133_CMD_NEW_ADDR 

Stores the new I2C address.

SI1133_CMD_FORCE_CH 

Initiates a set of measurements specified in CHAN_LIST parameter.

SI1133_CMD_PAUSE_CH 

Pauses autonomous measurements.

SI1133_CMD_START 

Starts autonomous measurements.

SI1133_CMD_PARAM_SET 

Sets a parameter.

SI1133_CMD_PARAM_QUERY 

Reads a parameter.

Definition at line 109 of file MZ_Addon_Si1133.h.

◆ Si1133_response

Enumerator
SI1133_RSP0_CHIPSTAT_MASK 

Chip state mask in Response0 register.

SI1133_RSP0_COUNTER_MASK 

Command counter and error indicator mask in Response0 register.

SI1133_RSP0_SLEEP 

Sleep state indicator bit mask in Response0 register.

Definition at line 121 of file MZ_Addon_Si1133.h.

◆ Si1133_error

Enumerator
SI_OK 
SI_FAIL 

Definition at line 154 of file MZ_Addon_Si1133.h.

Function Documentation

◆ __attribute()

struct __attribute ( (packed)  )

Structure to store the data measured by the Si1133.

< Interrupt status of the device

< Channel 0 measurement data

< Channel 1 measurement data

< Channel 2 measurement data

< Channel 3 measurement data

Definition at line 1 of file MZ_Addon_Si1133.h.

◆ SI1133_init()

Si1133_error SI1133_init ( void  )

Definition at line 444 of file MZ_Addon_Si1133.c.

◆ SI1133_deinit()

Si1133_error SI1133_deinit ( void  )

Definition at line 474 of file MZ_Addon_Si1133.c.

◆ SI1133_get_hardware_id()

Si1133_error SI1133_get_hardware_id ( uint8_t *  hardware_id)

Definition at line 529 of file MZ_Addon_Si1133.c.

◆ SI1133_measure_lux_uv()

Si1133_error SI1133_measure_lux_uv ( float *  lux,
float *  uvi 
)

Definition at line 534 of file MZ_Addon_Si1133.c.

◆ SI1133_get_measurement()

Si1133_error SI1133_get_measurement ( float *  lux,
float *  uvi 
)

Definition at line 569 of file MZ_Addon_Si1133.c.

◆ SI1133_get_light_level()

float SI1133_get_light_level ( void  )

Definition at line 588 of file MZ_Addon_Si1133.c.

◆ SI1133_get_uv_index()

float SI1133_get_uv_index ( void  )

Definition at line 595 of file MZ_Addon_Si1133.c.

Variable Documentation

◆ Si1133_samples

Si1133_samples

Definition at line 139 of file MZ_Addon_Si1133.h.