{ 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 安全芯片复位唤醒脚
- #if VIB_USE_PWM
+// #if VIB_USE_PWM
// { HAL_PIO_FUNC_PWMP1_M2, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_R2 VIBR_PWM 马达控制脚 兼容预留马达驱动复位脚
- { HAL_PIO_FUNC_PWMN1_M3, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_R2 VIBR_PWM 马达控制脚 兼容预留马达驱动复位脚
- #else
+ // { HAL_PIO_FUNC_PWMN1_M3, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_R2 VIBR_PWM 马达控制脚 兼容预留马达驱动复位脚
+// #else
{ HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_R2 VIBR_PWM 马达控制脚 兼容预留马达驱动复位脚
- #endif
+// #endif
{ HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_R3 NC
{ HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_DISABLE }, // S_AGPIO_R4 tp reset
{ HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_R5 touch int
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-17 09:32:03
* @LastEditors: SnickerSun snickersun@163.com
- * @LastEditTime: 2024-06-05 23:20:27
+ * @LastEditTime: 2024-06-19 20:23:10
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModelC.h
*/
#ifndef _CONFIG_MODEL_C_H_
uint8_t get_hour_show_model(void);
void set_hour_show_model(uint8_t showtype);
+uint8_t get_vibmod(void);
+
#ifdef __cplusplus
#if __cplusplus
}
*/
void ConfigModel::SetVibrationReminder(int state)
{
+ uapi_dev_runtime_set_vibmod(state);
set_condigData_Int(CONFIGMODEL_ITEM_VIBRATOR_SWITCH,state);
}
//更新24小时显示模式
uint8_t showtype=get_hour_show_model();
uapi_dev_runtime_set_time_hour_show_model(showtype);
+ uint8_t vibmod=get_vibmod();
+ uapi_dev_runtime_set_vibmod(vibmod);
}
uint32_t ConfigModelInit(void)
showtype = OHOS::ConfigModel::GetInstance()->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_24HOUR);
return showtype;
}
-
+uint8_t get_vibmod(void)
+{
+ uint8_t vibmod = 0;
+ vibmod = OHOS::ConfigModel::GetInstance()->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_VIBRATOR_SWITCH);
+ return vibmod;
+}
void set_hour_show_model(uint8_t showtype)
{
OHOS::ConfigModel::GetInstance()->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_24HOUR,showtype);
uint8_t in_silent_mode;
uint8_t in_lowpower_mode;
uint8_t stepcount;
-
+ uint8_t vibmod;
bt_runtime_status_t bt_runtime;
cat1_runtime_status_t cat1_runtime;
char current_dial_name[32];
uint16_t uapi_dev_runtime_get_ancs_clientid(void)
{
return g_runtime.bt_runtime.ble_ancs_client_id;
-}
\ No newline at end of file
+}
+
+
+void uapi_dev_runtime_set_vibmod(uint8_t vibmod)
+{
+ g_runtime.vibmod=vibmod;
+}
+uint8_t uapi_dev_runtime_get_vibmod(void)
+{
+ return g_runtime.vibmod;
+}
*/
char* uapi_dev_runtime_get_dialname(void);
+
+void uapi_dev_runtime_set_vibmod(uint8_t vibmod);
+
+uint8_t uapi_dev_runtime_get_vibmod(void);
/***************************************cat1 runtime 变量设置获取函数**************************************************/
#include "vibrator_hal.h"
#include "vibrator.h"
#include "custom_utils.h"
+#include "custom_runtime.h"
void custom_VibratorFunc_int(int vibratorType)
{
+
+ //忽略系统调用参数,只按照configmodel里保存的值来震动
+ uint8_t vibmod=uapi_dev_runtime_get_vibmod();
vibrator_cmd_t mail = {0};
- switch (vibratorType)
+ switch (vibmod)
{
case 3:
mail.cycle_time_ms = 235;
default:
break;
}
-
do_vibrator_cmd(mail);
}
#include "pinctrl.h"
#include "vibrator.h"
+// #define VIB_DEBUG
+
#ifdef VIB_USE_PWM
#define VIBRATOR_GPIOPPIN S_AGPIO_R2
// #define VIBRATORPIN_MODE HAL_PIO_FUNC_PWMP1_M2
pwm_started = 1;
uapi_pwm_init();
uapi_pin_set_mode(pin, mode);
- // PRINT("+++++++ pwm init success +++++++ \r\n");
-
+#ifdef VIB_DEBUG
+ PRINT("+++++++ pwm init success +++++++ \r\n");
+#endif
/* test for repeat, interrupt only be call when stop or close */
uint32_t clk_freq = uapi_pwm_get_frequency(channel);
uint32_t div_num = (clk_freq + freq / IOT_PWM_FREQ_PART) / freq;
.cycles = IOT_PWM_CFG_REPEAT_CYCLE,
.repeat = IOT_PWM_CFG_REPEAT_STATE
};
- // PRINT("+++++++ Start pwm clk_freq %u , cycles %u , high_time %u , low_time %u\r\n",
- // clk_freq,
- // cfg.cycles,
- // cfg.high_time,
- // cfg.low_time
- // );
-
+#ifdef VIB_DEBUG
+ PRINT("+++++++ Start pwm clk_freq %u , cycles %u , high_time %u , low_time %u\r\n",
+ clk_freq,
+ cfg.cycles,
+ cfg.high_time,
+ cfg.low_time
+ );
+#endif
ret = uapi_pwm_open(channel, &cfg);
- // PRINT("uapi_pwm_open %d\n",ret);
+#ifdef VIB_DEBUG
+ PRINT("uapi_pwm_open %d\n",ret);
+#endif
uapi_pwm_unregister_interrupt(channel);
uapi_pwm_register_interrupt(channel, pwm_test_callback);
uapi_pwm_start(0);
#else
ret = uapi_pwm_start(channel);
- // PRINT("uapi_pwm_start %d\n",ret);
-
+#ifdef VIB_DEBUG
+ PRINT("uapi_pwm_start %d\n",ret);
+#endif
#endif
return 0;
// LOS_Msleep((uint32_t)TEST_TCXO_DELAY_1000MS);
LOS_Msleep(delay_ms);
uapi_pwm_deinit();
-
+ LOS_Msleep(delay_ms);
+ uapi_pin_set_mode(VIBRATOR_GPIOPPIN, (pin_mode_t)HAL_PIO_FUNC_GPIO);
+ uapi_gpio_set_dir(VIBRATOR_GPIOPPIN,GPIO_DIRECTION_OUTPUT);
+ uapi_gpio_set_val(VIBRATOR_GPIOPPIN,GPIO_LEVEL_LOW);
pwm_started = 0;
- // PRINT("+++++++ pwm stoped +++++++ \r\n");
+#ifdef VIB_DEBUG
+ PRINT("+++++++ pwm stoped +++++++ \r\n");
+#endif
return 0;
}
{
PRINT("Not Supported param duty %u cycle_time_ms %u duration_time_ms %u !\r\n",duty,cycle_time_ms,duration_time_ms );
}else{
- // PRINT("g_VibratorFunc duration_time_ms %u , duty %u , cycle_time_ms %u\r\n",duration_time_ms ,duty, cycle_time_ms);
-
+#ifdef VIB_DEBUG
+ PRINT("g_VibratorFunc duration_time_ms %u , duty %u , cycle_time_ms %u\r\n",duration_time_ms ,duty, cycle_time_ms);
+#endif
if (vibrating == 1)
{
- PRINT("vibrating skip\r\n");
+#ifdef VIB_DEBUG
+ PRINT("vibrating skip\r\n");
+#endif
return ;
}
vibrating = 1;