upm
1.3.0
Sensor/Actuator repository for libmraa (v1.7.0)
Main Page
Related Pages
UPM Libraries
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
src
guvas12d
guvas12d.h
Go to the documentation of this file.
1
/*
2
* Author: Jon Trulson <jtrulson@ics.com>
3
* Copyright (c) 2016 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 <stdio.h>
28
#include <upm.h>
29
#include <mraa/aio.h>
30
31
#ifdef __cplusplus
32
extern
"C"
{
33
#endif
34
46
typedef
struct
_guvas12d_context
{
47
mraa_aio_context aio;
48
49
// ADC reference voltage
50
float
aref;
51
// ADC resolution
52
float
ares;
53
54
float
scale;
55
float
offset;
56
} *
guvas12d_context
;
57
63
guvas12d_context
guvas12d_init
(
int
pin,
float
aref);
64
68
void
guvas12d_close
(
guvas12d_context
dev);
69
76
upm_result_t
guvas12d_get_volts
(
const
guvas12d_context
dev,
float
*volts);
77
85
upm_result_t
guvas12d_get_intensity
(
const
guvas12d_context
dev,
86
float
*intensity);
87
95
void
guvas12d_set_offset
(
const
guvas12d_context
dev,
float
offset);
96
104
void
guvas12d_set_scale
(
const
guvas12d_context
dev,
float
scale);
105
106
#ifdef __cplusplus
107
}
108
#endif
guvas12d_close
void guvas12d_close(guvas12d_context dev)
Definition:
guvas12d.c:69
guvas12d_context
struct _guvas12d_context * guvas12d_context
guvas12d_set_scale
void guvas12d_set_scale(const guvas12d_context dev, float scale)
Definition:
guvas12d.c:123
guvas12d_set_offset
void guvas12d_set_offset(const guvas12d_context dev, float offset)
Definition:
guvas12d.c:116
guvas12d_get_volts
upm_result_t guvas12d_get_volts(const guvas12d_context dev, float *volts)
Definition:
guvas12d.c:79
guvas12d_init
guvas12d_context guvas12d_init(int pin, float aref)
Definition:
guvas12d.c:32
_guvas12d_context
Definition:
guvas12d.h:46
guvas12d_get_intensity
upm_result_t guvas12d_get_intensity(const guvas12d_context dev, float *intensity)
Definition:
guvas12d.c:96
Generated on Wed May 24 2017 14:57:03 for upm by
1.8.6