summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-02-04 00:26:32 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2014-02-10 23:14:25 +0100
commitdb5d74503eb97c1ed9d86c2f0c43663762c0b3d7 (patch)
treeae7c5f5c4be81355c8ddf2ee4065e5e6dbe1e7f4 /firmware/target/arm/imx233
parent65d5c426a798e6738999b02187d34728c306165a (diff)
downloadrockbox-db5d74503eb97c1ed9d86c2f0c43663762c0b3d7.tar.gz
rockbox-db5d74503eb97c1ed9d86c2f0c43663762c0b3d7.tar.bz2
rockbox-db5d74503eb97c1ed9d86c2f0c43663762c0b3d7.zip
imx233: add button debug screen
Change-Id: Iab85f1215a06507c06bffb746f2eac596e8c7992
Diffstat (limited to 'firmware/target/arm/imx233')
-rw-r--r--firmware/target/arm/imx233/debug-imx233.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/firmware/target/arm/imx233/debug-imx233.c b/firmware/target/arm/imx233/debug-imx233.c
index 4da6985cc9..9ca33ff715 100644
--- a/firmware/target/arm/imx233/debug-imx233.c
+++ b/firmware/target/arm/imx233/debug-imx233.c
@@ -41,6 +41,7 @@
#include "string.h"
#include "stdio.h"
#include "button.h"
+#include "button-lradc-imx233.h"
#define ACT_NONE 0
#define ACT_CANCEL 1
@@ -996,6 +997,81 @@ bool dbg_hw_info_timrot(void)
}
}
+bool dbg_hw_info_button(void)
+{
+ lcd_setfont(FONT_SYSFIXED);
+#if IMX233_SUBTARGET >= 3700 && defined(IMX233_BUTTON_LRADC_VDDIO)
+ int orig_vddio_val, orig_vddio_brownout;
+ imx233_power_get_regulator(REGULATOR_VDDIO, &orig_vddio_val, &orig_vddio_brownout);
+ int vddio_val = orig_vddio_val;
+ int vddio_brownout = orig_vddio_brownout;
+#endif
+
+ while(1)
+ {
+ int btn = my_get_action(0);
+ switch(btn)
+ {
+#if IMX233_SUBTARGET >= 3700 && defined(IMX233_BUTTON_LRADC_VDDIO)
+ case ACT_PREV:
+ vddio_val -= 100; /* mV */
+ vddio_brownout -= 100; /* mV */
+ imx233_power_set_regulator(REGULATOR_VDDIO, vddio_val, vddio_brownout);
+ break;
+ case ACT_NEXT:
+ vddio_val += 100; /* mV */
+ vddio_brownout += 100; /* mV */
+ imx233_power_set_regulator(REGULATOR_VDDIO, vddio_val, vddio_brownout);
+ break;
+#endif
+ case ACT_OK:
+#if IMX233_SUBTARGET >= 3700 && defined(IMX233_BUTTON_LRADC_VDDIO)
+ imx233_power_set_regulator(REGULATOR_VDDIO, orig_vddio_val, orig_vddio_brownout);
+#endif
+ lcd_setfont(FONT_UI);
+ return true;
+ case ACT_CANCEL:
+#if IMX233_SUBTARGET >= 3700 && defined(IMX233_BUTTON_LRADC_VDDIO)
+ imx233_power_set_regulator(REGULATOR_VDDIO, orig_vddio_val, orig_vddio_brownout);
+#endif
+ lcd_setfont(FONT_UI);
+ return false;
+ }
+
+ lcd_clear_display();
+ int line = 0;
+
+#ifdef HAVE_BUTTON_DATA
+ int data;
+ btn = button_read_device(&data);
+#else
+ btn = button_read_device();
+#endif
+ lcd_putsf(0, line++, "raw buttons: %x", btn);
+#ifdef IMX233_BUTTON_LRADC_CHANNEL
+ lcd_putsf(0, line++, "raw lradc: %d", imx233_button_lradc_read_raw());
+#ifdef IMX233_BUTTON_LRADC_VDDIO
+ lcd_putsf(0, line++, "vddio: %d", imx233_button_lradc_read_vddio());
+#endif
+#endif
+#ifdef HAS_BUTTON_HOLD
+ lcd_putsf(0, line++, "hold: %d", button_hold());
+#endif
+#ifdef HAVE_HEADPHONE_DETECTION
+ lcd_putsf(0, line++, "headphones: %d", headphones_inserted());
+#endif
+#ifdef HAVE_BUTTON_DATA
+#ifdef HAVE_TOUCHSCREEN
+ lcd_putsf(0, line++, "touch: x=%d y=%d", data >> 16, data & 0xffff);
+#else
+ lcd_putsf(0, line++, "data: %d", data);
+#endif
+#endif
+ lcd_update();
+ yield();
+ }
+}
+
static struct
{
const char *name;
@@ -1017,6 +1093,7 @@ static struct
{"emi", dbg_hw_info_emi},
{"audio", dbg_hw_info_audio},
{"timrot", dbg_hw_info_timrot},
+ {"button", dbg_hw_info_button},
{"target", dbg_hw_target_info},
};