mirror of
https://gitee.com/dlmu-cone/half-steering-basic-framework
synced 2026-10-23 17:42:20 +08:00
半舵旗舰版(功率控制有更改)
This commit is contained in:
38
modules/power_meter/power_meter.h
Normal file
38
modules/power_meter/power_meter.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef POWER_METER_H
|
||||
#define POWER_METER_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "bsp_can.h"
|
||||
#include "daemon.h"
|
||||
|
||||
#define POWER_METER_DEFAULT_CAN_ID 0x213u
|
||||
#define POWER_METER_DEFAULT_SCALE 100.0f
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CAN_Init_Config_s can_config;
|
||||
float scale;
|
||||
} PowerMeter_Init_Config_s;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CANInstance *can_ins;
|
||||
DaemonInstance *daemon;
|
||||
float voltage;
|
||||
float current;
|
||||
float power;
|
||||
float scale;
|
||||
uint16_t raw_voltage;
|
||||
uint16_t raw_current;
|
||||
uint32_t update_count;
|
||||
float last_update_time_ms;
|
||||
uint8_t online;
|
||||
} PowerMeterInstance;
|
||||
|
||||
PowerMeterInstance *PowerMeterInit(PowerMeter_Init_Config_s *config);
|
||||
PowerMeterInstance *PowerMeterInitCan(CAN_HandleTypeDef *can_handle, uint32_t rx_id);
|
||||
const PowerMeterInstance *PowerMeterGetData(PowerMeterInstance *meter);
|
||||
uint8_t PowerMeterIsOnline(PowerMeterInstance *meter);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user