2 * Digital Input RPP API header file.
6 * @copyright Copyright (C) 2013 Czech Technical University in Prague
8 * @author Carlos Jenkins <carlos@jenkins.co.cr>
16 * DIN module initialization.
17 * Call this method before using this module.
19 * @return SUCCESS if initialization successful.
20 * FAILURE if module already initialized.
22 int8_t rpp_din_init();
26 * Configure pull type for given pin.
28 * @param[in] pin The pin number to setup [1-16].
29 * @param[in] pull_type TRUE to setup pin as pull-up (a switch-to-ground device
30 * is connected) or FALSE to setup as pull-down
31 * (switch-to-battery).
32 * Note that pins [9-16] are pull-down only.
33 * @param[in] active TRUE to setup pin as active or FALSE to set it as
35 * @param[in] can_wake TRUE is given pin can wake module from sleep state and
36 * trigger an interrupt on MCU. FALSE otherwise.
38 * @return SUCCESS if successful.
39 * -1 if pin number is out of range.
40 * -2 if pull_type is requested for pins without this feature.
42 int8_t rpp_din_setup(uint8_t pin, boolean_t pull_type,
43 boolean_t active, boolean_t can_wake);
47 * Get the current cached value of the given pin.
48 * Call rpp_din_update() to update cached values.
50 * @param[in] pin The pin number to read [1-16].
51 * @param[in] var_thr Use variable threshold uncached high speed channel to
52 * read the value (True), or use SPI cached value (False).
53 * Note that only inputs [8-16] can use this option. Inputs
54 * [8-11] use variable threshold B and [12-16] use variable
57 * @return HIGH or LOW if successful.
58 * -1 if pin number is out of range.
59 * -2 if var_thr is requested for inputs without this feature.
61 int8_t rpp_din_get(uint8_t pin, boolean_t var_thr);
65 * Get the diagnostic cached value for given pin.
66 * Call rpp_din_update() to update cached values.
68 * @param[in] pin The pin number to read [1-16].
70 * @return HIGH or LOW if successful.
71 * -1 if pin number is out of range.
73 int8_t rpp_din_diag(uint8_t pin);
77 * Read and update cached values and diagnostic values of all pins. Also commit
78 * changes on pin configurations.
80 * @return SUCCESS when transaction was successful.
81 * FAILURE if transaction could not be confirmed.
83 int8_t rpp_din_update();
86 #endif /* __RPP_DIN_H */