summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoy Cho <joy.cho@hardkernel.com>2020-07-07 07:52:33 +0300
committerJoy Cho <joy.cho@hardkernel.com>2020-07-07 08:58:17 +0300
commit17b9bf5365776a9a6f8687948522aca4025673a5 (patch)
tree37ed522a255e87cf8e6ca0b253ebc9a1219490d8
parent8273f6996fd8c275ee6ede942b48bbc4c1142cd3 (diff)
downloadu-boot-17b9bf5365776a9a6f8687948522aca4025673a5.tar.xz
cmd: odroidtest: Update gpiokey auto test
- Add termination mode using key combination F1+F6 - Update key event display Change-Id: I66d1ba2303dc4050ce022b303cc1a60e45604e47
-rw-r--r--cmd/odroidtest.c42
-rw-r--r--cmd/odroidtest.h10
2 files changed, 35 insertions, 17 deletions
diff --git a/cmd/odroidtest.c b/cmd/odroidtest.c
index a7d54c2c36..cab6fcd693 100644
--- a/cmd/odroidtest.c
+++ b/cmd/odroidtest.c
@@ -255,7 +255,7 @@ static int do_odroidtest_lcd(cmd_tbl_t * cmdtp, int flag,
return ret;
}
-void btn_draw_key_arrays(int numkeys)
+void btn_draw_key_arrays(int numkeys, int key_idx)
{
int i;
@@ -266,7 +266,7 @@ void btn_draw_key_arrays(int numkeys)
lcd_printf(0, 1, 1, "[ GPIO KEY TEST ]");
for (i = 0; i < numkeys; i++) {
- if (gpiokeys[i].chk)
+ if ((gpiokeys[i].chk) && (i != key_idx))
lcd_setfg_color("blue");
else
lcd_setfg_color("red");
@@ -275,6 +275,11 @@ void btn_draw_key_arrays(int numkeys)
0, gpiokeys[i].name);
}
+ mdelay(200);
+
+ lcd_setfg_color("blue");
+ lcd_printf(gpiokeys[key_idx].x, gpiokeys[key_idx].y,
+ 0, gpiokeys[key_idx].name);
}
static int btn_passed;
@@ -287,15 +292,13 @@ int btn_update_key_status(int key)
if(!(gpiokeys[i].chk)) {
gpiokeys[i].chk = 1;
btn_passed++;
- return 1;
- } else {
- return 0;
}
+ return i;
}
i++;
}
- return 0;
+ return -1;
}
void btn_set_default(void)
@@ -310,7 +313,7 @@ void btn_set_default(void)
static int do_odroidtest_btn(cmd_tbl_t * cmdtp, int flag,
int argc, char * const argv[])
{
- int key, numkeys;
+ int key, numkeys, key_idx;
const char *hwrev = env_get("hwrev");
if (hwrev && !strcmp(hwrev, "v11"))
@@ -318,18 +321,33 @@ static int do_odroidtest_btn(cmd_tbl_t * cmdtp, int flag,
else
numkeys = NUMGPIOKEYS - 2;
- btn_draw_key_arrays(numkeys);
+ key_idx = -1;
+ btn_draw_key_arrays(numkeys, key_idx);
mdelay(2000);
- while (btn_passed < numkeys) {
+ while (1) {
key = wait_key_event();
- if (btn_update_key_status(key))
- btn_draw_key_arrays(numkeys);
+ key_idx = btn_update_key_status(key);
+ btn_draw_key_arrays(numkeys, key_idx);
printf("key 0x%x, passed %d\n", key, btn_passed);
+
+ /* termination using F1+F6 */
+ if ((key == BTN_TRIGGER_HAPPY1) || (key == BTN_TRIGGER_HAPPY6)) {
+ printf("check termination keys, key_idx %d\n", key_idx);
+
+ if(!run_command("gpio input C0", 0)
+ && !run_command("gpio input C5", 0)) {
+ printf("Got termination key!\n");
+ break;
+ }
+ }
}
lcd_setfg_color("white");
- lcd_printf(0, 18, 1, "GPIO KEY TEST PASS!");
+ if (btn_passed == numkeys)
+ lcd_printf(0, 18, 1, "GPIO KEY TEST PASS!");
+ else
+ lcd_printf(0, 18, 1, "GPIO KEY TEST TERMINATED!");
btn_set_default();
diff --git a/cmd/odroidtest.h b/cmd/odroidtest.h
index dd926228b8..8f60188904 100644
--- a/cmd/odroidtest.h
+++ b/cmd/odroidtest.h
@@ -34,12 +34,12 @@ struct key_arrays gpiokeys[NUMGPIOKEYS] = {
{"[sw6]", BTN_SOUTH, 336, 11, 0},
{"[sw7]", BTN_WEST, 288, 9, 0},
{"[sw8]", BTN_NORTH, 336, 7, 0},
- {"[sw9]", BTN_TRIGGER_HAPPY1, 52, 15, 0},
+ {"[sw9]", BTN_TRIGGER_HAPPY1, 50, 15, 0},
{"[sw10]", BTN_TRIGGER_HAPPY2, 96, 15, 0},
- {"[sw11]", BTN_TRIGGER_HAPPY3, 190, 15, 0},
- {"[sw12]", BTN_TRIGGER_HAPPY4, 240, 15, 0},
- {"[sw13]", BTN_TRIGGER_HAPPY5, 334, 15, 0},
- {"[sw14]", BTN_TRIGGER_HAPPY6, 384, 15, 0},
+ {"[sw11]", BTN_TRIGGER_HAPPY3, 188, 15, 0},
+ {"[sw12]", BTN_TRIGGER_HAPPY4, 242, 15, 0},
+ {"[sw13]", BTN_TRIGGER_HAPPY5, 332, 15, 0},
+ {"[sw14]", BTN_TRIGGER_HAPPY6, 386, 15, 0},
{"[sw15]", BTN_TL, 48, 5, 0},
{"[sw16]", BTN_TR, 384, 5, 0},
{"[sw20]", BTN_TL2, 48, 3, 0},