summaryrefslogtreecommitdiff
path: root/board/poppy/base_detect_lux.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/poppy/base_detect_lux.c')
-rw-r--r--board/poppy/base_detect_lux.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/board/poppy/base_detect_lux.c b/board/poppy/base_detect_lux.c
index 48c4aa8929..3da86d5e27 100644
--- a/board/poppy/base_detect_lux.c
+++ b/board/poppy/base_detect_lux.c
@@ -210,3 +210,21 @@ static void base_init(void)
gpio_enable_interrupt(GPIO_BASE_DET_A);
}
DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT+1);
+
+void base_force_state(int state)
+{
+ if (state == 1) {
+ gpio_disable_interrupt(GPIO_BASE_DET_A);
+ base_detect_change(BASE_CONNECTED);
+ CPRINTS("BD forced connected");
+ } else if (state == 0) {
+ gpio_disable_interrupt(GPIO_BASE_DET_A);
+ base_detect_change(BASE_DISCONNECTED);
+ CPRINTS("BD forced disconnected");
+ } else {
+ hook_call_deferred(&base_detect_deferred_data,
+ BASE_DETECT_DEBOUNCE_US);
+ gpio_enable_interrupt(GPIO_BASE_DET_A);
+ CPRINTS("BD forced reset");
+ }
+}