1 /**
2   ******************************************************************************
3   * @file    stm32f1xx_hal_can_ex_legacy.h
4   * @author  MCD Application Team
5   * @brief   Header file of CAN HAL Extension module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2016 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software is licensed under terms that can be found in the LICENSE file
13   * in the root directory of this software component.
14   * If no LICENSE file comes with this software, it is provided AS-IS.
15   *
16   ******************************************************************************
17   */
18 
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef __STM32F1xx_HAL_CAN_EX_LEGACY_H
21 #define __STM32F1xx_HAL_CAN_EX_LEGACY_H
22 
23 #ifdef __cplusplus
24  extern "C" {
25 #endif
26 
27 #if defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE) || \
28     defined(STM32F103xG) || defined(STM32F105xC) || defined(STM32F107xC)
29 
30 /* Includes ------------------------------------------------------------------*/
31 #include "stm32f1xx_hal_def.h"
32 
33 /** @addtogroup STM32F1xx_HAL_Driver
34   * @{
35   */
36 
37 /** @defgroup CANEx CANEx
38   * @{
39   */
40 
41 /* Exported types ------------------------------------------------------------*/
42 
43 /**
44   * @brief  CAN filter configuration structure definition
45   */
46 /* CAN filter banks differences over STM32F1 devices:                         */
47 /* - STM32F1 Connectivity line: 28 filter banks shared between CAN1 and CAN2  */
48 /* - Other STM32F10x devices:   14 filter banks                               */
49 
50 typedef struct
51 {
52   uint32_t FilterIdHigh;          /*!< Specifies the filter identification number (MSBs for a 32-bit
53                                        configuration, first one for a 16-bit configuration).
54                                        This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */
55 
56   uint32_t FilterIdLow;           /*!< Specifies the filter identification number (LSBs for a 32-bit
57                                        configuration, second one for a 16-bit configuration).
58                                        This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */
59 
60   uint32_t FilterMaskIdHigh;      /*!< Specifies the filter mask number or identification number,
61                                        according to the mode (MSBs for a 32-bit configuration,
62                                        first one for a 16-bit configuration).
63                                        This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */
64 
65   uint32_t FilterMaskIdLow;       /*!< Specifies the filter mask number or identification number,
66                                        according to the mode (LSBs for a 32-bit configuration,
67                                        second one for a 16-bit configuration).
68                                        This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */
69 
70   uint32_t FilterFIFOAssignment;  /*!< Specifies the FIFO (0 or 1) which will be assigned to the filter.
71                                        This parameter can be a value of @ref CAN_filter_FIFO */
72 #if defined(STM32F105xC) || defined(STM32F107xC)
73   uint32_t FilterNumber;          /*!< Specifies the filter which will be initialized.
74                                        This parameter must be a number between Min_Data = 0 and Max_Data = 27. */
75 #else
76   uint32_t FilterNumber;          /*!< Specifies the filter which will be initialized.
77                                        This parameter must be a number between Min_Data = 0 and Max_Data = 13. */
78 #endif /* STM32F105xC || STM32F107xC */
79   uint32_t FilterMode;            /*!< Specifies the filter mode to be initialized.
80                                        This parameter can be a value of @ref CAN_filter_mode */
81 
82   uint32_t FilterScale;           /*!< Specifies the filter scale.
83                                        This parameter can be a value of @ref CAN_filter_scale */
84 
85   uint32_t FilterActivation;      /*!< Enable or disable the filter.
86                                        This parameter can be set to ENABLE or DISABLE. */
87 
88   uint32_t BankNumber;            /*!< Select the start slave bank filter
89                                        This parameter must be a number between Min_Data = 0 and Max_Data = 28. */
90 
91 }CAN_FilterConfTypeDef;
92 
93 /* Exported constants --------------------------------------------------------*/
94 /* Exported macro ------------------------------------------------------------*/
95 /* Private macro -------------------------------------------------------------*/
96 
97 /** @defgroup CANEx_Private_Macros CAN Extended Private Macros
98   * @{
99   */
100 #if defined(STM32F105xC) || defined(STM32F107xC)
101 #define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 27U)
102 #else
103 #define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 13U)
104 #endif /* STM32F105xC || STM32F107xC */
105 
106 /**
107   * @}
108   */
109 
110 
111 /**
112   * @}
113   */
114 
115 /**
116   * @}
117   */
118 
119 #endif /* STM32F103x6) || STM32F103xB || STM32F103xE || STM32F103xG) || STM32F105xC || STM32F107xC    */
120 
121 #ifdef __cplusplus
122 }
123 #endif
124 
125 #endif /* __STM32F1xx_HAL_CAN_EX_LEGACY_H */
126