upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
veml6070.h
Go to the documentation of this file.
1 /*
2  * Author: Abhishek Malik <abhishek.malik@intel.com>
3  * Copyright (c) 2017 Intel Corporation.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 #pragma once
25 
26 #include <stdlib.h>
27 #include <unistd.h>
28 #include <stdio.h>
29 #include <string.h>
30 
31 #include "upm.h"
32 #include "mraa/i2c.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #define VEML6070_CTRL_REG 0x38 // write only
39 #define VEML6070_SEQ1_DATA_BUF_REG 0x39 // read only
40 #define VEML6070_SEQ2_DATA_BUF_REG 0x38 // read only
41 
42 typedef enum {
43  HALF_T = 0,
44  ONE_T,
45  TWO_T,
46  FOUR_T } veml6070_integration_time_t;
47 
56 typedef struct _veml6070_context {
57  mraa_i2c_context i2c_seq1;
58  mraa_i2c_context i2c_seq2;
59  uint8_t address_seq1;
60  uint8_t address_seq2;
61  int i2c_bus_number;
63 
73 
80 
88 
97 upm_result_t veml6070_set_integration_time(veml6070_context dev, veml6070_integration_time_t time);
98 
99 #ifdef __cplusplus
100 }
101 #endif
int16_t veml6070_get_uv_intensity(veml6070_context dev)
Definition: veml6070.c:82
void veml6070_close(veml6070_context dev)
Definition: veml6070.c:78
veml6070_context veml6070_init(int bus)
Definition: veml6070.c:26
upm_result_t veml6070_set_integration_time(veml6070_context dev, veml6070_integration_time_t time)
Definition: veml6070.c:101
Definition: veml6070.h:56