]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - rpp/include/rpp/din.h
Minor changes of doxygen generated documentation.
[pes-rpp/rpp-lib.git] / rpp / include / rpp / din.h
1 /**
2  * Digital Input RPP API header file.
3  *
4  * @file din.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_DIN_H
13 #define __RPP_DIN_H
14
15 /**
16  * DIN 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_din_init();
24
25
26 /**
27  * Configure voltage reference levels for digital inputs using variable
28  * reference threshold.
29  *
30  * @todo Implement.
31  *
32  * @param[in] refA      [0-12000] voltage (in millivolts) to set the reference
33  *                      voltage A (pins 13-16).
34  * @param[in] refB      [0-12000] voltage (in millivolts) to set the reference
35  *                      voltage B (pins 9-12).
36  *
37  *
38  * @return SUCCESS if successful.\n
39  *         -1 if pin millivolts is out of range.
40  */
41 int8_t rpp_din_ref(uint16_t refA, uint16_t refB);
42
43
44 /**
45  * Configure given pin.
46  *
47  * @param[in] pin       The pin number to setup [1-16].
48  * @param[in] pull_type TRUE to setup pin as pull-up (a switch-to-ground device
49  *                      is connected) or FALSE to setup as pull-down
50  *                      (switch-to-battery).
51  *                      Note that pins [9-16] are pull-down only.
52  * @param[in] active    TRUE to setup pin as active or FALSE to set it as
53  *                      tri-stated.
54  * @param[in] can_wake  TRUE is given pin can wake module from sleep state and
55  *                      trigger an interrupt on MCU. FALSE otherwise.
56  *
57  * @return SUCCESS if successful.\n
58  *         -1 if pin number is out of range.\n
59  *         -2 if pull_type is requested for pins without this feature.
60  */
61 int8_t rpp_din_setup(uint8_t pin, boolean_t pull_type,
62                       boolean_t active, boolean_t can_wake);
63
64
65 /**
66  * Get the current cached value of the given pin.
67  *
68  * Call rpp_din_update() to update cached values.
69  *
70  * @param[in] pin       The pin number to read [1-16].
71  * @param[in] var_thr   TRUE to read from variable threshold uncached high speed
72  *                      channel. See rpp_din_ref().\n
73  *                      Note that only inputs [9-16] can use this option.\n
74  *                      Inputs [9-12] use variable threshold B and [13-16] use
75  *                      variable threshold B.\n
76  *                      FALSE to read from SPI cached value. All pins can use
77  *                      this option.
78  *
79  * @return HIGH or LOW if successful.\n
80  *         -1 if pin number is out of range.\n
81  *         -2 if var_thr is requested for inputs without this feature.
82  */
83 int8_t rpp_din_get(uint8_t pin, boolean_t var_thr);
84
85
86 /**
87  * Get the diagnostic cached value for given pin.
88  *
89  * Call rpp_din_update() to update cached values.
90  *
91  * @param[in] pin       The pin number to read [1-16].
92  *
93  * @return HIGH or LOW if successful.\n
94  *         -1 if pin number is out of range.
95  */
96 int8_t rpp_din_diag(uint8_t pin);
97
98
99 /**
100  * Read and update cached values and diagnostic values of all pins. Also commit
101  * changes on pin configurations.
102  *
103  * @return SUCCESS when transaction was successful.\n
104  *         FAILURE if transaction could not be confirmed.
105  */
106 int8_t rpp_din_update();
107
108
109 #endif /* __RPP_DIN_H */