LibDriver UVIS25
Loading...
Searching...
No Matches
driver_uvis25.c File Reference

driver uvis25 source file More...

#include "driver_uvis25.h"
Include dependency graph for driver_uvis25.c:

Go to the source code of this file.

Macros

#define CHIP_NAME   "STMicroelectronics UVIS25"
 chip register definition
#define MANUFACTURER_NAME   "STMicroelectronics"
#define SUPPLY_VOLTAGE_MIN   1.7f
#define SUPPLY_VOLTAGE_MAX   3.6f
#define MAX_CURRENT   0.01f
#define TEMPERATURE_MIN   -20.0f
#define TEMPERATURE_MAX   85.0f
#define DRIVER_VERSION   2000
#define UVIS25_REG_WHO_AM_I   0x0F
 chip register definition
#define UVIS25_REG_CTRL_REG1   0x20
#define UVIS25_REG_CTRL_REG2   0x21
#define UVIS25_REG_CTRL_REG3   0x22
#define UVIS25_REG_INT_CFG   0x23
#define UVIS25_REG_INT_SOURCE   0x24
#define UVIS25_REG_THS_UV   0x25
#define UVIS25_REG_STATUS_REG   0x27
#define UVIS25_REG_UV_OUT_REG   0x28
#define UVIS25_IIC_ADDRESS   0x8E
 iic address definition

Functions

uint8_t uvis25_set_interface (uvis25_handle_t *handle, uvis25_interface_t interface)
 set the chip interface
uint8_t uvis25_get_interface (uvis25_handle_t *handle, uvis25_interface_t *interface)
 get the chip interface
uint8_t uvis25_set_block_data_update (uvis25_handle_t *handle, uvis25_bool_t enable)
 enable or disable blocking data update
uint8_t uvis25_get_block_data_update (uvis25_handle_t *handle, uvis25_bool_t *enable)
 get blocking data update status
uint8_t uvis25_set_boot (uvis25_handle_t *handle, uvis25_boot_mode_t mode)
 set the boot mode
uint8_t uvis25_get_boot (uvis25_handle_t *handle, uvis25_boot_mode_t *mode)
 get the boot mode
uint8_t uvis25_set_iic (uvis25_handle_t *handle, uvis25_bool_t enable)
 enable or disable the chip iic
uint8_t uvis25_get_iic (uvis25_handle_t *handle, uvis25_bool_t *enable)
 get the chip iic status
uint8_t uvis25_set_spi_wire (uvis25_handle_t *handle, uvis25_spi_wire_t wire)
 set the spi wire
uint8_t uvis25_get_spi_wire (uvis25_handle_t *handle, uvis25_spi_wire_t *wire)
 get the spi wire
uint8_t uvis25_set_interrupt_active_level (uvis25_handle_t *handle, uvis25_interrupt_active_level_t level)
 set the interrupt active level
uint8_t uvis25_get_interrupt_active_level (uvis25_handle_t *handle, uvis25_interrupt_active_level_t *level)
 get the interrupt active level
uint8_t uvis25_set_interrupt_pin_type (uvis25_handle_t *handle, uvis25_interrupt_pin_type_t pin_type)
 set the interrupt pin type
uint8_t uvis25_get_interrupt_pin_type (uvis25_handle_t *handle, uvis25_interrupt_pin_type_t *pin_type)
 get the interrupt pin type
uint8_t uvis25_set_interrupt_type (uvis25_handle_t *handle, uvis25_interrupt_type_t type)
 set the interrupt type
uint8_t uvis25_get_interrupt_type (uvis25_handle_t *handle, uvis25_interrupt_type_t *type)
 get the interrupt type
uint8_t uvis25_set_interrupt (uvis25_handle_t *handle, uvis25_bool_t enable)
 enable or disable the chip interrupt
uint8_t uvis25_get_interrupt (uvis25_handle_t *handle, uvis25_bool_t *enable)
 get the chip interrupt status
uint8_t uvis25_set_latch_interrupt (uvis25_handle_t *handle, uvis25_bool_t enable)
 enable or disable latching interrupt
uint8_t uvis25_get_latch_interrupt (uvis25_handle_t *handle, uvis25_bool_t *enable)
 get the latching interrupt status
uint8_t uvis25_set_interrupt_low_threshold (uvis25_handle_t *handle, uvis25_bool_t enable)
 enable or disable the low threshold interrupt
uint8_t uvis25_get_interrupt_low_threshold (uvis25_handle_t *handle, uvis25_bool_t *enable)
 get the low threshold interrupt status
uint8_t uvis25_set_interrupt_high_threshold (uvis25_handle_t *handle, uvis25_bool_t enable)
 enable or disable the high threshold interrupt
