upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Data Structures | Functions | Macros | Typedefs | Enumerations
Include dependency graph for veml6070.h:

API Description

/*
* Author: Abhishek Malik <abhishek.malik@intel.com>
* Copyright (c) 2017 Intel Corporation.
*
* 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.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "veml6070.h"
#include "upm_utilities.h"
int main()
{
if(dev == NULL) {
printf("Unable to initialize sensor\n");
return 0;
}
upm_delay(1);
while(1){
printf("Retrieved UV Value: %d\n", veml6070_get_uv_intensity(dev));
upm_delay(1);
}
return 0;
}

Go to the source code of this file.

Data Structures

struct  _veml6070_context
 

Functions

veml6070_context veml6070_init (int bus)
 
void veml6070_close (veml6070_context dev)
 
int16_t veml6070_get_uv_intensity (veml6070_context dev)
 
upm_result_t veml6070_set_integration_time (veml6070_context dev, veml6070_integration_time_t time)
 

Macros

#define VEML6070_CTRL_REG   0x38
 
#define VEML6070_SEQ1_DATA_BUF_REG   0x39
 
#define VEML6070_SEQ2_DATA_BUF_REG   0x38
 

Typedefs

typedef struct _veml6070_contextveml6070_context
 

Enumerations

enum  veml6070_integration_time_t { HALF_T = 0, ONE_T, TWO_T, FOUR_T }
 

Function Documentation

veml6070_context veml6070_init ( int  bus)

VEML6070 Initialization function

Parameters
busI2C bus to use
addressI2C address to use
Returns
device context pointer
void veml6070_close ( veml6070_context  dev)

VEML6070 Close function

Parameters
devveml6070_context pointer

Here is the caller graph for this function:

int16_t veml6070_get_uv_intensity ( veml6070_context  dev)

Function to get the UV values

Parameters
devveml6070_context pointer
Returns
int16_t UV value

Here is the caller graph for this function:

upm_result_t veml6070_set_integration_time ( veml6070_context  dev,
veml6070_integration_time_t  time 
)

Function to set the integration time of the sensor

Parameters
devveml6070_context pointer
timeveml6070_integration_time_t
Returns
upm_result_t

Here is the caller graph for this function: