SI1133 - Ambient Light and UV Index SensorBSP > Thunderboard Sense BSP
Detailed Description
Driver for the Silicon Labs Si1133 Ambient Light and UV sensor.
| Data Structures | |
| struct | SI1133_Coeff_TypeDef | 
| Structure to store the calculation coefficients. | |
| struct | SI1133_LuxCoeff_TypeDef | 
| Structure to store the coefficients used for Lux calculation. | |
| struct | SI1133_Samples_TypeDef | 
| Structure to store the data measured by the Si1133. | |
| Functions | |
| uint32_t | SI1133_deInit (void) | 
| Stops the measurements on all channel and waits until the chip goes to sleep state. | |
| uint32_t | SI1133_getHardwareID (uint8_t *hardwareID) | 
| Reads Hardware ID from the SI1133 sensor. | |
| uint32_t | SI1133_getIrqStatus (uint8_t *irqStatus) | 
| Reads the interrupt status register of the device. | |
| int32_t | SI1133_getLux (int32_t vis_high, int32_t vis_low, int32_t ir, SI1133_LuxCoeff_TypeDef *lk) | 
| Compute lux value. | |
| uint32_t | SI1133_getMeasurement (float *lux, float *uvi) | 
| Retrieve the sample values from the chip and convert them to lux and UV index values. | |
| int32_t | SI1133_getUv (int32_t uv, SI1133_Coeff_TypeDef *uk) | 
| Compute UV index. | |
| uint32_t | SI1133_init (void) | 
| Initializes the Si1133 chip. | |
| uint32_t | SI1133_measureLuxUvi (float *lux, float *uvi) | 
| Measure lux and UV index using the Si1133 sensor. | |
| uint32_t | SI1133_measurementForce (void) | 
| Sends a FORCE command to the Si1133. | |
| uint32_t | SI1133_measurementGet ( SI1133_Samples_TypeDef *samples) | 
| Read samples from the Si1133 chip. | |
| uint32_t | SI1133_measurementPause (void) | 
| Sends a PAUSE command to the Si1133. | |
| uint32_t | SI1133_measurementStart (void) | 
| Sends a START command to the Si1133. | |
| uint32_t | SI1133_paramRead (uint8_t address) | 
| Reads a parameter from the Si1133. | |
| uint32_t | SI1133_paramSet (uint8_t address, uint8_t value) | 
| Writes a byte to an Si1133 Parameter. | |
| uint32_t | SI1133_registerBlockRead (uint8_t reg, uint8_t length, uint8_t *data) | 
| Reads a block of data from the Si1133 sensor. | |
| uint32_t | SI1133_registerBlockWrite (uint8_t reg, uint8_t length, uint8_t *data) | 
| Writes a block of data to the Si1133 sensor. | |
| uint32_t | SI1133_registerRead (uint8_t reg, uint8_t *data) | 
| Reads register from the Si1133 sensor. | |
| uint32_t | SI1133_registerWrite (uint8_t reg, uint8_t data) | 
| Writes register in the Si1133 sensor. | |
| uint32_t | SI1133_reset (void) | 
| Resets the Si1133. | |
| uint32_t | SI1133_resetCmdCtr (void) | 
| Sends a RESET COMMAND COUNTER command to the Si1133. | |
| static uint32_t | SI1133_sendCmd (uint8_t command) | 
| Helper function to send a command to the Si1133. | |
| static uint32_t | SI1133_waitUntilSleep (void) | 
| Waits until the Si1133 is sleeping before proceeding. | |
| Error Codes | |
| #define | SI1133_OK 0x0000 | 
| #define | SI1133_ERROR_I2C_TRANSACTION_FAILED 0x0001 | 
| #define | SI1133_ERROR_SLEEP_FAILED 0x0002 | 
| Commands | |
| #define | SI1133_CMD_RESET_CMD_CTR 0x00 | 
| #define | SI1133_CMD_RESET 0x01 | 
| #define | SI1133_CMD_NEW_ADDR 0x02 | 
| #define | SI1133_CMD_FORCE_CH 0x11 | 
| #define | SI1133_CMD_PAUSE_CH 0x12 | 
| #define | SI1133_CMD_START 0x13 | 
| #define | SI1133_CMD_PARAM_SET 0x80 | 
| #define | SI1133_CMD_PARAM_QUERY 0x40 | 
| Responses | |
| #define | SI1133_RSP0_CHIPSTAT_MASK 0xE0 | 
| #define | SI1133_RSP0_COUNTER_MASK 0x1F | 
| #define | SI1133_RSP0_SLEEP 0x20 | 
Macro Definition Documentation
| #define SI1133_CMD_FORCE_CHÂ Â Â 0x11 | 
Initiates a set of measurements specified in CHAN_LIST parameter
        Definition at line
        
         184
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_measurementForce() .
| #define SI1133_CMD_NEW_ADDRÂ Â Â 0x02 | 
Stores the new I2C address
        Definition at line
        
         183
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_CMD_PARAM_QUERYÂ Â Â 0x40 | 
Reads a parameter
        Definition at line
        
         188
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_CMD_PARAM_SETÂ Â Â 0x80 | 
Sets a parameter
        Definition at line
        
         187
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_CMD_PAUSE_CHÂ Â Â 0x12 | 
Pauses autonomous measurements
        Definition at line
        
         185
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_measurementPause() .
| #define SI1133_CMD_RESETÂ Â Â 0x01 | 
| #define SI1133_CMD_RESET_CMD_CTRÂ Â Â 0x00 | 
Resets the command counter
        Definition at line
        
         181
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_resetCmdCtr() , and SI1133_sendCmd() .
| #define SI1133_CMD_STARTÂ Â Â 0x13 | 
Starts autonomous measurements
        Definition at line
        
         186
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_measurementStart() .
| #define SI1133_ERROR_I2C_TRANSACTION_FAILEDÂ Â Â 0x0001 | 
I2C transaction failed
        Definition at line
        
         58
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_registerBlockRead() , SI1133_registerBlockWrite() , SI1133_registerRead() , and SI1133_registerWrite() .
| #define SI1133_ERROR_SLEEP_FAILEDÂ Â Â 0x0002 | 
Entering sleep mode failed
        Definition at line
        
         59
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_waitUntilSleep() .
| #define SI1133_OKÂ Â Â 0x0000 | 
No errors
        Definition at line
        
         57
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_paramRead() , SI1133_paramSet() , SI1133_registerBlockRead() , SI1133_registerBlockWrite() , SI1133_registerRead() , SI1133_registerWrite() , SI1133_sendCmd() , and SI1133_waitUntilSleep() .
| #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 | 
ADC config for Channel 4
        Definition at line
        
         155
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_ADCCONFIG5Â Â Â 0x16 | 
ADC config for Channel 5
        Definition at line
        
         159
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_ADCPOST0Â Â Â 0x04 | 
ADC resolution, shift and threshold settings for Channel 0
        Definition at line
        
         141
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_init() .
| #define SI1133_PARAM_ADCPOST1Â Â Â 0x08 | 
ADC resolution, shift and threshold settings for Channel 1
        Definition at line
        
         145
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_init() .
| #define SI1133_PARAM_ADCPOST2Â Â Â 0x0C | 
ADC resolution, shift and threshold settings for Channel 2
        Definition at line
        
         149
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_init() .
| #define SI1133_PARAM_ADCPOST3Â Â Â 0x10 | 
ADC resolution, shift and threshold settings for Channel 3
        Definition at line
        
         153
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_init() .
| #define SI1133_PARAM_ADCPOST4Â Â Â 0x14 | 
ADC resolution, shift and threshold settings for Channel 4
        Definition at line
        
         157
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_ADCPOST5Â Â Â 0x18 | 
ADC resolution, shift and threshold settings for Channel 5
        Definition at line
        
         161
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_ADCSENS0Â Â Â 0x03 | 
ADC sensitivity setting for Channel 0
        Definition at line
        
         140
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_init() .
| #define SI1133_PARAM_ADCSENS1Â Â Â 0x07 | 
ADC sensitivity setting for Channel 1
        Definition at line
        
         144
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_init() .
| #define SI1133_PARAM_ADCSENS2Â Â Â 0x0B | 
ADC sensitivity setting for Channel 2
        Definition at line
        
         148
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_init() .
| #define SI1133_PARAM_ADCSENS3Â Â Â 0x0F | 
ADC sensitivity setting for Channel 3
        Definition at line
        
         152
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_init() .
| #define SI1133_PARAM_ADCSENS4Â Â Â 0x13 | 
ADC sensitivity setting for Channel 4
        Definition at line
        
         156
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_ADCSENS5Â Â Â 0x17 | 
ADC sensitivity setting for Channel 5
        Definition at line
        
         160
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_BURSTÂ Â Â 0x2B | 
Burst enable and burst count
        Definition at line
        
         174
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_CH_LISTÂ Â Â 0x01 | 
Channel list
        Definition at line
        
         138
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_deInit() , and SI1133_init() .
| #define SI1133_PARAM_I2C_ADDRÂ Â Â 0x00 | 
I2C address
        Definition at line
        
         137
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_MEASCONFIG0Â Â Â 0x05 | 
ADC measurement counter selection for Channel 0
        Definition at line
        
         142
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_MEASCONFIG1Â Â Â 0x09 | 
ADC measurement counter selection for Channel 1
        Definition at line
        
         146
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_MEASCONFIG2Â Â Â 0x0D | 
ADC measurement counter selection for Channel 2
        Definition at line
        
         150
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_MEASCONFIG3Â Â Â 0x11 | 
ADC measurement counter selection for Channel 3
        Definition at line
        
         154
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_MEASCONFIG4Â Â Â 0x15 | 
ADC measurement counter selection for Channel 4
        Definition at line
        
         158
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_MEASCONFIG5Â Â Â 0x19 | 
ADC measurement counter selection for Channel 5
        Definition at line
        
         162
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_MEASCOUNT0Â Â Â 0x1C | 
Measurement rate extension counter 0
        Definition at line
        
         165
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_MEASCOUNT1Â Â Â 0x1D | 
Measurement rate extension counter 1
        Definition at line
        
         166
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_MEASCOUNT2Â Â Â 0x1E | 
Measurement rate extension counter 2
        Definition at line
        
         167
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_MEASRATE_HÂ Â Â 0x1A | 
Main measurement rate counter MSB
        Definition at line
        
         163
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_MEASRATE_LÂ Â Â 0x1B | 
Main measurement rate counter LSB
        Definition at line
        
         164
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_THRESHOLD0_HÂ Â Â 0x25 | 
Threshold level 0 MSB
        Definition at line
        
         168
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_THRESHOLD0_LÂ Â Â 0x26 | 
Threshold level 0 LSB
        Definition at line
        
         169
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_THRESHOLD1_HÂ Â Â 0x27 | 
Threshold level 1 MSB
        Definition at line
        
         170
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_THRESHOLD1_LÂ Â Â 0x28 | 
Threshold level 1 LSB
        Definition at line
        
         171
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_THRESHOLD2_HÂ Â Â 0x29 | 
Threshold level 2 MSB
        Definition at line
        
         172
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_PARAM_THRESHOLD2_LÂ Â Â 0x2A | 
Threshold level 2 LSB
        Definition at line
        
         173
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_COMMANDÂ Â Â 0x0B | 
Initiated action in Sensor when specific codes written here
        Definition at line
        
         100
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_reset() , and SI1133_sendCmd() .
| #define SI1133_REG_HOSTIN0Â Â Â 0x0A | 
Data for parameter table on PARAM_SET write to COMMAND register
        Definition at line
        
         99
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_paramSet() .
| #define SI1133_REG_HOSTOUT0Â Â Â 0x13 | 
Captured Sensor Data
        Definition at line
        
         105
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT1Â Â Â 0x14 | 
Captured Sensor Data
        Definition at line
        
         106
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT10Â Â Â 0x1D | 
Captured Sensor Data
        Definition at line
        
         115
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT11Â Â Â 0x1E | 
Captured Sensor Data
        Definition at line
        
         116
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT12Â Â Â 0x1F | 
Captured Sensor Data
        Definition at line
        
         117
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT13Â Â Â 0x20 | 
Captured Sensor Data
        Definition at line
        
         118
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT14Â Â Â 0x21 | 
Captured Sensor Data
        Definition at line
        
         119
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT15Â Â Â 0x22 | 
Captured Sensor Data
        Definition at line
        
         120
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT16Â Â Â 0x23 | 
Captured Sensor Data
        Definition at line
        
         121
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT17Â Â Â 0x24 | 
Captured Sensor Data
        Definition at line
        
         122
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT18Â Â Â 0x25 | 
Captured Sensor Data
        Definition at line
        
         123
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT19Â Â Â 0x26 | 
Captured Sensor Data
        Definition at line
        
         124
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT2Â Â Â 0x15 | 
Captured Sensor Data
        Definition at line
        
         107
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT20Â Â Â 0x27 | 
Captured Sensor Data
        Definition at line
        
         125
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT21Â Â Â 0x28 | 
Captured Sensor Data
        Definition at line
        
         126
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT22Â Â Â 0x29 | 
Captured Sensor Data
        Definition at line
        
         127
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT23Â Â Â 0x2A | 
Captured Sensor Data
        Definition at line
        
         128
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT24Â Â Â 0x2B | 
Captured Sensor Data
        Definition at line
        
         129
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT25Â Â Â 0x2C | 
Captured Sensor Data
        Definition at line
        
         130
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT3Â Â Â 0x16 | 
Captured Sensor Data
        Definition at line
        
         108
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT4Â Â Â 0x17 | 
Captured Sensor Data
        Definition at line
        
         109
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT5Â Â Â 0x18 | 
Captured Sensor Data
        Definition at line
        
         110
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT6Â Â Â 0x19 | 
Captured Sensor Data
        Definition at line
        
         111
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT7Â Â Â 0x1A | 
Captured Sensor Data
        Definition at line
        
         112
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT8Â Â Â 0x1B | 
Captured Sensor Data
        Definition at line
        
         113
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HOSTOUT9Â Â Â 0x1C | 
Captured Sensor Data
        Definition at line
        
         114
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_HW_IDÂ Â Â 0x01 | 
Hardware ID
        Definition at line
        
         97
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_REG_IRQ_ENABLEÂ Â Â 0x0F | 
| #define SI1133_REG_IRQ_STATUSÂ Â Â 0x12 | 
Interrupt status
        Definition at line
        
         104
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_getIrqStatus() , SI1133_measureLuxUvi() , and SI1133_measurementGet() .
| #define SI1133_REG_PART_IDÂ Â Â 0x00 | 
| #define SI1133_REG_RESPONSE0Â Â Â 0x11 | 
Chip state and error status
        Definition at line
        
         103
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_paramSet() , SI1133_sendCmd() , and SI1133_waitUntilSleep() .
| #define SI1133_REG_RESPONSE1Â Â Â 0x10 | 
Contains the readback value from a param query or a param set command
        Definition at line
        
         102
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_paramRead() .
| #define SI1133_REG_REV_IDÂ Â Â 0x02 | 
Hardware revision
        Definition at line
        
         98
        
        of file
        
         si1133.h
        
        .
       
