| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #ifndef _USER_CAN_H__
- #define _USER_CAN_H__
- #include <stdint.h>
- #include <stdbool.h>
- #include "define.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define USER_CAN_INTERVAL 10
- #define CAN_SDO_RX 0x600
- #define CAN_SDO_TX 0x580
- #define USER_CAN_GPIO_RCC_ENABLE RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO | RCC_APB2Periph_GPIOA, ENABLE)
- #define USER_CAN_RCC_ENABLE RCC_APB1PeriphClockCmd(RCC_APB1Periph_CAN1, ENABLE);
- #define CAN_TX_GPIO GPIOA
- #define CAN_TX_PIN GPIO_Pin_12
- #define CAN_RX_GPIO GPIOA
- #define CAN_RX_PIN GPIO_Pin_11
- #define CAN_TYPE CAN1
- typedef enum
- {
- DIPSW_QUEUE_TIME = 0,
- CAN_QUEUE_SEND = 1,
- CAN_QUEUE_RECIEVE = 2,
- CAN_QUEUE_TIME = 3,
- }USER_CAN_QUEUE_TYPE;
- typedef struct{
- uint8_t sendData[8];
- uint8_t sendSize;
- CanRxMsg RxMessage;
- }user_can_work_s;
- typedef void (*vUser_can_recv_data_func)(uint8_t *data, uint8_t size);
- void vUser_can_init(void);
- void vUser_can_send_data(uint8_t *data, uint8_t size);
- void vUser_can_set_recv_data_func(vUser_can_recv_data_func func);
- void vUser_can_recv_data(CanRxMsg *RxMessage);
- void vUser_can_set_addr(uint8_t addr);
- extern tmosTaskID user_can_task_id;
- #ifdef __cplusplus
- }
- #endif
- #endif // ACTION_MOTOR_H__
- /** @} */
|