EFM32 Gecko Software Documentation
efm32g-doc-5.1.2
|
Si1133 driver and support functions.
DO_NOT_INCLUDE_WITH_DOXYGEN
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... | |
static uint32_t | SI1133_sendCmd (uint8_t command) |
Helper function to send a command to the Si1133. More... | |
static uint32_t | SI1133_waitUntilSleep (void) |
Waits until the Si1133 is sleeping before proceeding. More... | |
uint32_t SI1133_deInit | ( | void | ) |
Stops the measurements on all channel and waits until the chip goes to sleep state.
Definition at line 621 of file si1133.c.
References 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.
[out] | hardwareID | The Hardware ID of the chip (should be 0x33) |
Definition at line 920 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.
[out] | irqStatus | The contentof the IRQ status register |
Definition at line 976 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.
[in] | vis_high | Visible light sensor raw data |
[in] | vis_low | Visible light sensor raw data |
[in] | ir | Infrared sensor raw data |
[in] | lk | Lux calculation coefficients |
Definition at line 835 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.
[out] | lux | The measured ambient light illuminace in lux |
[out] | uvi | UV index |
Definition at line 945 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.
[in] | uv | UV sensor raw data |
[in] | uk | UV calculation coefficients |
Definition at line 805 of file si1133.c.
Referenced by SI1133_getMeasurement(), and SI1133_measureLuxUvi().
uint32_t SI1133_init | ( | void | ) |
Initializes the Si1133 chip.
Definition at line 578 of file si1133.c.
References BOARD_envSensEnable(), 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.
[out] | lux | The measured ambient light illuminace in lux |
[out] | uvi | UV index |
Definition at line 874 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.
Definition at line 438 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.
[out] | samples | Retrieves interrupt status and measurement data for channel 0..3 and converts the data to int32_t format |
Definition at line 645 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().
|
static |
Sends a PAUSE command to the Si1133.
Definition at line 564 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.
Definition at line 452 of file si1133.c.
References SI1133_CMD_START, and SI1133_sendCmd().
uint32_t SI1133_paramRead | ( | uint8_t | address | ) |
Reads a parameter from the Si1133.
[in] | address | The address of the parameter. |
Definition at line 469 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.
[in] | address | The parameter address |
[in] | value | The byte value to be written to the Si1133 parameter |
Definition at line 509 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.
[in] | reg | The first register to begin reading from |
[in] | length | The number of bytes to write to the sensor |
[out] | data | The data read from the sensor |
Definition at line 238 of file si1133.c.
References I2C_TransferSeq_TypeDef::addr, 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, SI1133_I2C_DEVICE, SI1133_I2C_DEVICE_BUS_ADDRESS, 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.
[in] | reg | The first register to begin writing to |
[in] | length | The number of bytes to write to the sensor |
[in] | data | The data to write to the sensor |
Definition at line 189 of file si1133.c.
References I2C_TransferSeq_TypeDef::addr, 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, SI1133_I2C_DEVICE, SI1133_I2C_DEVICE_BUS_ADDRESS, and SI1133_OK.
Referenced by SI1133_paramSet().
uint32_t SI1133_registerRead | ( | uint8_t | reg, |
uint8_t * | data | ||
) |
Reads register from the Si1133 sensor.
DO_NOT_INCLUDE_WITH_DOXYGEN
[in] | reg | The register address to read from in the sensor. |
[out] | data | The data read from the sensor |
Definition at line 100 of file si1133.c.
References I2C_TransferSeq_TypeDef::addr, 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, SI1133_I2C_DEVICE, SI1133_I2C_DEVICE_BUS_ADDRESS, 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.
[in] | reg | The register address to write to in the sensor |
[in] | data | The data to write to the sensor |
Definition at line 143 of file si1133.c.
References I2C_TransferSeq_TypeDef::addr, 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, SI1133_I2C_DEVICE, SI1133_I2C_DEVICE_BUS_ADDRESS, and SI1133_OK.
Referenced by SI1133_init(), SI1133_reset(), and SI1133_sendCmd().
uint32_t SI1133_reset | ( | void | ) |
Resets the Si1133.
Definition at line 312 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.
Definition at line 424 of file si1133.c.
References SI1133_CMD_RESET_CMD_CTR, and SI1133_sendCmd().
|
static |
Helper function to send a command to the Si1133.
[in] | command | The command to send to the sensor |
Definition at line 341 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.
Definition at line 274 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().