]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - rpp/include/rpp/lout.h
Make the RPP layer thread safe
[pes-rpp/rpp-lib.git] / rpp / include / rpp / lout.h
1 /**
2  * Logic Output RPP API header file.
3  *
4  * @file lout.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_LOUT_H
13 #define __RPP_LOUT_H
14
15 /**
16  * LOUT module initialization.
17  *
18  * Call this method before using this module.
19  *
20  * This function is not thread safe. Do not call it from multiple threads.
21  *
22  * @return SUCCESS if initialization successful.\n
23  *         FAILURE if module already initialized.
24  */
25 int8_t rpp_lout_init();
26
27
28 /**
29  * Set the output cache of given pin to given value.
30  *
31  * The function is thread safe, unless compiled with -DRPP_THREADSAFE=0.
32  *
33  * Call rpp_lout_update() to flush cached values to real hardware.
34  *
35  * @param[in] pin       The pin number to set [1-8].
36  * @param[in] val       The value to be set [HIGH|LOW].
37  *
38  * @return SUCCESS when success.\n
39  *         -1 if pin number is out of range.
40  */
41 int8_t rpp_lout_set(uint8_t pin, uint8_t val);
42
43
44 /**
45  * Get the diagnostic cached value for given pin.
46  *
47  * The function is thread safe, unless compiled with -DRPP_THREADSAFE=0.
48  *
49  * Call rpp_lout_update() to update cached values.
50  *
51  * @param[in] pin       The pin number to read [1-8].
52  *
53  * @return HIGH or LOW if successful.\n
54  *         -1 if pin number is out of range.
55  */
56 int8_t rpp_lout_diag(uint8_t pin);
57
58
59 /**
60  * Flush cached output values and read back diagnostic values of all pins.
61  *
62  * The function is thread safe, unless compiled with -DRPP_THREADSAFE=0.
63  *
64  * @return SUCCESS when transaction was successful.\n
65  *         FAILURE if transaction could not be confirmed.
66  */
67 int8_t rpp_lout_update();
68
69
70 #endif /* __RPP_LOUT_H */