From: penglei <1624952103@qq.com>
Date: Tue, 16 Sep 2025 11:03:14 +0000 (+0800)
Subject: 雷鸟优化马达控制,背光控制,开机增加音频
X-Git-Tag: leiniao_debug_1.0.0_20250922_020716~78^2~1
X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F2268%2Fhead;p=mirrors%2FFD230.git
雷鸟优化马达控制,背光控制,开机增加音频
---
diff --git a/code/sdk/application/wearable/ln/service/power_manager/src/power_display_service.c b/code/sdk/application/wearable/ln/service/power_manager/src/power_display_service.c
index 297dd3a53..f9f4cbdee 100644
--- a/code/sdk/application/wearable/ln/service/power_manager/src/power_display_service.c
+++ b/code/sdk/application/wearable/ln/service/power_manager/src/power_display_service.c
@@ -24,6 +24,10 @@
#include "graphic_service_wrapper.h"
#endif
+#ifdef CUSTOM_UTILS
+#include "custom_utils.h"
+#endif
+
#define DISPLAY_AUTO_POWER_OFF_PERIOD_MS 5000
#define DISPLAY_DEFAULT_BRIGHTNESS 50
#define POWER_DISPLAY_QUEUE_MAX_SIZE 64
@@ -90,6 +94,9 @@ static errcode_t power_display_msg_write(uint32_t msg_id, uint8_t *msg, uint16_t
static errcode_t power_display_turn_on_screen(void)
{
+#if defined(CUSTOM_UTILS) && defined(BOARD_LEINIAO)
+ uapi_lcd_backlight_on(50);
+#endif
#ifndef SUPPORT_OHOSFWK
message_type_t mt = TURN_ON_SCREEN_CMD;
uint32_t event_info = 0;
@@ -105,6 +112,9 @@ static errcode_t power_display_turn_on_screen(void)
static errcode_t power_display_turn_off_screen(void)
{
+#if defined(CUSTOM_UTILS) && defined(BOARD_LEINIAO)
+ uapi_lcd_backlight_off();
+#endif
#ifndef SUPPORT_OHOSFWK
message_type_t mt = TURN_OFF_SCREEN_CMD;
uint32_t event_info = 0;
diff --git a/code/sdk/build/config/target_config/brandy/config.py b/code/sdk/build/config/target_config/brandy/config.py
index d98a52c00..176043ccc 100644
--- a/code/sdk/build/config/target_config/brandy/config.py
+++ b/code/sdk/build/config/target_config/brandy/config.py
@@ -1225,7 +1225,7 @@ target = {
# 'WEARABLE_LOG_DEBUG',
'SUPPORT_RC_CALIBRATION',
# 'PPG_HX3695',
- 'VIB_USE_PWM',
+ # 'VIB_USE_PWM',
'CONFIG_PWM_SUPPORT',
# 'ACC_LIS2DOC',
'ENABLE_CUSTOM_I2C',
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/leiniao/fs/user/music/PowerOn.mp3 b/code/sdk/build/config/target_config/brandy/mk_fs_image/leiniao/fs/user/music/PowerOn.mp3
new file mode 100644
index 000000000..b1488e205
Binary files /dev/null and b/code/sdk/build/config/target_config/brandy/mk_fs_image/leiniao/fs/user/music/PowerOn.mp3 differ
diff --git a/code/sdk/drivers/boards/brandy_evb/board_config/board_leiniao.h b/code/sdk/drivers/boards/brandy_evb/board_config/board_leiniao.h
index 969738efe..07a30ca66 100644
--- a/code/sdk/drivers/boards/brandy_evb/board_config/board_leiniao.h
+++ b/code/sdk/drivers/boards/brandy_evb/board_config/board_leiniao.h
@@ -46,11 +46,11 @@ const hal_pio_config_t g_pio_function_config[PIN_MAX_NUMBER] = {
{ HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO24
{ HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO25
- { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_HGPIO0 NC
+ { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_HGPIO0 NC
{ HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_HGPIO1 NC
{ HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_HGPIO2 NC
{ HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_HGPIO3 NC
- { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_HGPIO4 NC
+ { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_HGPIO4 NC
{ HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_HGPIO5 NC
#if (defined CFG_DRIVERS_NANDFLASH)
{ HAL_PIO_FUNC_QSPI1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_HGPIO6
@@ -185,7 +185,7 @@ const hal_pio_config_t g_pio_function_config[PIN_MAX_NUMBER] = {
{ HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L29 charge done info æ£æµæ¯å¦å
满çµ
{ HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_L30 KP_MKIN1 å¤é CAT1 ï¼è¾åº
{ HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L31 KP_MKOUIT1 å¤é èç ,è¾å
¥
- { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_L32 NC
+ { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_L32 NC
{ HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_R0 PRG_LED_POWER ON å¿çççµæºæ§å¶è
{ HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_R1 SE_REST å®å
¨è¯çå¤ä½å¤éè
@@ -262,7 +262,7 @@ const hal_gpio_config_t g_gpio_function_config[PIN_MAX_NUMBER] = {
// S_AGPIO_L23 CAT_1_PWR_ON ----- high power on
{ S_AGPIO_L23, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL },
// S_AGPIO_L28 Cat1 reset ---- low reset
- // { S_AGPIO_L28, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL },
+ // { S_AGPIO_L24, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL },
#endif
// S_AGPIO_L17 HX3507_INT
// { S_AGPIO_L17, HAL_GPIO_DIRECTION_INPUT, HAL_GPIO_LEVEL_LOW, 0, NULL },
@@ -272,9 +272,9 @@ const hal_gpio_config_t g_gpio_function_config[PIN_MAX_NUMBER] = {
// { S_AGPIO_L13, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL },
// S_AGPIO_L26 å¿çå¤ä½ PPG reset
- { S_AGPIO_L26, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL },
+ // { S_AGPIO_L26, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL },
// S_AGPIO_R0 PRG_LED_POWER ON å¿çççµæºæ§å¶è
- { S_AGPIO_R0, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL },
+ // { S_AGPIO_R0, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL },
//S_AGPIO_L21 NTC_VDD_ON ç»ä½æå¼ NTCä¸æçµæº ,é»è®¤å
³é
{ S_AGPIO_L21, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_HIGH, 0, NULL },
@@ -287,10 +287,15 @@ const hal_gpio_config_t g_gpio_function_config[PIN_MAX_NUMBER] = {
{ S_AGPIO_R9, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL },
{ S_AGPIO_L20, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_HIGH, 0, NULL },
#endif
- //弿ºå¼å¯èå
- { S_AGPIO_L16, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_HIGH, 0, NULL },
+
+ // { S_AGPIO_L16, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_HIGH, 0, NULL },
//é»è®¤å
³é马达
- { S_AGPIO_R2, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL },
+ { S_AGPIO_L32, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL },
+ { S_AGPIO_R0, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL },
+ { S_HGPIO4, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL },
+ { S_HGPIO0, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL },
+
+
//é»è®¤å¼å¯ EXT LDO V3.0 V1.8
// { S_AGPIO_L18, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_HIGH, 0, NULL },
{ S_AGPIO_L14, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_HIGH, 0, NULL },
@@ -302,7 +307,7 @@ const hal_gpio_config_t g_gpio_function_config[PIN_MAX_NUMBER] = {
//{ S_AGPIO_L19, HAL_GPIO_DIRECTION_INPUT, NULL, GPIO_INTERRUPT_DEDGE, cywee_int_callback },
#endif
/**S_AGPIO_R1 GPO alipayé»è®¤resetpin*/
- { S_AGPIO_R1, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_HIGH, 0, NULL },
+ // { S_AGPIO_R1, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_HIGH, 0, NULL },
#ifdef SUPPORT_CAT1_SERVICE
/**cat1 ring input key*/
// { S_AGPIO_L31, HAL_GPIO_DIRECTION_INPUT, NULL, GPIO_INTERRUPT_DEDGE, cat1_ring_isr_callback},
diff --git a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player.h b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player.h
index 5db2684b0..9df359957 100644
--- a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player.h
+++ b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player.h
@@ -64,12 +64,12 @@ enum PlayerSeekMode : int32_t {
/** Moves the media position to the latest synchronization frame located after the given time position. */
PLAYER_SEEK_NEXT_SYNC,
/** Moves the media position to the latest synchronization frame located before or after the given time position. */
- PLAYER_SEEK_CLOSEST_SYNC,
- /** Moves the media position to the latest frame located before or after the given time position. */
- PLAYER_SEEK_CLOSEST,
-};
-
-/**
+ PLAYER_SEEK_CLOSEST_SYNC,
+ /** Moves the media position to the latest frame located before or after the given time position. */
+ PLAYER_SEEK_CLOSEST,
+};
+
+/**
* @brief Enumerates player states.
*
* @since 1.0
@@ -272,13 +272,13 @@ public:
int32_t Rewind(int64_t mSeconds, int32_t mode);
/**
- * @brief Sets the volume of the player.
- *
- * This function can be used during playback or pause. The value 0 indicates no sound, and 100
- * indicates the original volume.
- *
- * @param leftVolume Indicates the target volume of the left audio channel to set, ranging from 0 to 300.
- * @param rightVolume Indicates the target volume of the right audio channel to set, ranging from 0 to 300.
+ * @brief Sets the volume of the player.
+ *
+ * This function can be used during playback or pause. The value 0 indicates no sound, and 100
+ * indicates the original volume.
+ *
+ * @param leftVolume Indicates the target volume of the left audio channel to set, ranging from 0 to 300.
+ * @param rightVolume Indicates the target volume of the right audio channel to set, ranging from 0 to 300.
* @return Returns 0 if the setting is successful; returns -1 otherwise.
* @since 1.0
* @version 1.0
@@ -316,22 +316,22 @@ public:
* @return Returns true if the player is looping; returns false otherwise.
* @since 1.0
* @version 1.0
- */
- bool IsSingleLooping();
-
- /**
- * @brief Obtains the player state.
- *
- * @param state Indicates the player state. For details, see {@link PlayerStates}.
- * @return Returns 0 if the player state is obtained; returns -1 otherwise.
- * @since 1.0
- * @version 1.0
- */
- int32_t GetPlayerState(int32_t &state) const;
-
- /**
- * @brief Obtains the playback position, accurate to millisecond.
- *
+ */
+ bool IsSingleLooping();
+
+ /**
+ * @brief Obtains the player state.
+ *
+ * @param state Indicates the player state. For details, see {@link PlayerStates}.
+ * @return Returns 0 if the player state is obtained; returns -1 otherwise.
+ * @since 1.0
+ * @version 1.0
+ */
+ int32_t GetPlayerState(int32_t &state) const;
+
+ /**
+ * @brief Obtains the playback position, accurate to millisecond.
+ *
* @param time Indicates the playback position.
* @return Returns 0 if the playback position is obtained; returns -1 otherwise.
* @since 1.0
@@ -352,38 +352,38 @@ public:
* @version 1.0
*/
int32_t GetDuration(int64_t &durationMs) const;
-
- /**
- * Sets the playback speed.
- *
- * @param speed Indicates the playback speed to set, which support {-128/-64/-32/-16/-8/-4/-2/1/2/4/8/16/32/64/128}
- * @return Returns {@code 0} if the playback speed is set; returns {@code -1} otherwise.
- */
- int32_t SetPlaybackSpeed(float speed);
- /**
- * Obtains the playback speed.
- *
- * @param speed Indicates the playback speed.
- * @return Returns {@code 0} if the playback speed is set; returns {@code -1} otherwise.
- */
- int32_t GetPlaybackSpeed(float &speed);
- /**
- * Sets the audio type.
- *
- * @param type Indicates the audio type.
- * @return Returns {@code 0} if the setting is successful; returns {@code -1} otherwise.
- */
- int32_t SetAudioStreamType(int32_t type);
- /**
- * Obtains the audio type.
- *
- * @param type Indicates the audio type.
- * @return Returns {@code 0} if the playback speed is set; returns {@code -1} otherwise.
- */
- int32_t GetAudioStreamType(int32_t &type);
- /**
- * @brief Restores the player to the initial state.
- *
+
+ /**
+ * Sets the playback speed.
+ *
+ * @param speed Indicates the playback speed to set, which support {-128/-64/-32/-16/-8/-4/-2/1/2/4/8/16/32/64/128}
+ * @return Returns {@code 0} if the playback speed is set; returns {@code -1} otherwise.
+ */
+ int32_t SetPlaybackSpeed(float speed);
+ /**
+ * Obtains the playback speed.
+ *
+ * @param speed Indicates the playback speed.
+ * @return Returns {@code 0} if the playback speed is set; returns {@code -1} otherwise.
+ */
+ int32_t GetPlaybackSpeed(float &speed);
+ /**
+ * Sets the audio type.
+ *
+ * @param type Indicates the audio type.
+ * @return Returns {@code 0} if the setting is successful; returns {@code -1} otherwise.
+ */
+ int32_t SetAudioStreamType(int32_t type);
+ /**
+ * Obtains the audio type.
+ *
+ * @param type Indicates the audio type.
+ * @return Returns {@code 0} if the playback speed is set; returns {@code -1} otherwise.
+ */
+ int32_t GetAudioStreamType(int32_t &type);
+ /**
+ * @brief Restores the player to the initial state.
+ *
* @return Returns 0 if the player is restored; returns -1 otherwise.
* @since 1.0
* @version 1.0
@@ -404,18 +404,18 @@ public:
*
* @param cb Indicates the listener to register. For details, see {@link PlayerCallback}.
* @since 1.0
- * @version 1.0
- */
- void SetPlayerCallback(const std::shared_ptr &cb);
- /**
- * set parameter through format, extended interface.
- *
- * @param params Indicates the extended-informations. Format see {@link Format}
- * @return Returns {@code 0} if set parameter successfully; returns {@code -1} otherwise.
- * @note not support on current version
- */
- int32_t SetParameter(const Format ¶ms);
- /**
+ * @version 1.0
+ */
+ void SetPlayerCallback(const std::shared_ptr &cb);
+ /**
+ * set parameter through format, extended interface.
+ *
+ * @param params Indicates the extended-informations. Format see {@link Format}
+ * @return Returns {@code 0} if set parameter successfully; returns {@code -1} otherwise.
+ * @note not support on current version
+ */
+ int32_t SetParameter(const Format ¶ms);
+ /**
* get parameter through format, extended interface.
*
* @param params Indicates the extended-informations. Format see {@link Format}
@@ -423,44 +423,44 @@ public:
*/
int32_t GetParameter(Format ¶ms);
/**
- * get the total number of the tracks.
- *
- * @param totalTracks Indicates the total number of the tracks.
- * @return Returns {@code 0} if set parameter successfully; returns {@code -1} otherwise.
- */
+ * get the total number of the tracks.
+ *
+ * @param totalTracks Indicates the total number of the tracks.
+ * @return Returns {@code 0} if set parameter successfully; returns {@code -1} otherwise.
+ */
int32_t GetTotalTracks(int32_t &totalTracks);
/**
* set audio sessionid.
- *
+ *
* @param sessionId indicates sessionid to be set.
* @return Returns {@code 0} if set parameter successfully; returns {@code -1} otherwise.
*/
int32_t SetAudioSessionId(uint32_t sessionId);
/**
* get current audio sessionid.
- *
+ *
* @param indicates sessionid.
* @return Returns {@code 0} if get parameter successfully; returns {@code -1} otherwise.
*/
int32_t GetAudioSessionId(uint32_t &sessionId);
/**
* set output device.
- *
+ *
* @param deviceId indicates device to be set.
* @return Returns {@code 0} if set parameter successfully; returns {@code -1} otherwise.
*/
int32_t SetOutputDevice(int32_t deviceId);
/**
* get current route device.
- *
+ *
* @param deviceId indicates the output device.
* @return Returns {@code 0} if get parameter successfully; returns {@code -1} otherwise.
*/
int32_t GetRoutedDeviceId(int32_t &deviceId);
int32_t DumpInfo(PlayerDebugInfo *playerInfo);
-private:
- class PlayerImpl;
+private:
+ class PlayerImpl;
std::unique_ptr impl_;
};
} // namespace Media
diff --git a/code/sdk/zhihui/drivers/vibrator/service/vibrator_service.cpp b/code/sdk/zhihui/drivers/vibrator/service/vibrator_service.cpp
index 4ee1aee83..1a37565ba 100644
--- a/code/sdk/zhihui/drivers/vibrator/service/vibrator_service.cpp
+++ b/code/sdk/zhihui/drivers/vibrator/service/vibrator_service.cpp
@@ -2,7 +2,7 @@
* @Author: penglei 1624952103@qq.com
* @Date: 2024-08-08 16:33:23
* @LastEditors: penglei 1624952103@qq.com
- * @LastEditTime: 2025-07-31 17:09:45
+ * @LastEditTime: 2025-09-16 15:56:41
* @FilePath: /FD230/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp
* @Description:
*
@@ -61,17 +61,17 @@ void custom_VibratorFunc_int(int vibratorType)
case 3:
mail.cycle_time_ms = 235;
mail.duty = 50;
- mail.duration_time_ms = 60;
+ mail.duration_time_ms = 600;
break;
case 2:
mail.cycle_time_ms = 235;
mail.duty = 50;
- mail.duration_time_ms = 40;
+ mail.duration_time_ms = 400;
break;
case 1:
mail.cycle_time_ms = 235;
mail.duty = 50;
- mail.duration_time_ms = 20;
+ mail.duration_time_ms = 200;
break;
default:
break;
diff --git a/code/sdk/zhihui/drivers/vibrator/vibrator.c b/code/sdk/zhihui/drivers/vibrator/vibrator.c
index ea6965b77..fe98004e0 100644
--- a/code/sdk/zhihui/drivers/vibrator/vibrator.c
+++ b/code/sdk/zhihui/drivers/vibrator/vibrator.c
@@ -19,12 +19,17 @@
#include "chip_core_irq.h"
#include "pwm.h"
#include "pwm_porting.h"
-#include "pinctrl.h"
#include "vibrator.h"
+#ifdef BOARD_LEINIAO
+#define VIBRATOR_GPIOPPIN S_HGPIO4
+#else
+#define VIBRATOR_GPIOPPIN S_AGPIO_R2
+#endif
+
// #define VIB_DEBUG
#ifdef VIB_USE_PWM
-#define VIBRATOR_GPIOPPIN S_AGPIO_R2
+
// #define VIBRATORPIN_MODE HAL_PIO_FUNC_PWMP1_M2
#define VIBRATORPIN_MODE HAL_PIO_FUNC_PWMN1_M3
@@ -188,7 +193,7 @@ void g_VibratorFunc(uint16_t duty , uint16_t cycle_time_ms,uint16_t duration_tim
}
#else
-#define VIBRATOR_GPIOPPIN S_AGPIO_R2
+
#define VIBRATORPIN_MODE HAL_PIO_FUNC_GPIO
static pin_t pin = VIBRATOR_GPIOPPIN;
static pin_mode_t mode = VIBRATORPIN_MODE;
@@ -221,7 +226,7 @@ void g_VibratorFunc(uint16_t duty , uint16_t cycle_time_ms,uint16_t duration_tim
if (delaytime_ms_low == 0) delaytime_ms_low = 1;
if (delaytime_ms_high == 0) delaytime_ms_high = 1;
- // PRINT("g_VibratorFunc delaytime_ms_high %u , delaytime_ms_low %u \r\n",delaytime_ms_high,delaytime_ms_low );
+ printf("fac:g_VibratorFunc delaytime_ms_high %u , delaytime_ms_low %u \r\n",delaytime_ms_high,delaytime_ms_low );
while(duration_time_ms)
{
diff --git a/code/sdk/zhihui/drivers/vibrator/vibrator.h b/code/sdk/zhihui/drivers/vibrator/vibrator.h
index 079391598..84c4230fd 100644
--- a/code/sdk/zhihui/drivers/vibrator/vibrator.h
+++ b/code/sdk/zhihui/drivers/vibrator/vibrator.h
@@ -25,6 +25,10 @@ extern "C" {
*/
void g_VibratorFunc(uint16_t duty , uint16_t cycle_time_ms,uint16_t duration_time_ms);
+#ifdef BOARD_LEINIAO
+void uapi_motor_test(void);
+#endif
+
/**
* @}
*/
diff --git a/code/sdk/zhihui/drivers/vibrator/vibrator_at_cmd.c b/code/sdk/zhihui/drivers/vibrator/vibrator_at_cmd.c
index 6743ef6e0..7b8128e6c 100644
--- a/code/sdk/zhihui/drivers/vibrator/vibrator_at_cmd.c
+++ b/code/sdk/zhihui/drivers/vibrator/vibrator_at_cmd.c
@@ -68,7 +68,9 @@ static uint32_t vibrator_do_test(uint8_t *para, uint32_t paraLen, char *strCommo
PRINT("VIBRATORTEST ATCMD Convert Command Failed\n");
return ERRCODE_FAIL;
}
-
+#ifdef BOARD_LEINIAO
+ uapi_motor_test();
+#else
if (argc != 3) {
PRINT("VIBRATORTEST ATCMD Set Parameter Failed argc %d, should be AT^VIBRATORTEST=duration cycle duty \n",argc);
return ERRCODE_FAIL;
@@ -78,6 +80,8 @@ static uint32_t vibrator_do_test(uint8_t *para, uint32_t paraLen, char *strCommo
uint16_t duty = (uint16_t)atoi((char*)argv[2]);
PRINT("VIBRATORTEST ATCMD custom_VibratorFunc duration %u,cycle %u,duty %u\n",duration,cycle,duty);
hal_custom_VibratorFunc(duty,cycle,duration);
+#endif
+
return ERRCODE_SUCC;
}
diff --git a/code/sdk/zhihui/utils/custom_utils.c b/code/sdk/zhihui/utils/custom_utils.c
index b9c93d7ff..2bd48c791 100644
--- a/code/sdk/zhihui/utils/custom_utils.c
+++ b/code/sdk/zhihui/utils/custom_utils.c
@@ -584,7 +584,11 @@ void startup_post_init_task(void)
struct tm* timeinfo;
PRINT("startup_post_init_task !\r\n");
-
+#ifdef BOARD_LEINIAO
+ custom_play_audio("/user/music/PowerOn.mp3",100);
+ LOS_Msleep(1500);
+ custom_stop_play_audio();
+#endif
#ifdef SUPPORT_CYWEE_SERVICE
do_cywee_service_check_msg(CYWEE_SERVICE_CMD_TIME_SYNC,NULL);
#endif
@@ -4341,6 +4345,9 @@ void uapi_lcd_backlight_off(void)
void uapi_lcd_backlight_on(uint8_t brightness)
{
+#ifdef CUSTOM_ZHIHUI
+ brightness = cm_getScreenBrightness();
+#endif
uint8_t fall_edge_cnt = 0;
if (brightness <= 11) fall_edge_cnt = 7;
else if (brightness <= 24) fall_edge_cnt = 6;
diff --git a/code/sdk/zhihui/utilscpp/CMakeLists.txt b/code/sdk/zhihui/utilscpp/CMakeLists.txt
index 99caae410..2c2588472 100644
--- a/code/sdk/zhihui/utilscpp/CMakeLists.txt
+++ b/code/sdk/zhihui/utilscpp/CMakeLists.txt
@@ -18,7 +18,10 @@ set(PRIVATE_HEADER
${CMAKE_SOURCE_DIR}/middleware/utils/update/inner_include
${CMAKE_SOURCE_DIR}/middleware/services/gui/uikit/proprietary/include
${CMAKE_SOURCE_DIR}/middleware/services/gui/uikit/utils/interfaces/kits
+ ${CMAKE_SOURCE_DIR}/middleware/services/gui/uikit/surface/interfaces/kits
${CMAKE_SOURCE_DIR}/middleware/services/gui/uikit/utils/interfaces/innerkits
+ ${CMAKE_SOURCE_DIR}/middleware/services/media/foundation/player/interfaces/kits
+ ${CMAKE_SOURCE_DIR}/open_source/openharmony/drivers/peripheral/display/interfaces/include
)
set(PRIVATE_DEFINES
diff --git a/code/sdk/zhihui/utilscpp/custom_utilscpp.cpp b/code/sdk/zhihui/utilscpp/custom_utilscpp.cpp
index cae32a96a..48020d931 100644
--- a/code/sdk/zhihui/utilscpp/custom_utilscpp.cpp
+++ b/code/sdk/zhihui/utilscpp/custom_utilscpp.cpp
@@ -21,6 +21,8 @@
#include "audio_manager.h"
#include "audio_base_type.h"
+#include "player_lite/js/builtin/include/audio_player.h"
+
#include "bts_br_gap.h"
@@ -444,4 +446,125 @@ void custom_factory_bt_scan_stop(void)
#endif
#endif
+}
+
+/**
+ * @brief ææ¾æå®è·¯å¾çé³é¢æä»¶
+ * @param filePath é³é¢æä»¶è·¯å¾
+ * @param volume é³é (0-100)
+ * @return 0: æå, -1: 失败
+ */
+int custom_play_audio(const char* filePath, float volume)
+{
+ if (!filePath) {
+ filePath = "/user/userdata/1.mp3";
+ }
+
+ printf("=== Starting AudioPlayer playback ===\n");
+ printf("File: %s, Volume: %.1f%%\n", filePath, volume);
+
+ // æ£æ¥æä»¶æ¯å¦åå¨
+ struct stat fileStat;
+ if (stat(filePath, &fileStat) != 0 || !S_ISREG(fileStat.st_mode)) {
+ printf("ERROR: Audio file not found: %s\n", filePath);
+ return -1;
+ }
+ printf("Audio file exists, size: %ld bytes\n", fileStat.st_size);
+
+ // è·åAudioPlayeråä¾
+ OHOS::ACELite::AudioPlayer* player = OHOS::ACELite::AudioPlayer::GetInstance();
+ if (!player) {
+ printf("ERROR: Failed to get AudioPlayer instance\n");
+ return -1;
+ }
+ printf("AudioPlayer instance obtained\n");
+
+ // æ£æ¥åå§ç¶æ
+ bool initialPlaying = player->IsPlaying();
+ printf("Initial playing state: %s\n", initialPlaying ? "true" : "false");
+
+ // å
忢å½åææ¾
+ if (initialPlaying) {
+ printf("Stopping current playback...\n");
+ bool stopResult = player->Stop();
+ printf("Initial stop result: %s\n", stopResult ? "SUCCESS" : "FAILED");
+ }
+
+ // 设置é³é¢æº
+ printf("Setting audio source...\n");
+ if (!player->SetSrc(const_cast(filePath), false)) {
+ printf("ERROR: Failed to set audio source\n");
+ return -1;
+ }
+ printf("Audio source set successfully\n");
+
+ // 设置é³é (AudioPlayerçé³éèå´æ¯0.0-1.0)
+ double normalizedVolume = volume / 100.0;
+ if (normalizedVolume > 1.0) normalizedVolume = 1.0;
+ if (normalizedVolume < 0.0) normalizedVolume = 0.0;
+
+ printf("Setting volume to %.2f (%.1f%%)\n", normalizedVolume, volume);
+ if (!player->SetVolume(normalizedVolume)) {
+ printf("WARNING: Failed to set volume, continuing anyway\n");
+ // ä¸è¿åé误ï¼é³é设置失败ä¸åºè¯¥é»æ¢ææ¾
+ }
+
+ // å¼å§ææ¾
+ printf("Starting playback...\n");
+ if (!player->Play()) {
+ printf("ERROR: Failed to start playback\n");
+ return -1;
+ }
+
+ // æ£æ¥ææ¾ç¶æ
+ bool finalPlaying = player->IsPlaying();
+ const char* finalStatus = player->GetStatus();
+ printf("Final state - Status: %s, IsPlaying: %s\n",
+ finalStatus ? finalStatus : "null", finalPlaying ? "true" : "false");
+
+ printf("=== AudioPlayer playback started successfully ===\n");
+ return 0;
+}
+
+/**
+ * @brief åæ¢ææ¾å½åé³é¢
+ * @return 0: æå, -1: 失败
+ */
+int custom_stop_play_audio(void)
+{
+ printf("=== Starting AudioPlayer stop process ===\n");
+
+ OHOS::ACELite::AudioPlayer* player = OHOS::ACELite::AudioPlayer::GetInstance();
+ if (!player) {
+ printf("ERROR: AudioPlayer instance is null\n");
+ return -1;
+ }
+
+ printf("AudioPlayer instance obtained successfully\n");
+
+ // æ£æ¥å½åææ¾ç¶æ
+ bool isPlaying = player->IsPlaying();
+ const char* status = player->GetStatus();
+ printf("Current status: %s, IsPlaying: %s\n",
+ status ? status : "null", isPlaying ? "true" : "false");
+
+ printf("Attempting to stop playback...\n");
+ bool stopResult = player->Stop();
+ printf("Stop result: %s\n", stopResult ? "SUCCESS" : "FAILED");
+
+ // 忬¡æ£æ¥ç¶æ
+ bool isStillPlaying = player->IsPlaying();
+ const char* newStatus = player->GetStatus();
+ printf("After stop - Status: %s, IsPlaying: %s\n",
+ newStatus ? newStatus : "null", isStillPlaying ? "true" : "false");
+
+ if (!stopResult) {
+ printf("ERROR: Failed to stop AudioPlayer\n");
+ player->Stop();
+ }
+
+
+
+ printf("=== AudioPlayer stop process completed ===\n");
+ return 0;
}
\ No newline at end of file
diff --git a/code/sdk/zhihui/utilscpp/custom_utilscpp.h b/code/sdk/zhihui/utilscpp/custom_utilscpp.h
index 74c5db69a..47b15938a 100644
--- a/code/sdk/zhihui/utilscpp/custom_utilscpp.h
+++ b/code/sdk/zhihui/utilscpp/custom_utilscpp.h
@@ -2,7 +2,7 @@
* @Author: penglei 1624952103@qq.com
* @Date: 2024-07-09 20:22:54
* @LastEditors: penglei 1624952103@qq.com
- * @LastEditTime: 2025-08-20 15:13:20
+ * @LastEditTime: 2025-09-16 15:27:29
* @FilePath: /FD230/code/sdk/drivers/peripheral/utilscpp/custom_utilscpp.h
* @Description:
*
@@ -34,6 +34,9 @@ void custom_set_volume(uint8_t channel,int32_t sounding);
void custom_factory_bt_scan_start(void);
void custom_factory_bt_scan_stop(void);
+int custom_play_audio(const char* filePath, float volume);
+int custom_stop_play_audio(void);
+
/**
* input:
* func 彿°æé