-
Notifications
You must be signed in to change notification settings - Fork 38
/
hal_ll_can_pin_map.h
157 lines (145 loc) · 5.77 KB
/
hal_ll_can_pin_map.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/****************************************************************************
**
** Copyright (C) ${COPYRIGHT_YEAR} MikroElektronika d.o.o.
** Contact: https://www.mikroe.com/contact
**
** This file is part of the mikroSDK package
**
** Commercial License Usage
**
** Licensees holding valid commercial NECTO compilers AI licenses may use this
** file in accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The MikroElektronika Company.
** For licensing terms and conditions see
** https://www.mikroe.com/legal/software-license-agreement.
** For further information use the contact form at
** https://www.mikroe.com/contact.
**
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used for
** non-commercial projects under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** The above copyright notice and this permission notice shall be
** included in all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** OF MERCHANTABILITY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
** TO THE WARRANTIES FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
** OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**
****************************************************************************/
/*!
* @file hal_ll_can_pin_map.h
* @brief CAN HAL LOW LEVEL PIN MAPS.
*/
#ifndef _HAL_LL_CAN_PIN_MAP_H_
#define _HAL_LL_CAN_PIN_MAP_H_
#ifdef __cplusplus
extern "C"{
#endif
#include "hal_ll_pin_names.h"
/*!< @brief Helper macro for getting adequate module index number */
#define hal_ll_can_module_num(_module_num) (_module_num - 1)
/*!< @brief Macro defining `weak` attribute */
#define __weak __attribute__((weak))
/*!< @brief Pin structure */
typedef struct
{
uint8_t module_index;
hal_ll_pin_name_t pin;
hal_ll_base_addr_t base;
uint32_t af;
} hal_ll_can_pin_map_t;
/*!< @brief CAN RX pins */
static const hal_ll_can_pin_map_t hal_ll_can_rx_map[] =
{
//------------ BEGIN RX
#ifdef CAN0_RX_PA13_AF2
{hal_ll_can_module_num(CAN_MODULE_0), PA13, HAL_LL_CAN0_BASE_ADDRESS, HAL_LL_CAN0_GPIO_AF2},
#endif
#ifdef CAN0_RX_PB19_AF2
{hal_ll_can_module_num(CAN_MODULE_0), PB19, HAL_LL_CAN0_BASE_ADDRESS, HAL_LL_CAN0_GPIO_AF2},
#endif
#ifdef CAN1_RX_PE25_AF2
{hal_ll_can_module_num(CAN_MODULE_1), PE25, HAL_LL_CAN1_BASE_ADDRESS, HAL_LL_CAN1_GPIO_AF2},
#endif
#ifdef CAN1_RX_PC16_AF2
{hal_ll_can_module_num(CAN_MODULE_1), PC16, HAL_LL_CAN1_BASE_ADDRESS, HAL_LL_CAN1_GPIO_AF2},
#endif
#ifdef CAN0_RX_PA31_AF2
{hal_ll_can_module_num(CAN_MODULE_0), PA31, HAL_LL_CAN0_BASE_ADDRESS, HAL_LL_CAN0_GPIO_AF2},
#endif
#ifdef CAN1_RX_PB15_AF2
{hal_ll_can_module_num(CAN_MODULE_1), PB15, HAL_LL_CAN1_BASE_ADDRESS, HAL_LL_CAN1_GPIO_AF2},
#endif
#ifdef CAN0_RX_PB17_AF5
{hal_ll_can_module_num(CAN_MODULE_0), PB17, HAL_LL_CAN0_BASE_ADDRESS, HAL_LL_CAN0_GPIO_AF5},
#endif
#ifdef CAN2_RX_PA15_AF4
{hal_ll_can_module_num(CAN_MODULE_2), PA15, HAL_LL_CAN2_BASE_ADDRESS, HAL_LL_CAN2_GPIO_AF4},
#endif
#ifdef CAN2_RX_PC13_AF2
{hal_ll_can_module_num(CAN_MODULE_2), PC13, HAL_LL_CAN2_BASE_ADDRESS, HAL_LL_CAN2_GPIO_AF2},
#endif
#ifdef CAN2_RX_PE28_AF2
{hal_ll_can_module_num(CAN_MODULE_2), PE28, HAL_LL_CAN2_BASE_ADDRESS, HAL_LL_CAN2_GPIO_AF2},
#endif
#ifdef CAN2_RX_PB7_AF2
{hal_ll_can_module_num(CAN_MODULE_2), PB7, HAL_LL_CAN2_BASE_ADDRESS, HAL_LL_CAN2_GPIO_AF2},
#endif
{HAL_LL_MODULE_ERROR, HAL_LL_PIN_NC, HAL_LL_MODULE_ERROR, HAL_LL_PIN_NC}
//------------ END RX
};
/*!< @brief CAN TX pins */
static const hal_ll_can_pin_map_t hal_ll_can_tx_map[] =
{
//------------ BEGIN TX
#ifdef CAN0_TX_PA12_AF2
{hal_ll_can_module_num(CAN_MODULE_0), PA12, HAL_LL_CAN0_BASE_ADDRESS, HAL_LL_CAN0_GPIO_AF2},
#endif
#ifdef CAN0_TX_PB18_AF2
{hal_ll_can_module_num(CAN_MODULE_0), PB18, HAL_LL_CAN0_BASE_ADDRESS, HAL_LL_CAN0_GPIO_AF2},
#endif
#ifdef CAN1_TX_PE24_AF2
{hal_ll_can_module_num(CAN_MODULE_1), PE24, HAL_LL_CAN1_BASE_ADDRESS, HAL_LL_CAN1_GPIO_AF2},
#endif
#ifdef CAN1_TX_PC17_AF2
{hal_ll_can_module_num(CAN_MODULE_1), PC17, HAL_LL_CAN1_BASE_ADDRESS, HAL_LL_CAN1_GPIO_AF2},
#endif
#ifdef CAN0_TX_PA30_AF2
{hal_ll_can_module_num(CAN_MODULE_0), PA30, HAL_LL_CAN0_BASE_ADDRESS, HAL_LL_CAN0_GPIO_AF2},
#endif
#ifdef CAN1_TX_PB14_AF2
{hal_ll_can_module_num(CAN_MODULE_1), PB14, HAL_LL_CAN1_BASE_ADDRESS, HAL_LL_CAN1_GPIO_AF2},
#endif
#ifdef CAN0_TX_PB16_AF5
{hal_ll_can_module_num(CAN_MODULE_0), PB16, HAL_LL_CAN0_BASE_ADDRESS, HAL_LL_CAN0_GPIO_AF5},
#endif
#ifdef CAN2_TX_PA14_AF4
{hal_ll_can_module_num(CAN_MODULE_2), PA14, HAL_LL_CAN2_BASE_ADDRESS, HAL_LL_CAN2_GPIO_AF4},
#endif
#ifdef CAN2_TX_PC12_AF2
{hal_ll_can_module_num(CAN_MODULE_2), PC12, HAL_LL_CAN2_BASE_ADDRESS, HAL_LL_CAN2_GPIO_AF2},
#endif
#ifdef CAN2_TX_PE27_AF2
{hal_ll_can_module_num(CAN_MODULE_2), PE27, HAL_LL_CAN2_BASE_ADDRESS, HAL_LL_CAN2_GPIO_AF2},
#endif
#ifdef CAN2_TX_PB6_AF2
{hal_ll_can_module_num(CAN_MODULE_2), PB6, HAL_LL_CAN2_BASE_ADDRESS, HAL_LL_CAN2_GPIO_AF2},
#endif
{HAL_LL_MODULE_ERROR, HAL_LL_PIN_NC, HAL_LL_MODULE_ERROR, HAL_LL_PIN_NC}
//------------ END TX
};
#ifdef __cplusplus
}
#endif
#endif // _HAL_LL_CAN_PIN_MAP_H_
// ------------------------------------------------------------------------- END