| #define SI1133_RSP0_CHIPSTAT_MASKÂ Â Â 0xE0 | 
Chip state mask in Response0 register
        Definition at line
        
         195
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_waitUntilSleep() .
| #define SI1133_RSP0_COUNTER_MASKÂ Â Â 0x1F | 
Command counter and error indicator mask in Response0 register
        Definition at line
        
         196
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_paramSet() , and SI1133_sendCmd() .
| #define SI1133_RSP0_SLEEPÂ Â Â 0x20 | 
Sleep state indicator bit mask in Response0 register
        Definition at line
        
         197
        
        of file
        
         si1133.h
        
        .
       
Referenced by SI1133_waitUntilSleep() .
Function Documentation
| uint32_t SI1133_deInit | ( | void | 
            | ) | 
Stops the measurements on all channel and waits until the chip goes to sleep state.
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         580
        
        of file
        
         si1133.c
        
        .
       
References BOARD_alsEnable() , SI1133_measurementPause() , SI1133_PARAM_CH_LIST , SI1133_paramSet() , and SI1133_waitUntilSleep() .
| uint32_t SI1133_getHardwareID | ( | uint8_t * | 
            hardwareID
            | ) | 
Reads Hardware ID from the SI1133 sensor.
- Parameters
- 
         [out] hardwareIDThe Hardware ID of the chip (should be 0x33) 
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         858
        
        of file
        
         si1133.c
        
        .
       
