]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - rpp/include/rpp/mout.h
a51cb4ee86ac3060d562c873f0fd075576996dd0
[pes-rpp/rpp-lib.git] / rpp / include / rpp / mout.h
1 /**
2  * Power Output (12V, 2A, Push/Pull) RPP API header file.
3  *
4  * @file mout.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_MOUT_H
13 #define __RPP_MOUT_H
14
15 /**
16  * MOUT 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_mout_init();
24
25
26 /**
27  * Set the output of given pin to given value.
28  *
29  * This function will also verify if a faulty condition is detected. See return
30  * documentation below for details.
31  *
32  * @param[in] pin       The pin number to set [1-6].
33  * @param[in] val       The value to be set [HIGH|LOW].
34  *
35  * @return SUCCESS if pin could be set and verified.\n
36  *         -1 if pin number is out of range.\n
37  *         -2 if val is not HIGH or LOW.\n
38  *         -3 if pin could not be set. With current implementation this should
39  *            never happen.\n
40  *         -4 if pin is confirmed to be in trouble.
41  *            This normally indicates a hardware failure and that the driver
42  *            chip pulled the diagnostic pin.
43  */
44 int8_t rpp_mout_set(uint8_t pin, uint8_t val);
45
46
47 /**
48  * Get the cached value of the given pin set by rpp_mout_set().
49  *
50  * This will not read the value on the pin. To confirm if the output is
51  * correctly set call rpp_mout_diag() and confirm SUCCESS.
52  *
53  * @param[in] pin       The pin number to get cached value [1-6].
54  *
55  * @return HIGH or LOW cached from last rpp_mout_set() call for given pin.
56  *         -1 if pin number is out of range.
57  */
58 int8_t rpp_mout_get(uint8_t pin);
59
60
61 /**
62  * Reads the value on the given diagnostic pin.
63  *
64  * Note that rpp_mout_set() calls this routine already before returning.
65  *
66  * @param[in] pin       The pin number to read [1-6].
67  *
68  * @return SUCCESS is output is operating normally.
69  *         FAILURE if a faulty condition was detected.
70  */
71 int8_t rpp_mout_diag(uint8_t pin);
72
73
74 #endif /* __RPP_MOUT_H */