/** ****************************************************************************** * File Name : CAN.h * Description : This file provides code for the configuration * of the CAN instances. ****************************************************************************** ** This notice applies to any and all portions of this file * that are not between comment pairs USER CODE BEGIN and * USER CODE END. Other portions of this file, whether * inserted by the user or by software development tools * are owned by their respective copyright owners. * * COPYRIGHT(c) 2019 STMicroelectronics * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __can_H #define __can_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "stm32f1xx_hal.h" #include "main.h" #include "var.h" /* USER CODE BEGIN Includes */ /* USER CODE END Includes */ extern CAN_HandleTypeDef hcan; /* USER CODE BEGIN Private defines */ #define ID_MC_BC 0x710 #define ID_MC_TO_BMS 0x712 #define ID_MC_TO_PBU 0x713 #define ID_MC_TO_HMI 0x714 #define ID_MC_TO_CDL 0x715 #define ID_BMS_BC 0x720 #define ID_BMS_TO_MC 0x721 #define ID_BMS_TO_PBU 0x723 #define ID_BMS_TO_HMI 0x724 #define ID_BMS_TO_CDL 0x725 #define ID_PBU_BC 0x730 #define ID_PBU_TO_MC 0x731 #define ID_PBU_TO_BMS 0x732 #define ID_PBU_TO_HMI 0x734 #define ID_PBU_TO_CDL 0x735 #define ID_HMI_BC 0x740 #define ID_HMI_TO_MC 0x741 #define ID_HMI_TO_BMS 0x742 #define ID_HMI_TO_PBU 0x743 #define ID_HMI_TO_CDL 0x745 #define ID_CDL_BC 0x750 #define ID_CDL_TO_MC 0x751 #define ID_CDL_TO_BMS 0x752 #define ID_CDL_TO_PBU 0x753 #define ID_CDL_TO_HMI 0x754 #define ID_CDL_TO_PBU_TE 0x653 typedef struct { uint16_t ucBufID; uint8_t ucBufSize; //缓冲区数组:缓冲区大小 uint8_t ucBufWrInde; //缓冲区数组:写指针 uint8_t ucBufRdInde; //缓冲区数组:读指针 uint8_t ucBufCnt; //缓冲区数组:数据计数 uint8_t ucBufOvf; //缓冲区数组:溢出标志,注意清零 uint8_t * pcBufAddr; //缓冲区数组:首地址指针变量 uint32_t DelayTimeCnt; //超时计时 TrueOrFalse_Flag_Struct_t IsWaitRX_Flag; //超时等待数据标志 }CAN_Buf_TypeDef; /* USER CODE END Private defines */ extern void _Error_Handler(char *, int); void MX_CAN_Init(void); /* USER CODE BEGIN Prototypes */ extern uint8_t CAN_RxBuf_MC[255]; extern CAN_Buf_TypeDef CAN_RxBuf_Struct_MC; extern uint8_t CAN_RxBuf_BMS[255]; extern CAN_Buf_TypeDef CAN_RxBuf_Struct_BMS; extern uint8_t CAN_RxBuf_HMI[255]; extern CAN_Buf_TypeDef CAN_RxBuf_Struct_HMI; extern uint8_t CAN_RxBuf_CDL[255]; extern CAN_Buf_TypeDef CAN_RxBuf_Struct_CDL; extern void CAN_SendData(uint16_t ID, uint8_t *Data, uint16_t Length); extern void CANFilterConfig_Scale32_IdMask_StandardIdOnly(void); /* USER CODE END Prototypes */ #ifdef __cplusplus } #endif #endif /*__ can_H */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/