References SI1133_REG_PART_ID , and SI1133_registerRead() .
| uint32_t SI1133_getIrqStatus | ( | uint8_t * | 
            irqStatus
            | ) | 
Reads the interrupt status register of the device.
- Parameters
- 
         [out] irqStatusThe contentof the IRQ status register 
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         910
        
        of file
        
         si1133.c
        
        .
       
References SI1133_REG_IRQ_STATUS , and SI1133_registerRead() .
| int32_t SI1133_getLux | ( | int32_t | 
            vis_high,
            | 
| int32_t | 
            vis_low,
            | ||
| int32_t | 
            ir,
            | ||
| SI1133_LuxCoeff_TypeDef * | 
            lk
            | ||
| ) | 
Compute lux value.
- Parameters
- 
         [in] vis_highVisible light sensor raw data [in] vis_lowVisible light sensor raw data [in] irInfrared sensor raw data [in] lkLux calculation coefficients 
- Returns
- Lux value scaled by LUX_OUPTUT_FRACTION
        Definition at line
        
         779
        
        of file
        
         si1133.c
        
        .
       
References SI1133_LuxCoeff_TypeDef::coeff_high , and SI1133_LuxCoeff_TypeDef::coeff_low .
Referenced by SI1133_getMeasurement() , and SI1133_measureLuxUvi() .
| uint32_t SI1133_getMeasurement | ( | float * | 
            lux,
            | 
| float * | 
            uvi
            | ||
| ) | 
Retrieve the sample values from the chip and convert them to lux and UV index values.
- Parameters
- 
         [out] luxThe measured ambient light illuminace in lux [out] uviUV index 
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         881
        
        of file
        
         si1133.c
        
        .
       
