From 56982b65326b34d09d69feaa3a00fc74495b8ab3 Mon Sep 17 00:00:00 2001 From: SnickerSun Date: Wed, 19 Jun 2024 18:22:31 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96vib=E9=9C=87=E5=8A=A8=E5=8F=82?= =?utf8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../vibrator/service/vibrator_service.cpp | 46 ++++++++----------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp b/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp index ab5645a2a..1b3d9ad14 100644 --- a/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp +++ b/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp @@ -48,32 +48,6 @@ static bool g_batter_service_initialled = false; #include "vibrator_hal.h" #include "vibrator.h" #include "custom_utils.h" -void custom_VibratorFunc(OHOS::VibratorType vibratorType) -{ - - vibrator_cmd_t mail = {0}; - switch (vibratorType) - { - case OHOS::VibratorType::VIBRATOR_TYPE_ONE: - mail.cycle_time_ms=200; - mail.duty = 20; - mail.duration_time_ms = 100; - break; - case OHOS::VibratorType::VIBRATOR_TYPE_TWO: - mail.cycle_time_ms=200; - mail.duty = 20; - mail.duration_time_ms = 200; - break; - case OHOS::VibratorType::VIBRATOR_TYPE_THREE: - mail.cycle_time_ms=200; - mail.duty = 20; - mail.duration_time_ms = 500; - break; - } - - do_vibrator_cmd(mail); - -} void custom_VibratorFunc_int(int vibratorType) { @@ -101,6 +75,26 @@ void custom_VibratorFunc_int(int vibratorType) do_vibrator_cmd(mail); } + + +void custom_VibratorFunc(OHOS::VibratorType vibratorType) +{ + + vibrator_cmd_t mail = {0}; + switch (vibratorType) + { + case OHOS::VibratorType::VIBRATOR_TYPE_ONE: + custom_VibratorFunc_int(1); + break; + case OHOS::VibratorType::VIBRATOR_TYPE_TWO: + custom_VibratorFunc_int(2); + break; + case OHOS::VibratorType::VIBRATOR_TYPE_THREE: + custom_VibratorFunc_int(3); + break; + } +} + #define MAG_CHECK_MS 20 static unsigned long g_app_queue; -- 2.17.1