]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blob - rpp/lib/rpp/include/rpp/ain.h
1499b93ead6b24de366d11f8f2504fdc0e0c4996
[pes-rpp/rpp-test-sw.git] / rpp / lib / rpp / include / rpp / ain.h
1 /**
2  * Analog Input RPP API header file.
3  *
4  * @file ain.h
5  *
6  * @copyright Copyright (C) 2013 Czech Technical University in Prague
7  *
8  * @author Carlos Jenkins <carlos@jenkins.co.cr>
9  */
10
11
12 #ifndef __RPP_AIN_H
13 #define __RPP_AIN_H
14
15 /**
16  * AIN module initialization.
17  *
18  * Call this method before using this module.
19  *
20  * @return SUCCESS if initialization successful.\n
21  *         FAILURE if module already initialized.
22  */
23 int8_t rpp_ain_init();
24
25
26 /**
27  * Get the current analog value on the given pin.
28  *
29  * @param[in] pin       The pin number to read [1-12].
30  *
31  * @return [0-4095] Value representing the analog value on given pin
32  *                   (ADC is 12bit resolution).\n
33  *          -1 if pin number is out of range.
34  */
35 int16_t rpp_ain_get(uint8_t pin);
36
37
38 /**
39  * Read and update analog cached values.
40  *
41  * @return SUCCESS when transaction was successful.\n
42  *         FAILURE if transaction could not be confirmed.
43  */
44 int8_t rpp_ain_update();
45
46
47 #endif /* __RPP_AIN_H */