References SI1133_Samples_TypeDef::ch0 , SI1133_Samples_TypeDef::ch1 , SI1133_Samples_TypeDef::ch2 , SI1133_Samples_TypeDef::ch3 , SI1133_getLux() , SI1133_getUv() , and SI1133_measurementGet() .
| int32_t SI1133_getUv | ( | int32_t | 
            uv,
            | 
| SI1133_Coeff_TypeDef * | 
            uk
            | ||
| ) | 
Compute UV index.
- Parameters
- 
         [in] uvUV sensor raw data [in] ukUV calculation coefficients 
- Returns
- UV index scaled by UV_OUPTUT_FRACTION
        Definition at line
        
         751
        
        of file
        
         si1133.c
        
        .
       
Referenced by SI1133_getMeasurement() , and SI1133_measureLuxUvi() .
| uint32_t SI1133_init | ( | void | 
            | ) | 
Initializes the Si1133 chip.
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         539
        
        of file
        
         si1133.c
        
        .
       
References BOARD_alsEnable() , SI1133_PARAM_ADCCONFIG0 , SI1133_PARAM_ADCCONFIG1 , SI1133_PARAM_ADCCONFIG2 , SI1133_PARAM_ADCCONFIG3 , SI1133_PARAM_ADCPOST0 , SI1133_PARAM_ADCPOST1 , SI1133_PARAM_ADCPOST2 , SI1133_PARAM_ADCPOST3 , SI1133_PARAM_ADCSENS0 , SI1133_PARAM_ADCSENS1 , SI1133_PARAM_ADCSENS2 , SI1133_PARAM_ADCSENS3 , SI1133_PARAM_CH_LIST , SI1133_paramSet() , SI1133_REG_IRQ_ENABLE , SI1133_registerWrite() , SI1133_reset() , and UTIL_delay() .
| uint32_t SI1133_measureLuxUvi | ( | float * | 
            lux,
            | 
| float * | 
            uvi
            | ||
| ) | 
Measure lux and UV index using the Si1133 sensor.
- Parameters
- 
         [out] luxThe measured ambient light illuminace in lux [out] uviUV index 
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         815
        
        of file
        
         si1133.c
        
        .
       
