准备更换NST1002 传感器 ,提交之前的NTC修改备份

This commit is contained in:
helloyifa 2025-04-08 15:19:10 +08:00
parent ccb804412d
commit 6233f7c07b
4 changed files with 51 additions and 3 deletions

View File

@ -21,7 +21,6 @@ void temperature_blink_led(){
gpio_direction_output(IO_PORTA_07, 1);
}
}
/*********************** 宏定义 *********************************/
#define NTC_ADC_MAX 90+1
#define TEMPERA_START 3400
@ -182,6 +181,20 @@ void temperature_detect(void)
void temperature_init(void){
printf(">>>>>>>>>>>>>>>>> temperature_init ...\n");
extern u16 get_vbat_trim();
extern u16 get_vbg_trim();
printf("vbat_trim:%d...vbg_trim:%d",get_vbat_trim(),get_vbg_trim());
//添加以上代码看打印值如果为15跟63那就要用烧录器先烧录一遍。
//GET DEVICE MAC
u8 bt_mac_addr[6] = {0};
bt_get_vm_mac_addr(&bt_mac_addr);
//le_controller_set_mac((void *)bt_mac_addr);
printf("device mac: %02x %02x %02x %02x %02x %02x \n",bt_mac_addr[0],bt_mac_addr[1],bt_mac_addr[2],bt_mac_addr[3],bt_mac_addr[4],bt_mac_addr[5]);
//NTC VDD
gpio_direction_output(IO_PORTB_05, 1);

View File

@ -4,6 +4,32 @@
#include "typedef.h"
#include "system/event.h"
#define BLE_TEMPERATURE_DETECT_INTERVAL 250
#define BLE_TEMPERATURE_WORK_TIMEOUT 10*1000
#define BLE_TEMPERATURE_SLEEP_TIMEOUT 3*1000
#define BLE_TEMPERATURE_DEVICE_NAME "IT12"
#define BLE_TEMPERATURE_LOWPOWER_OFFSIZE 3000 //mV
#define BLE_TEMPERATURE_DEVICE_NST1002 1002
#define BLE_TEMPERATURE_DEVICE_NTC 0
struct app_dev_info_t
{
u16 temperature_sensor;
u32 temperature_ntc;
u8 batt_percent;
u16 batt_vat;
u8 is_bat_charge;
u8 is_bat_full;
};
struct app_dev_config_t
{
u8 detect_interval;
};
extern struct app_dev_info_t dev_info;
void temperature_init(void);
#endif //_APP_TEMPERATURE_H_

View File

@ -75,7 +75,13 @@ void btstack_ble_start_before_init(const ble_init_cfg_t *cfg, int param)
//生成edr对应唯一地址
lib_make_ble_address(tmp_ble_addr, (void *)bt_get_mac_addr());
}
//helloyifa
tmp_ble_addr[0] = 0x11;
tmp_ble_addr[1] = 0x22;
tmp_ble_addr[2] = 0x33;
tmp_ble_addr[3] = 0x44;
tmp_ble_addr[4] = 0x55;
tmp_ble_addr[5] = 0x66;
le_controller_set_mac((void *)tmp_ble_addr);
log_info("---ble's address");

View File

@ -49,7 +49,10 @@ void charge_full_deal(void)
{
log_info("%s\n", __func__);
charge_close();
power_set_soft_poweroff();
//power_set_soft_poweroff();
//extern spple_set_soft_poweroff();
//spple_set_soft_poweroff();
spple_power_event_to_user(POWER_EVENT_POWER_SOFTOFF);
log_info("!!!!!!!!!!!!!! POWER OFF!!!!!!!!!!!!!!!!\n");
}