/* * Copyright (c) 2022-2023, ArtInChip Technology Co., Ltd * * SPDX-License-Identifier: Apache-2.0 * * Authors: dwj */ #include #include #include #include #include #include #include rt_timer_t touch_timer; static void touch_timer_timeout(void *parameter) { if (!power_id_released) { rt_pm_module_release(PM_POWER_ID, PM_SLEEP_MODE_NONE); power_id_released = 1; } rt_pm_release_all(PM_SLEEP_MODE_NONE); } int touch_timer_init(void) { rt_tick_t timeout; if (!AIC_PM_POWER_TOUCH_TIME_SLEEP) timeout = RT_TICK_MAX / 2 - 1; else timeout = AIC_PM_POWER_TOUCH_TIME_SLEEP * RT_TICK_PER_SECOND; touch_timer = rt_timer_create("tp_timer", touch_timer_timeout, RT_NULL, timeout, RT_TIMER_FLAG_PERIODIC); if (touch_timer) rt_timer_start(touch_timer); return 0; } INIT_DEVICE_EXPORT(touch_timer_init);