upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
ldt0028.h
Go to the documentation of this file.
1 /*
2  * Author: Noel Eck <noel.eck@intel.com>
3  * Copyright (c) 2015 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 
25 #pragma once
26 
27 #include "upm.h"
28 #include "mraa/aio.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
45 typedef struct _ldt0028_context {
46  /* mraa aio pin context */
47  mraa_aio_context aio;
48  /* Analog voltage reference */
49  float m_aRef;
50  /* Scale */
51  float m_scale;
52  /* Offset in sensor units */
53  float m_offset;
55 
61 ldt0028_context ldt0028_init(int16_t pin);
62 
68 
75 upm_result_t ldt0028_set_aref(const ldt0028_context dev, float aref);
76 
84 upm_result_t ldt0028_set_scale(const ldt0028_context dev, float scale);
85 
93 upm_result_t ldt0028_set_offset(const ldt0028_context dev, float offset);
94 
100 float ldt0028_get_aref(const ldt0028_context dev);
101 
107 float ldt0028_get_scale(const ldt0028_context dev);
108 
114 float ldt0028_get_offset(const ldt0028_context dev);
115 
122 upm_result_t ldt0028_get_normalized(const ldt0028_context dev, float *value);
123 
130 upm_result_t ldt0028_get_raw_volts(const ldt0028_context dev, float *value);
131 
138 upm_result_t ldt0028_get_volts(const ldt0028_context dev, float *value);
139 #ifdef __cplusplus
140 }
141 #endif
void ldt0028_close(ldt0028_context dev)
Definition: ldt0028.c:61
upm_result_t ldt0028_set_aref(const ldt0028_context dev, float aref)
Definition: ldt0028.c:67
ldt0028_context ldt0028_init(int16_t pin)
Definition: ldt0028.c:30
float ldt0028_get_aref(const ldt0028_context dev)
Definition: ldt0028.c:85
upm_result_t ldt0028_set_scale(const ldt0028_context dev, float scale)
Definition: ldt0028.c:73
float ldt0028_get_scale(const ldt0028_context dev)
Definition: ldt0028.c:90
float ldt0028_get_offset(const ldt0028_context dev)
Definition: ldt0028.c:95
struct _ldt0028_context * ldt0028_context
upm_result_t ldt0028_get_volts(const ldt0028_context dev, float *value)
Definition: ldt0028.c:120
upm_result_t ldt0028_set_offset(const ldt0028_context dev, float offset)
Definition: ldt0028.c:79
Definition: ldt0028.h:45
upm_result_t ldt0028_get_normalized(const ldt0028_context dev, float *value)
Definition: ldt0028.c:100
upm_result_t ldt0028_get_raw_volts(const ldt0028_context dev, float *value)
Definition: ldt0028.c:108