| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- /* USER CODE BEGIN Header */
- /**
- ******************************************************************************
- * @file can.h
- * @brief This file contains all the function prototypes for
- * the can.c file
- ******************************************************************************
- * @attention
- *
- * Copyright (c) 2025 STMicroelectronics.
- * All rights reserved.
- *
- * This software is licensed under terms that can be found in the LICENSE file
- * in the root directory of this software component.
- * If no LICENSE file comes with this software, it is provided AS-IS.
- *
- ******************************************************************************
- */
- /* USER CODE END Header */
- /* Define to prevent recursive inclusion -------------------------------------*/
- #ifndef __CAN_H__
- #define __CAN_H__
- #ifdef __cplusplus
- extern "C" {
- #endif
- /* Includes ------------------------------------------------------------------*/
- #include "main.h"
- /* USER CODE BEGIN Includes */
- /* USER CODE END Includes */
- extern CAN_HandleTypeDef hcan1;
- extern CAN_HandleTypeDef hcan2;
- /* USER CODE BEGIN Private defines */
- enum CANBAUD
- {
- CAN250kBaud = 1, /* 250 kBit/sec */
- CAN500kBaud = 2, /* 500 kBit/sec */
- CAN1MBaud = 3,/* 1 MBit/sec */
- };
- //¶¨ÒåCAN ±ê־λ
- #define CAN_EFF_FLAG 0x80000000 //À©Õ¹Ö¡±ê־λ
- #define CAN_SFF_MASK 0x000007FF // ÑÚÂë
- #define CAN_EFF_MASK 0x1FFFFFFF
- typedef struct
- {
- CAN_RxHeaderTypeDef RXHeader;
- uint8_t DATA[8];
- }CAN_RXBuffer;
- typedef struct
- {
- CAN_TxHeaderTypeDef TXHeader;
- uint8_t DATA[8];
- }CAN_TXBuffer;
- /* USER CODE END Private defines */
- void MX_CAN1_Init(void);
- void MX_CAN2_Init(void);
- /* USER CODE BEGIN Prototypes */
- void CAN_ConfigFilter(void);
- void MX_CAN_Init(uint8_t can1_baud,uint8_t can2_baud);
- uint8_t can_send_msg(CAN_HandleTypeDef *hcan,uint8_t IDE,uint32_t id, uint8_t *msg, uint8_t len );
- /* USER CODE END Prototypes */
- #ifdef __cplusplus
- }
- #endif
- #endif /* __CAN_H__ */
|