Motion_EC_Stm32_archived/App/Src/th_coulomb.c

56 lines
1.2 KiB
C
Raw Permalink Normal View History

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 */
2021-03-15 19:26:10 +08:00
const osThreadAttr_t CoulombTask_attributes = {
.name = "CoulombTask",
2021-03-11 19:09:05 +08:00
.priority = (osPriority_t) osPriorityBelowNormal,
2021-03-15 19:26:10 +08:00
.stack_size = 256 * 4
2021-03-10 11:03:35 +08:00
};
/* USER CODE BEGIN Header_StartCoulombRead */
/**
* @brief Function implementing the CoulombRead thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_StartCoulombRead */
2021-03-15 19:26:10 +08:00
void CoulombTask(void *argument)
2021-03-10 11:03:35 +08:00
{
/* 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 */
}