12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #ifndef __CAN_H
- #define __CAN_H
- #include "stm32f4xx.h"
- #define CAN_Send_Flash_ID 0x1f4e5201
- #define CAN_Send_Speed_ID 0x1f4e5301
- #define CAN_RecDataMax 12
- #define TRACK_P 1
- #define TRACK_I 2
- #define TRACK_D 3
- #define BRUSH_P 4
- #define BRUSH_I 5
- #define BRUSH_D 6
- #define LOWSPEED 7
- #define HIGHSPEED 8
- #define DIVIDI_RPM 9
- #define MAXCURRENT 10
- #define MAXTIME 11
- #define REST_STM32 12
- #define LEFT_TRACK 13
- #define RIGHT_TRACK 14
- #define PIXHAWK_REQURE 0xFF
- #define SET_PARME 0xF0
- #define RESPOND 0xF1
- extern u8 CAN_DATA_CNT;
- extern u32 Init_Flash_Data;
- extern u8 CAN_RecData[CAN_RecDataMax];
- extern u8 CAN_RecData_i;
- extern u8 CAN_RecData_Toggle;
- extern u8 CAN_RecData_TID;
- void CAN_Config(void);
- void Send_Flash_Set(u8 num, u8 flag, float value);
- float Rec_Flash_Set(u8 data[]);
- void Send_CAN_DATA1(void);
- void Send_CAN_DATA2(void);
- void Send_CAN_DATA3(void);
- void Send_CAN_DATA4(void);
- void Send_CAN_DATA5(void);
- void Send_CAN_DATA6(void);
- //CAN1接收RX0中断使能
- #define CAN1_RX0_INT_ENABLE 1 //0,不使能;1,使能.
- u8 CAN1_Send_Msg(u8* msg,u32 Can_ID,u8 len); //发送数据
- u8 CAN1_Receive_Msg(u8 *buf, u32 *id);
- void CAN_NVIC_Config(u8 NVIC_IRQChannel, u8 pre, u8 sub);
- void CAN_GPIO_Config(u32 RCC_APBnPeriphn, GPIO_TypeDef* GPIOx, u16 GPIO_Pin, u16 GPIO_PinSource, u8 GPIO_AF);
- void CAN_Mod_Config(u32 RCC_APB1Periph, CAN_TypeDef* CANx, u32 EXTID, u32 MaskID);
- void Send_Flash_Set(u8 num, u8 flag, float value);
- void Send_CAN_MOTOR1DATA(void);
- void Send_CAN_MOTOR2DATA(void);
- void Send_CAN_MOTOR3DATA(void);
- #endif
|