si114x_uv_index.c File Reference

Si114x UV Index measurement.

License

Copyright 2018 Silicon Laboratories Inc. www.silabs.com

SPDX-License-Identifier: Zlib

The licensor of this software is Silicon Laboratories Inc.

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

Definition in file si114x_uv_index.c .

#include " si114x_functions.h "

Macros

#define SI1146_DEVICE_ID 0x46
#define UV_IRQ_EN IE_ALS_EVRYSAMPLE
#define UV_TASKLIST 0x80

Functions

int Si114x_ConfigureUV (int fullInit, HANDLE *handle)
Initializes and configures the Si1146 sensor for UV index measurements.
int Si114x_EnableVisRange (int vis_range_bit)
Set the VIS_RANGE bit of the optical sensor Si114x.
int Si114x_MeasureUVIndex ( u16 *uvIndex)
Reads the UV index measurement data from the Si114x.

Variables

static void * si114x_handle
Si114x PGM toolkit functions uses a void* to pass hardware parameters through to the lower level i2c functions. This struct is passed down to the low level i2c functions using that pointer.

Macro Definition Documentation

#define SI1146_DEVICE_ID   0x46

Si1146 device ID

Definition at line 36 of file si114x_uv_index.c .

#define UV_IRQ_EN   IE_ALS_EVRYSAMPLE

UV interrupt enable

Definition at line 35 of file si114x_uv_index.c .

#define UV_TASKLIST   0x80

Si114x register settings. UV task in CHLIST

Definition at line 34 of file si114x_uv_index.c .

Referenced by Si1147_ConfigureDetection() , and Si114x_ConfigureUV() .

Function Documentation

int Si114x_ConfigureUV ( int fullInit,
HANDLE * handle
)

Initializes and configures the Si1146 sensor for UV index measurements.

Parameters
[in] fullInit The I2C peripheral to use (not used).
[in] handle The si114x handle for programmer's toolkit
Returns
Returns 0 on success.

Definition at line 121 of file si114x_uv_index.c .

References si114x_get_calibration() , si114x_handle , si114x_set_ucoef() , Si114xParamSet() , Si114xReset() , Si114xWriteToRegister() , and UV_TASKLIST .

int Si114x_EnableVisRange ( int vis_range_bit )

Set the VIS_RANGE bit of the optical sensor Si114x.

Parameters
[in] vis_range_bit the boolean value to set the bit to
Returns
Returns 0.

Definition at line 99 of file si114x_uv_index.c .

References si114x_handle , and Si114xParamSet() .

int Si114x_MeasureUVIndex ( u16 * uvIndex )

Reads the UV index measurement data from the Si114x.

Parameters
[out] uvIndex The UV index read from the sensor
Returns
Returns 0.

Definition at line 54 of file si114x_uv_index.c .

References si114x_handle , Si114xPsAlsForce() , Si114xReadFromRegister() , and Si114xWriteToRegister() .