| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #ifndef _FOC_CMD_H__
- #define _FOC_CMD_H__
- #include "os/os_type.h"
- #include "config.h"
- typedef enum {
- Foc_Start_Motor = 1, //foc_start_stop_t, ready, unread, 014d01
- Foc_Cali_Hall_Phase, //calibrate hall phase, get the angle when motor running 0-360
- Foc_Cali_Hall_Offset,//calibrate hall offset from A phase 0x034d00
- Foc_Current_Limit, //u32, set the limited current//mA
- Foc_Set_Speed_Limit, //u32, set the limited speed//rpm
- Foc_Set_Speed_Target, //u32, set the target speed, just for test
- Foc_Set_Cruise_Speed, //u32, set the speed for curise riding
- Foc_Hall_Phase_Cali_Result,
- Foc_Hall_Offset_Cali_Result,
- Foc_Report_Speed,
- Foc_Report_Vbus_Current, //u32
- Foc_Report_Phase_Current, //s32,s32,s32
- Foc_Report_Dq_Current, //s32,s32
- Foc_Report_Vbus_Vol, //u32
- Foc_Report_Phase_Vol, //u32,u32,u32
- Foc_Report_Dq_Vol, //u32, u32
- Foc_Set_Open_Dq_Vol, //u32, u32, 114d000000000a000000, 114d0000000000000000
- Foc_Cmd_Max
- }foc_cmd_t;
- #define CMD_2_CAN_KEY(cmd) ((u16)(((u16)cmd) | (CAN_MY_ADDRESS<<8)))
- typedef enum {
- Foc_Start = 1,
- Foc_Stop,
- }foc_start_stop_t;
- typedef struct {
- foc_cmd_t cmd;
- u8 can_src;
- void *data;
- }foc_cmd_body_t;
- #pragma pack (push,1)
- typedef struct {
- foc_start_stop_t start_stop; //1: start, 2: stop
- }foc_start_cmd_t;
- typedef struct {
- u32 vq_mvol; //mV
- }hall_phase_cali_cmd_t;
- typedef struct {
- u32 vq_mvol; //mV
- u32 step_inc; //degree
- u32 step_time;//second
- }hall_offset_cali_cmd_t;
- #pragma pack(pop)
- void foc_command_init(void);
- bool foc_send_command(foc_cmd_body_t *command);
- #endif /*_FOC_CMD_H__ */
|