/* * @Description: * @Date: 2021-03-10 10:35:58 * @LastEditors: CK.Zh * @LastEditTime: 2021-03-10 10:38:44 * @FilePath: \NaviKit_EC_stm32\App\Src\th_coulomb.c */ #define LOG_TAG "TH-Coulomb" #include #include "coulomb.h" #include "main.h" #include "navikit.h" /* Definitions for CoulombRead */ const osThreadAttr_t CoulombRead_attributes = { .name = "CoulombRead", .priority = (osPriority_t) osPriorityBelowNormal, .stack_size = 128 * 4 }; /* USER CODE BEGIN Header_StartCoulombRead */ /** * @brief Function implementing the CoulombRead thread. * @param argument: Not used * @retval None */ /* USER CODE END Header_StartCoulombRead */ void StartCoulombRead(void *argument) { /* USER CODE BEGIN StartCoulombRead */ log_d("Start Coulomb Read Task"); //写寄存器方法 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(); if(NaviKit.sys.sta == run) osDelay(500); else osDelay(5000); } /* USER CODE END StartCoulombRead */ }