References SI1133_Samples_TypeDef::ch0 , SI1133_Samples_TypeDef::ch1 , SI1133_Samples_TypeDef::ch2 , SI1133_Samples_TypeDef::ch3 , SI1133_getLux() , SI1133_getUv() , SI1133_measurementForce() , SI1133_measurementGet() , SI1133_REG_IRQ_STATUS , SI1133_registerRead() , and UTIL_delay() .
| uint32_t SI1133_measurementForce | ( | void | 
            | ) | 
Sends a FORCE command to the Si1133.
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         412
        
        of file
        
         si1133.c
        
        .
       
References SI1133_CMD_FORCE_CH , and SI1133_sendCmd() .
Referenced by SI1133_measureLuxUvi() .
| uint32_t SI1133_measurementGet | ( | SI1133_Samples_TypeDef * | 
            samples
            | ) | 
Read samples from the Si1133 chip.
- Parameters
- 
         [out] samplesRetrieves interrupt status and measurement data for channel 0..3 and converts the data to int32_t format 
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         605
        
        of file
        
         si1133.c
        
        .
       
References SI1133_Samples_TypeDef::ch0 , SI1133_Samples_TypeDef::ch1 , SI1133_Samples_TypeDef::ch2 , SI1133_Samples_TypeDef::ch3 , SI1133_Samples_TypeDef::irq_status , SI1133_REG_IRQ_STATUS , and SI1133_registerBlockRead() .
Referenced by SI1133_getMeasurement() , and SI1133_measureLuxUvi() .
| uint32_t SI1133_measurementPause | ( | void | 
            | ) | 
