This repository has been archived on 2026-04-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
hero/Mecanum Wheel moving project 1/Core/Inc/CToC.h
2025-11-27 20:08:38 +08:00

33 lines
992 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __CToC_H
#define __CToC_H
#include "main.h"
#include "M3508.h"
#define CToC_MasterID1 0x019//ID1
#define CToC_SlaveID1 0x149//ID1
#define CToC_SlaveID2 0x189//ID2
//中断回调函数
//判断接受对象的ID-符合条件-完成解码-发送数据包
//motor_chassismotor_measure_t 类型的数组,其中装有电机转子角度,电机转子转速,控制电流,温度
//定义函数
#define get_motor_measure(ptr, data) \
{ \
(ptr)->last_ecd = (ptr)->ecd; \
(ptr)->ecd = (uint16_t)((data)[0] << 8 | (data)[1]); \
(ptr)->speed_rpm = (uint16_t)((data)[2] << 8 | (data)[3]); \
(ptr)->given_current = (uint16_t)((data)[4] << 8 | (data)[5]); \
(ptr)->temperate = (data)[6]; \
}
extern uint8_t CToC_SlaveSendRefereeSystemData(void);
extern void can_filter_init(void);
extern void CToC_CANDataProcess(uint32_t ID,uint8_t *Data);
extern void Update_Motor_Measure(uint8_t motor_id, motor_measure_t* measure);
extern void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan);
#endif