update coulomb functions

master
ThinkPad 2020-04-29 18:30:35 +08:00
parent bfa947a1d4
commit 4b28353b86
3 changed files with 9 additions and 7 deletions

View File

@ -308,18 +308,20 @@ void StartButtonDetect(void *argument)
void StartCoulombRead(void *argument) void StartCoulombRead(void *argument)
{ {
/* USER CODE BEGIN StartCoulombRead */ /* USER CODE BEGIN StartCoulombRead */
coulomb_write_config_init(); //写寄存器方法
coulomb_write_config_load();
coulomb_write_config_actual_to_raw(); coulomb_write_config_actual_to_raw();
coulomb_write_config(); coulomb_write_config();
//读寄存器方法 //读寄存器方法
coulomb_read_status_and_config();
coulomb_read_status_raw_to_actual();
coulomb_read_config_raw_to_actual();
/* Infinite loop */ /* Infinite loop */
for(;;) for(;;)
{ {
coulomb_read_status_and_config(); coulomb_read_status_and_config();
coulomb_read_status_raw_to_actual(); coulomb_read_status_raw_to_actual();
coulomb_read_config_raw_to_actual();
if(NaviKit.system_runing) if(NaviKit.system_runing)
osDelay(500); osDelay(500);
else else

View File

@ -58,7 +58,7 @@ static uint8_t uint16_to_uint8_lsb(uint16_t data)
* @param {type} * @param {type}
* @return: * @return:
*/ */
// void coulomb_write_config_init_default() // void coulomb_write_config_load_default()
// { // {
// coulomb.write.raw.control = 0xEC; // coulomb.write.raw.control = 0xEC;
// coulomb.write.raw.accumulated_charge = 0x7fff; // coulomb.write.raw.accumulated_charge = 0x7fff;
@ -76,7 +76,7 @@ static uint8_t uint16_to_uint8_lsb(uint16_t data)
* @param {type} * @param {type}
* @return: * @return:
*/ */
void coulomb_write_config_init() void coulomb_write_config_load()
{ {
//控制寄存器配置 //控制寄存器配置
coulomb.write.actual.control.adc_mode = 0b00; coulomb.write.actual.control.adc_mode = 0b00;

View File

@ -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); 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(); void coulomb_write_config_actual_to_raw();
bool coulomb_write_config(); bool coulomb_write_config();
//读寄存器方法 //读寄存器方法