2021-03-10 11:03:35 +08:00
|
|
|
/*
|
|
|
|
* @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 <th_coulomb.h>
|
|
|
|
#include "coulomb.h"
|
|
|
|
#include "main.h"
|
|
|
|
#include "navikit.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Definitions for CoulombRead */
|
|
|
|
const osThreadAttr_t CoulombRead_attributes = {
|
|
|
|
.name = "CoulombRead",
|
2021-03-11 19:09:05 +08:00
|
|
|
.priority = (osPriority_t) osPriorityBelowNormal,
|
2021-03-10 11:03:35 +08:00
|
|
|
.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 */
|
2021-03-12 13:38:28 +08:00
|
|
|
log_d("Start Coulomb Read Task");
|
2021-03-10 11:03:35 +08:00
|
|
|
//写寄存器方法
|
|
|
|
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 */
|
|
|
|
}
|