diff --git a/Core/Src/freertos.c b/Core/Src/freertos.c index 0b91631..a996109 100644 --- a/Core/Src/freertos.c +++ b/Core/Src/freertos.c @@ -308,18 +308,20 @@ void StartButtonDetect(void *argument) void StartCoulombRead(void *argument) { /* USER CODE BEGIN StartCoulombRead */ - coulomb_write_config_init(); + //写寄存器方法 + coulomb_write_config_load(); coulomb_write_config_actual_to_raw(); coulomb_write_config(); -//读寄存器方法 - + //读寄存器方法 + coulomb_read_status_and_config(); + coulomb_read_status_raw_to_actual(); + coulomb_read_config_raw_to_actual(); /* Infinite loop */ for(;;) { coulomb_read_status_and_config(); coulomb_read_status_raw_to_actual(); - coulomb_read_config_raw_to_actual(); if(NaviKit.system_runing) osDelay(500); else diff --git a/Middlewares/Coulomb/coulomb.c b/Middlewares/Coulomb/coulomb.c index 8053239..4b2b8a8 100644 --- a/Middlewares/Coulomb/coulomb.c +++ b/Middlewares/Coulomb/coulomb.c @@ -58,7 +58,7 @@ static uint8_t uint16_to_uint8_lsb(uint16_t data) * @param {type} * @return: */ -// void coulomb_write_config_init_default() +// void coulomb_write_config_load_default() // { // coulomb.write.raw.control = 0xEC; // coulomb.write.raw.accumulated_charge = 0x7fff; @@ -76,7 +76,7 @@ static uint8_t uint16_to_uint8_lsb(uint16_t data) * @param {type} * @return: */ -void coulomb_write_config_init() +void coulomb_write_config_load() { //控制寄存器配置 coulomb.write.actual.control.adc_mode = 0b00; diff --git a/Middlewares/Coulomb/coulomb.h b/Middlewares/Coulomb/coulomb.h index dd7afc4..ee87fe6 100644 --- a/Middlewares/Coulomb/coulomb.h +++ b/Middlewares/Coulomb/coulomb.h @@ -123,7 +123,7 @@ static uint16_t uint8_to_uint16(uint8_t *pData,uint8_t msbIndex,uint8_t lsbIndex static uint8_t uint16_to_uint8_msb(uint16_t data); //写配置方法 -void coulomb_write_config_init(); +void coulomb_write_config_load(); void coulomb_write_config_actual_to_raw(); bool coulomb_write_config(); //读寄存器方法