Sends a PAUSE command to the Si1133.
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         527
        
        of file
        
         si1133.c
        
        .
       
References SI1133_CMD_PAUSE_CH , and SI1133_sendCmd() .
Referenced by SI1133_deInit() .
| uint32_t SI1133_measurementStart | ( | void | 
            | ) | 
Sends a START command to the Si1133.
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         424
        
        of file
        
         si1133.c
        
        .
       
References SI1133_CMD_START , and SI1133_sendCmd() .
| uint32_t SI1133_paramRead | ( | uint8_t | 
            address
            | ) | 
Reads a parameter from the Si1133.
- Parameters
- 
         [in] addressThe address of the parameter. 
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         439
        
        of file
        
         si1133.c
        
        .
       
References SI1133_OK , SI1133_REG_RESPONSE1 , SI1133_registerRead() , and SI1133_sendCmd() .
| uint32_t SI1133_paramSet | ( | uint8_t | 
            address,
            | 
| uint8_t | 
            value
            | ||
| ) | 
Writes a byte to an Si1133 Parameter.
- Parameters
- 
         [in] addressThe parameter address [in] valueThe byte value to be written to the Si1133 parameter 
- Returns
- Returns zero on OK, non-zero otherwise
- 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
        
         477
        
        of file
        
         si1133.c
        
        .
       
References SI1133_OK , SI1133_REG_HOSTIN0 , SI1133_REG_RESPONSE0 , SI1133_registerBlockWrite() , SI1133_registerRead() , SI1133_RSP0_COUNTER_MASK , and SI1133_waitUntilSleep() .
Referenced by SI1133_deInit() , and SI1133_init() .
| uint32_t SI1133_registerBlockRead | ( | uint8_t | 
            reg,
            | 
| uint8_t | 
            length,
            | ||
| uint8_t * | 
            data
            | ||
| ) | 
Reads a block of data from the Si1133 sensor.
- Parameters
- 
         [in] regThe first register to begin reading from [in] lengthThe number of bytes to write to the sensor [out] dataThe data read from the sensor 
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         225
        
        of file
        
         si1133.c
        
        .
       
References I2C_TransferSeq_TypeDef::addr , BOARD_i2cBusSelect() , I2C_TransferSeq_TypeDef::buf , I2C_TransferSeq_TypeDef::data , I2C_TransferSeq_TypeDef::flags , I2C_FLAG_WRITE_READ , I2CSPM_Transfer() , i2cTransferDone , I2C_TransferSeq_TypeDef::len , SI1133_ERROR_I2C_TRANSACTION_FAILED , and SI1133_OK .
Referenced by SI1133_measurementGet() .
| uint32_t SI1133_registerBlockWrite | ( | uint8_t | 
            reg,
            | 
| uint8_t | 
            length,
            | ||
| uint8_t * | 
            data
            | ||
| ) | 
Writes a block of data to the Si1133 sensor.
- Parameters
- 
         [in] regThe first register to begin writing to [in] lengthThe number of bytes to write to the sensor [in] dataThe data to write to the sensor 
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         176
        
        of file
        
         si1133.c
        
        .
       
