魔盒最新版本,更新了充电检测,鸟叫,dp4对声音的控制,声音模块由于硬件问题暂未实测
This commit is contained in:
@@ -233,13 +233,20 @@ BspHw_Ret_t bsp_hw_init(void)
|
||||
#if BOARD_CHG_ENABLE
|
||||
/* PORTG 作数字输入必须开 dieh,否则读不到 ME4054 CHG */
|
||||
gpio_disable_fun_output_port(BOARD_CHG_PIN);
|
||||
gpio_set_pull_up(BOARD_CHG_PIN, 0);
|
||||
/* ME4054 CHRG is open-drain/high-Z when not charging. Keep PG8 pulled
|
||||
* high so the digital input has a deterministic level in that state. */
|
||||
gpio_set_pull_up(BOARD_CHG_PIN, 1);
|
||||
gpio_set_pull_down(BOARD_CHG_PIN, 0);
|
||||
gpio_set_die(BOARD_CHG_PIN, 1);
|
||||
gpio_set_dieh(BOARD_CHG_PIN, 1);
|
||||
gpio_direction_input(BOARD_CHG_PIN);
|
||||
adc_add_sample_ch(AD_CH_LDO5V);
|
||||
adc_set_sample_freq(AD_CH_LDO5V, 500);
|
||||
|
||||
gpio_disable_fun_output_port(BOARD_STDBY_PIN);
|
||||
gpio_set_pull_up(BOARD_STDBY_PIN, 1);
|
||||
gpio_set_pull_down(BOARD_STDBY_PIN, 0);
|
||||
gpio_set_die(BOARD_STDBY_PIN, 1);
|
||||
gpio_set_dieh(BOARD_STDBY_PIN, 1);
|
||||
gpio_direction_input(BOARD_STDBY_PIN);
|
||||
#endif
|
||||
|
||||
#if BOARD_MOTOR_ENABLE
|
||||
@@ -423,6 +430,16 @@ uint8_t bsp_chg_is_low(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/** @return 1 when TP4056 STDBY is low; otherwise 0. */
|
||||
uint8_t bsp_stby_is_low(void)
|
||||
{
|
||||
#if BOARD_CHG_ENABLE
|
||||
return (uint8_t)(gpio_read(BOARD_STDBY_PIN) == BOARD_STDBY_FULL_LEVEL);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 读取电池电压
|
||||
* @return 电池电压,单位 mV
|
||||
|
||||
Reference in New Issue
Block a user