2022-12-05 15:59:47 +08:00
|
|
|
/*
|
2022-12-05 21:01:26 +08:00
|
|
|
* @Descripttion:
|
|
|
|
* @version:
|
2022-12-05 15:59:47 +08:00
|
|
|
* @Author: Chenfu
|
|
|
|
* @Date: 2022-12-02 21:32:47
|
|
|
|
* @LastEditTime: 2022-12-05 15:25:46
|
|
|
|
*/
|
|
|
|
#ifndef SUPER_CAP_H
|
2022-12-05 21:01:26 +08:00
|
|
|
#define SUPER_CAP_H
|
2022-12-05 15:59:47 +08:00
|
|
|
|
|
|
|
#include "bsp_can.h"
|
|
|
|
|
2023-01-01 17:32:22 +08:00
|
|
|
#pragma pack(1)
|
2022-12-05 21:01:26 +08:00
|
|
|
typedef struct
|
2022-12-05 15:59:47 +08:00
|
|
|
{
|
2023-01-01 17:32:22 +08:00
|
|
|
uint16_t vol; // 电压
|
|
|
|
uint16_t current; // 电流
|
|
|
|
uint16_t power; // 功率
|
2022-12-05 21:01:26 +08:00
|
|
|
} SuperCap_Msg_s;
|
2023-01-01 17:32:22 +08:00
|
|
|
#pragma pack()
|
2022-12-05 15:59:47 +08:00
|
|
|
|
2023-01-01 17:32:22 +08:00
|
|
|
/* 超级电容实例 */
|
2022-12-05 15:59:47 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
2023-01-01 17:32:22 +08:00
|
|
|
CANInstance *can_ins; // CAN实例
|
|
|
|
SuperCap_Msg_s cap_msg; // 超级电容信息
|
2022-12-05 15:59:47 +08:00
|
|
|
} SuperCapInstance;
|
|
|
|
|
2023-01-01 17:32:22 +08:00
|
|
|
/* 超级电容初始化配置 */
|
2022-12-05 15:59:47 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
2022-12-05 21:01:26 +08:00
|
|
|
CAN_Init_Config_s can_config;
|
2022-12-05 15:59:47 +08:00
|
|
|
} SuperCap_Init_Config_s;
|
|
|
|
|
2023-01-01 17:32:22 +08:00
|
|
|
/**
|
|
|
|
* @brief 初始化超级电容
|
|
|
|
*
|
|
|
|
* @param supercap_config 超级电容初始化配置
|
|
|
|
* @return SuperCapInstance* 超级电容实例指针
|
|
|
|
*/
|
2022-12-05 21:01:26 +08:00
|
|
|
SuperCapInstance *SuperCapInit(SuperCap_Init_Config_s *supercap_config);
|
2022-12-05 15:59:47 +08:00
|
|
|
|
2023-01-01 17:32:22 +08:00
|
|
|
/**
|
|
|
|
* @brief 发送超级电容控制信息
|
|
|
|
*
|
|
|
|
* @param instance 超级电容实例
|
|
|
|
* @param data 超级电容控制信息
|
|
|
|
*/
|
2022-12-05 15:59:47 +08:00
|
|
|
void SuperCapSend(SuperCapInstance *instance, uint8_t *data);
|
|
|
|
|
|
|
|
#endif // !SUPER_CAP_Hd
|