References I2C_TransferSeq_TypeDef::addr , BOARD_i2cBusSelect() , I2C_TransferSeq_TypeDef::buf , I2C_TransferSeq_TypeDef::data , I2C_TransferSeq_TypeDef::flags , I2C_FLAG_WRITE , I2CSPM_Transfer() , i2cTransferDone , I2C_TransferSeq_TypeDef::len , SI1133_ERROR_I2C_TRANSACTION_FAILED , and SI1133_OK .
Referenced by SI1133_paramSet() .
| uint32_t SI1133_registerRead | ( | uint8_t | 
            reg,
            | 
| uint8_t * | 
            data
            | ||
| ) | 
Reads register from the Si1133 sensor.
- Parameters
- 
         [in] regThe register address to read from in the sensor. [out] dataThe data read from the sensor 
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         87
        
        of file
        
         si1133.c
        
        .
       
References I2C_TransferSeq_TypeDef::addr , BOARD_i2cBusSelect() , I2C_TransferSeq_TypeDef::buf , I2C_TransferSeq_TypeDef::data , I2C_TransferSeq_TypeDef::flags , I2C_FLAG_WRITE_READ , I2CSPM_Transfer() , i2cTransferDone , I2C_TransferSeq_TypeDef::len , SI1133_ERROR_I2C_TRANSACTION_FAILED , and SI1133_OK .
Referenced by SI1133_getHardwareID() , SI1133_getIrqStatus() , SI1133_measureLuxUvi() , SI1133_paramRead() , SI1133_paramSet() , SI1133_sendCmd() , and SI1133_waitUntilSleep() .
| uint32_t SI1133_registerWrite | ( | uint8_t | 
            reg,
            | 
| uint8_t | 
            data
            | ||
| ) | 
Writes register in the Si1133 sensor.
- Parameters
- 
         [in] regThe register address to write to in the sensor [in] dataThe data to write to the sensor 
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         130
        
        of file
        
         si1133.c
        
        .
       
References I2C_TransferSeq_TypeDef::addr , BOARD_i2cBusSelect() , I2C_TransferSeq_TypeDef::buf , I2C_TransferSeq_TypeDef::data , I2C_TransferSeq_TypeDef::flags , I2C_FLAG_WRITE , I2CSPM_Transfer() , i2cTransferDone , I2C_TransferSeq_TypeDef::len , SI1133_ERROR_I2C_TRANSACTION_FAILED , and SI1133_OK .
Referenced by SI1133_init() , SI1133_reset() , and SI1133_sendCmd() .
| uint32_t SI1133_reset | ( | void | 
            | ) | 
Resets the Si1133.
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         296
        
        of file
        
         si1133.c
        
        .
       
References SI1133_CMD_RESET , SI1133_REG_COMMAND , SI1133_registerWrite() , and UTIL_delay() .
Referenced by SI1133_init() .
| uint32_t SI1133_resetCmdCtr | ( | void | 
            | ) | 
Sends a RESET COMMAND COUNTER command to the Si1133.
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         400
        
        of file
        
         si1133.c
        
        .
       
References SI1133_CMD_RESET_CMD_CTR , and SI1133_sendCmd() .
| 
 | static | 
Helper function to send a command to the Si1133.
- Parameters
- 
         [in] commandThe command to send to the sensor 
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         323
        
        of file
        
         si1133.c
        
        .
       
References SI1133_CMD_RESET_CMD_CTR , SI1133_OK , SI1133_REG_COMMAND , SI1133_REG_RESPONSE0 , SI1133_registerRead() , SI1133_registerWrite() , SI1133_RSP0_COUNTER_MASK , and SI1133_waitUntilSleep() .
Referenced by SI1133_measurementForce() , SI1133_measurementPause() , SI1133_measurementStart() , SI1133_paramRead() , and SI1133_resetCmdCtr() .
| 
 | static | 
Waits until the Si1133 is sleeping before proceeding.
- Returns
- Returns zero on OK, non-zero otherwise
        Definition at line
        
         261
        
        of file
        
         si1133.c
        
        .
       
References SI1133_ERROR_SLEEP_FAILED , SI1133_OK , SI1133_REG_RESPONSE0 , SI1133_registerRead() , SI1133_RSP0_CHIPSTAT_MASK , and SI1133_RSP0_SLEEP .
Referenced by SI1133_deInit() , SI1133_paramSet() , and SI1133_sendCmd() .