summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/button-lradc-imx233.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/imx233/button-lradc-imx233.h')
-rw-r--r--firmware/target/arm/imx233/button-lradc-imx233.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/firmware/target/arm/imx233/button-lradc-imx233.h b/firmware/target/arm/imx233/button-lradc-imx233.h
index eac5517adf..d96823fcdc 100644
--- a/firmware/target/arm/imx233/button-lradc-imx233.h
+++ b/firmware/target/arm/imx233/button-lradc-imx233.h
@@ -30,7 +30,19 @@
* - imx233_button_lradc_mapping: target-defined table of adc values and mapping
* - IMX233_BUTTON_LRADC_CHANNEL: lradc channel to use
* - IMX233_BUTTON_LRADC_HOLD_DET: define hold detection method (ignored if !HAS_BUTTON_HOLD)
+ * - IMX233_BUTTON_LRADC_MODE: define the button lradc mode
*
+ * The LRADC code supports two modes of operations: VDDIO relative or absolute.
+ * In the (default) absolute value mode, the LRADC channel is sampled and its value
+ * is compared to the one in the imx233_button_lradc_mapping table. This is
+ * appropriate when the resistor ladder is derived from a fixed voltage.
+ * In the VDDIO relative mode, the values in imx233_button_lradc_mapping are
+ * the values for a specific value of VDDIO which is given by
+ * IMX233_BUTTON_LRADC_VDDIO. In this mode, the code will also sample VDDIO
+ * and do the following comparison:
+ * lradc_value <=? imx233_button_lradc_mapping[i] * vddio_ref / vddio_value
+ * where vddio_ref is IMX233_BUTTON_LRADC_VDDIO.
+ *
* The available values of IMX233_BUTTON_LRADC_HOLD are:
* - BLH_ADC: detect hold using adc
* - BLH_EXT: target button driver implements imx233_button_lradc_hold() using
@@ -40,6 +52,10 @@
* + BLH_GPIO_PIN: pin in bank
* + BLH_GPIO_INVERTED: define if inverted, default is active high
* + BLH_GPIO_PULLUP: define if pins needs pullup
+ *
+ * WARNING
+ * There must always be entry in imx233_button_lradc_mapping whose value is the steady
+ * value of the channel when no button is pressed, and which maps to no button (.btn = 0)
*/
/* hold detect method */
@@ -74,5 +90,8 @@ int imx233_button_lradc_read(int others);
bool imx233_button_lradc_hold(void);
#endif
int imx233_button_lradc_read_raw(void); // return raw adc value
+#ifdef IMX233_BUTTON_LRADC_VDDIO
+int imx233_button_lradc_read_vddio(void);
+#endif
#endif /* __button_lradc_imx233__ */