uint8_t uvis25_get_interrupt_high_threshold (uvis25_handle_t *handle, uvis25_bool_t *enable)
 get the high threshold interrupt status
uint8_t uvis25_set_threshold (uvis25_handle_t *handle, uint8_t threshold)
 set the interrupt threshold
uint8_t uvis25_get_threshold (uvis25_handle_t *handle, uint8_t *threshold)
 get the interrupt threshold
uint8_t uvis25_irq_handler (uvis25_handle_t *handle)
 irq handler
uint8_t uvis25_threshold_convert_to_register (uvis25_handle_t *handle, float uv, uint8_t *reg)
 convert a uv index to a raw register data
uint8_t uvis25_threshold_convert_to_data (uvis25_handle_t *handle, uint8_t reg, float *uv)
 convert a raw register data to a converted uv index
uint8_t uvis25_init (uvis25_handle_t *handle)
 initialize the chip
uint8_t uvis25_deinit (uvis25_handle_t *handle)
 close the chip
uint8_t uvis25_single_read (uvis25_handle_t *handle, uint8_t *raw, float *uv)
 read data once
uint8_t uvis25_start_continuous_read (uvis25_handle_t *handle)
 start reading
uint8_t uvis25_stop_continuous_read (uvis25_handle_t *handle)
 stop reading
uint8_t uvis25_continuous_read (uvis25_handle_t *handle, uint8_t *raw, float *uv)
 read data continuously
uint8_t uvis25_set_reg (uvis25_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t uvis25_get_reg (uvis25_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get the chip register
uint8_t uvis25_info (uvis25_info_t *info)
 get chip's information

Detailed Description

driver uvis25 source file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
2.0.0
Author
Shifeng Li
Date
2021-03-24

history

Date Version Author Description
2021/03/24 2.0 Shifeng Li format the code
2020/12/06 1.0 Shifeng Li first upload

Definition in file driver_uvis25.c.

Macro Definition Documentation

◆ CHIP_NAME

#define CHIP_NAME   "STMicroelectronics UVIS25"

chip register definition

chip name

Definition at line 43 of file driver_uvis25.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   2000

driver version

Definition at line 50 of file driver_uvis25.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "STMicroelectronics"

manufacturer name

Definition at line 44 of file driver_uvis25.c.

◆ MAX_CURRENT

#define MAX_CURRENT   0.01f

chip max current

Definition at line 47 of file driver_uvis25.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   3.6f

chip max supply voltage

Definition at line 46 of file driver_uvis25.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   1.7f

chip min supply voltage

Definition at line 45 of file driver_uvis25.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   85.0f

chip max operating temperature

Definition at line 49 of file driver_uvis25.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -20.0f

chip min operating temperature

Definition at line 48 of file driver_uvis25.c.

◆ UVIS25_IIC_ADDRESS

#define UVIS25_IIC_ADDRESS   0x8E

iic address definition

iic device address

Definition at line 68 of file driver_uvis25.c.

◆ UVIS25_REG_CTRL_REG1

#define UVIS25_REG_CTRL_REG1   0x20

control 1 register

Definition at line 56 of file driver_uvis25.c.

◆ UVIS25_REG_CTRL_REG2

#define UVIS25_REG_CTRL_REG2   0x21

control 2 register

Definition at line 57 of file driver_uvis25.c.

◆ UVIS25_REG_CTRL_REG3

#define UVIS25_REG_CTRL_REG3   0x22

control 3 register

Definition at line 58 of file driver_uvis25.c.

◆ UVIS25_REG_INT_CFG

#define UVIS25_REG_INT_CFG   0x23

interrupt configure register

Definition at line 59 of file driver_uvis25.c.

◆ UVIS25_REG_INT_SOURCE

#define UVIS25_REG_INT_SOURCE   0x24

interrupt source register

Definition at line 60 of file driver_uvis25.c.

◆ UVIS25_REG_STATUS_REG

#define UVIS25_REG_STATUS_REG   0x27

status register

Definition at line 62 of file driver_uvis25.c.

◆ UVIS25_REG_THS_UV

#define UVIS25_REG_THS_UV   0x25

threshold uv register

Definition at line 61 of file driver_uvis25.c.

◆ UVIS25_REG_UV_OUT_REG

#define UVIS25_REG_UV_OUT_REG   0x28

uv output register

Definition at line 63 of file driver_uvis25.c.

◆ UVIS25_REG_WHO_AM_I

#define UVIS25_REG_WHO_AM_I   0x0F

chip register definition

who am i register

Definition at line 55 of file driver_uvis25.c.