Statistics
| Branch: | Tag: | Revision:

amiro-os / modules / PowerManagement_1-1 / board.h @ 96621a83

History | View | Annotate | Download (110.047 KB)

1
/*
2
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2020  Thomas Schöpping et al.
4

5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU General Public License for more details.
14

15
You should have received a copy of the GNU General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18

    
19
/**
20
 * @file
21
 * @brief   PowerManagement v1.1 Board specific macros.
22
 *
23
 * @addtogroup powermanagement_board
24
 * @{
25
 */
26

    
27
#ifndef BOARD_H
28
#define BOARD_H
29

    
30
/*===========================================================================*/
31
/* Driver constants.                                                         */
32
/*===========================================================================*/
33

    
34
/*
35
 * Setup for AMiRo PowerManagement v1.1 board.
36
 */
37

    
38
/*
39
 * Board identifier.
40
 */
41
#define BOARD_POWERMANAGEMENT_1_1
42
#define BOARD_NAME                      "AMiRo PowerManagement v1.1"
43

    
44
/*
45
 * Board oscillators-related settings.
46
 * NOTE: LSE not fitted.
47
 */
48
#if !defined(STM32_LSECLK)
49
#define STM32_LSECLK                    0U
50
#endif
51

    
52
#if !defined(STM32_HSECLK)
53
#define STM32_HSECLK                    8000000U
54
#endif
55

    
56
/*
57
 * Board voltages.
58
 * Required for performance limits calculation.
59
 */
60
#define STM32_VDD                       330U
61

    
62
/*
63
 * MCU type as defined in the ST header.
64
 */
65
#define STM32F405xx
66

    
67
/*
68
 * STM32F4 alternate function definitions
69
 */
70
#define STM32F4xx_AF_system             0U
71
#define STM32F4xx_AF_TIM1to2            1U
72
#define STM32F4xx_AF_TIM3to5            2U
73
#define STM32F4xx_AF_TIM8to11           3U
74
#define STM32F4xx_AF_I2C1to3            4U
75
#define STM32F4xx_AF_SPI1to2            5U
76
#define STM32F4xx_AF_SPI3               6U
77
#define STM32F4xx_AF_USART1to3          7U
78
#define STM32F4xx_AF_USART4to6          8U
79
#define STM32F4xx_AF_CAN1to2_TIM12to14  9U
80
#define STM32F4xx_AF_OTG_HSFS           10U
81
#define STM32F4xx_AF_ETH                11U
82
#define STM32F4xx_AF_FSMC_SDIO_OTGHS    12U
83
#define STM32F4xx_AF_DCMI               13U
84
#define STM32F4xx_AF_EVENTOUT           15U
85

    
86
/*
87
 * Identifiers for the several sensor rings, which can be attached to the PowerManagement v1.1 module.
88
 */
89
#define BOARD_NOSENSORRING              -1
90
#define BOARD_PROXIMITYSENSOR           1
91
#define BOARD_DISTANCESENSOR_VL53L0X    2
92
#define BOARD_DISTANCESENSOR_VL53L1X    3
93

    
94
/*
95
 * Configuration macro to define which type of sensor ring is attached.
96
 */
97
#if !defined(BOARD_SENSORRING) || defined(__DOXYGEN__)
98
  #define BOARD_SENSORRING              BOARD_PROXIMITYSENSOR
99
#elif ((BOARD_SENSORRING != BOARD_NOSENSORRING) && \
100
       (BOARD_SENSORRING != BOARD_PROXIMITYSENSOR) && \
101
       (BOARD_SENSORRING != BOARD_DISTANCESENSOR_VL53L0X) && \
102
       (BOARD_SENSORRING != BOARD_DISTANCESENSOR_VL53L1X))
103
  #error "BOARD_SENSORRING set to invalid value"
104
#endif
105

    
106
/*
107
 * IO pins assignments.
108
 */
109
#define GPIOA_WKUP                      0U
110
#define GPIOA_PIN1                      1U
111
#define GPIOA_SYS_UART_TX               2U
112
#define GPIOA_SYS_UART_RX               3U
113
#define GPIOA_SYS_SPI_SS0_N             4U
114
#define GPIOA_SYS_SPI_SCLK              5U
115
#define GPIOA_SYS_SPI_MISO              6U
116
#define GPIOA_SYS_SPI_MOSI              7U
117
#define GPIOA_SYS_REG_EN                8U
118
#define GPIOA_PROG_RX                   9U
119
#define GPIOA_PROG_TX                   10U
120
#define GPIOA_CAN_RX                    11U
121
#define GPIOA_CAN_TX                    12U
122
#define GPIOA_SWDIO                     13U
123
#define GPIOA_SWCLK                     14U
124
#define GPIOA_SYS_SPI_SS1_N             15U
125

    
126
#define GPIOB_IR_INT1_N                 0U
127
#define GPIOB_VSYS_SENSE                1U
128
#define GPIOB_POWER_EN                  2U
129
#define GPIOB_SYS_UART_DN               3U
130
#define GPIOB_CHARGE_STAT2A             4U
131
#define GPIOB_BUZZER                    5U
132
#define GPIOB_GAUGE_BATLOW2             6U
133
#define GPIOB_GAUGE_BATGD2_N            7U
134
#define GPIOB_GAUGE_SCL2                8U
135
#define GPIOB_GAUGE_SDA2                9U
136
#define GPIOB_GAUGE_SCL1                10U
137
#define GPIOB_GAUGE_SDA1                11U
138
#define GPIOB_LED                       12U
139
#define GPIOB_BT_RTS                    13U
140
#define GPIOB_BT_CTS                    14U
141
#define GPIOB_SYS_UART_UP               15U
142

    
143
#define GPIOC_CHARGE_STAT1A             0U
144
#define GPIOC_GAUGE_BATLOW1             1U
145
#define GPIOC_GAUGE_BATGD1_N            2U
146
#define GPIOC_CHARGE_EN1_N              3U
147
#define GPIOC_IR_INT2_N                 4U
148
#define GPIOC_TOUCH_INT_N               5U
149
#define GPIOC_SYS_DONE                  6U
150
#define GPIOC_SYS_PROG_N                7U
151
#define GPIOC_PATH_DC                   8U
152
#define GPIOC_SYS_SPI_DIR               9U
153
#define GPIOC_BT_RX                     10U
154
#define GPIOC_BT_TX                     11U
155
#define GPIOC_SYS_INT_N                 12U
156
#define GPIOC_SYS_PD_N                  13U
157
#define GPIOC_SYS_WARMRST_N             14U
158
#define GPIOC_BT_RST                    15U
159

    
160
#define GPIOD_PIN0                      0U
161
#define GPIOD_PIN1                      1U
162
#define GPIOD_CHARGE_EN2_N              2U
163
#define GPIOD_PIN3                      3U
164
#define GPIOD_PIN4                      4U
165
#define GPIOD_PIN5                      5U
166
#define GPIOD_PIN6                      6U
167
#define GPIOD_PIN7                      7U
168
#define GPIOD_PIN8                      8U
169
#define GPIOD_PIN9                      9U
170
#define GPIOD_PIN10                     10U
171
#define GPIOD_PIN11                     11U
172
#define GPIOD_PIN12                     12U
173
#define GPIOD_PIN13                     13U
174
#define GPIOD_PIN14                     14U
175
#define GPIOD_PIN15                     15U
176

    
177
#define GPIOE_PIN0                      0U
178
#define GPIOE_PIN1                      1U
179
#define GPIOE_PIN2                      2U
180
#define GPIOE_PIN3                      3U
181
#define GPIOE_PIN4                      4U
182
#define GPIOE_PIN5                      5U
183
#define GPIOE_PIN6                      6U
184
#define GPIOE_PIN7                      7U
185
#define GPIOE_PIN8                      8U
186
#define GPIOE_PIN9                      9U
187
#define GPIOE_PIN10                     10U
188
#define GPIOE_PIN11                     11U
189
#define GPIOE_PIN12                     12U
190
#define GPIOE_PIN13                     13U
191
#define GPIOE_PIN14                     14U
192
#define GPIOE_PIN15                     15U
193

    
194
#define GPIOF_PIN0                      0U
195
#define GPIOF_PIN1                      1U
196
#define GPIOF_PIN2                      2U
197
#define GPIOF_PIN3                      3U
198
#define GPIOF_PIN4                      4U
199
#define GPIOF_PIN5                      5U
200
#define GPIOF_PIN6                      6U
201
#define GPIOF_PIN7                      7U
202
#define GPIOF_PIN8                      8U
203
#define GPIOF_PIN9                      9U
204
#define GPIOF_PIN10                     10U
205
#define GPIOF_PIN11                     11U
206
#define GPIOF_PIN12                     12U
207
#define GPIOF_PIN13                     13U
208
#define GPIOF_PIN14                     14U
209
#define GPIOF_PIN15                     15U
210

    
211
#define GPIOG_PIN0                      0U
212
#define GPIOG_PIN1                      1U
213
#define GPIOG_PIN2                      2U
214
#define GPIOG_PIN3                      3U
215
#define GPIOG_PIN4                      4U
216
#define GPIOG_PIN5                      5U
217
#define GPIOG_PIN6                      6U
218
#define GPIOG_PIN7                      7U
219
#define GPIOG_PIN8                      8U
220
#define GPIOG_PIN9                      9U
221
#define GPIOG_PIN10                     10U
222
#define GPIOG_PIN11                     11U
223
#define GPIOG_PIN12                     12U
224
#define GPIOG_PIN13                     13U
225
#define GPIOG_PIN14                     14U
226
#define GPIOG_PIN15                     15U
227

    
228
#define GPIOH_OSC_IN                    0U
229
#define GPIOH_OSC_OUT                   1U
230
#define GPIOH_PIN2                      2U
231
#define GPIOH_PIN3                      3U
232
#define GPIOH_PIN4                      4U
233
#define GPIOH_PIN5                      5U
234
#define GPIOH_PIN6                      6U
235
#define GPIOH_PIN7                      7U
236
#define GPIOH_PIN8                      8U
237
#define GPIOH_PIN9                      9U
238
#define GPIOH_PIN10                     10U
239
#define GPIOH_PIN11                     11U
240
#define GPIOH_PIN12                     12U
241
#define GPIOH_PIN13                     13U
242
#define GPIOH_PIN14                     14U
243
#define GPIOH_PIN15                     15U
244

    
245
#define GPIOI_PIN0                      0U
246
#define GPIOI_PIN1                      1U
247
#define GPIOI_PIN2                      2U
248
#define GPIOI_PIN3                      3U
249
#define GPIOI_PIN4                      4U
250
#define GPIOI_PIN5                      5U
251
#define GPIOI_PIN6                      6U
252
#define GPIOI_PIN7                      7U
253
#define GPIOI_PIN8                      8U
254
#define GPIOI_PIN9                      9U
255
#define GPIOI_PIN10                     10U
256
#define GPIOI_PIN11                     11U
257
#define GPIOI_PIN12                     12U
258
#define GPIOI_PIN13                     13U
259
#define GPIOI_PIN14                     14U
260
#define GPIOI_PIN15                     15U
261

    
262
/*
263
 * IO lines assignments.
264
 */
265
#define LINE_WKUP                       PAL_LINE(GPIOA, GPIOA_WKUP)
266
#define LINE_SYS_UART_TX                PAL_LINE(GPIOA, GPIOA_SYS_UART_TX)
267
#define LINE_SYS_UART_RX                PAL_LINE(GPIOA, GPIOA_SYS_UART_RX)
268
#define LINE_SYS_SPI_SS0_N              PAL_LINE(GPIOA, GPIOA_SYS_SPI_SS0_N)
269
#define LINE_SYS_SPI_SCLK               PAL_LINE(GPIOA, GPIOA_SYS_SPI_SCLK)
270
#define LINE_SYS_SPI_MISO               PAL_LINE(GPIOA, GPIOA_SYS_SPI_MISO)
271
#define LINE_SYS_SPI_MOSI               PAL_LINE(GPIOA, GPIOA_SYS_SPI_MOSI)
272
#define LINE_SYS_REG_EN                 PAL_LINE(GPIOA, GPIOA_SYS_REG_EN)
273
#define LINE_PROG_RX                    PAL_LINE(GPIOA, GPIOA_PROG_RX)
274
#define LINE_PROG_TX                    PAL_LINE(GPIOA, GPIOA_PROG_TX)
275
#define LINE_CAN_RX                     PAL_LINE(GPIOA, GPIOA_CAN_RX)
276
#define LINE_CAN_TX                     PAL_LINE(GPIOA, GPIOA_CAN_TX)
277
#define LINE_SWDIO                      PAL_LINE(GPIOA, GPIOA_SWDIO)
278
#define LINE_SWCLK                      PAL_LINE(GPIOA, GPIOA_SWCLK)
279
#define LINE_SYS_SPI_SS1_N              PAL_LINE(GPIOA, GPIOA_SYS_SPI_SS1_N)
280

    
281
#define LINE_IR_INT1_N                  PAL_LINE(GPIOB, GPIOB_IR_INT1_N)
282
#define LINE_VSYS_SENSE                 PAL_LINE(GPIOB, GPIOB_VSYS_SENSE)
283
#define LINE_POWER_EN                   PAL_LINE(GPIOB, GPIOB_POWER_EN)
284
#define LINE_SYS_UART_DN                PAL_LINE(GPIOB, GPIOB_SYS_UART_DN)
285
#define LINE_CHARGE_STAT2A              PAL_LINE(GPIOB, GPIOB_CHARGE_STAT2A)
286
#define LINE_BUZZER                     PAL_LINE(GPIOB, GPIOB_BUZZER)
287
#define LINE_GAUGE_BATLOW2              PAL_LINE(GPIOB, GPIOB_GAUGE_BATLOW2)
288
#define LINE_GAUGE_BATGD2_N             PAL_LINE(GPIOB, GPIOB_GAUGE_BATGD2_N)
289
#define LINE_GAUGE_SCL2                 PAL_LINE(GPIOB, GPIOB_GAUGE_SCL2)
290
#define LINE_GAUGE_SDA2                 PAL_LINE(GPIOB, GPIOB_GAUGE_SDA2)
291
#define LINE_GAUGE_SCL1                 PAL_LINE(GPIOB, GPIOB_GAUGE_SCL1)
292
#define LINE_GAUGE_SDA1                 PAL_LINE(GPIOB, GPIOB_GAUGE_SDA1)
293
#define LINE_LED                        PAL_LINE(GPIOB, GPIOB_LED)
294
#define LINE_BT_RTS                     PAL_LINE(GPIOB, GPIOB_BT_RTS)
295
#define LINE_BT_CTS                     PAL_LINE(GPIOB, GPIOB_BT_CTS)
296
#define LINE_SYS_UART_UP                PAL_LINE(GPIOB, GPIOB_SYS_UART_UP)
297

    
298
#define LINE_CHARGE_STAT1A              PAL_LINE(GPIOC, GPIOC_CHARGE_STAT1A)
299
#define LINE_GAUGE_BATLOW1              PAL_LINE(GPIOC, GPIOC_GAUGE_BATLOW1)
300
#define LINE_GAUGE_BATGD1_N             PAL_LINE(GPIOC, GPIOC_GAUGE_BATGD1_N)
301
#define LINE_CHARGE_EN1_N               PAL_LINE(GPIOC, GPIOC_CHARGE_EN1_N)
302
#define LINE_IR_INT2_N                  PAL_LINE(GPIOC, GPIOC_IR_INT2_N)
303
#define LINE_TOUCH_INT_N                PAL_LINE(GPIOC, GPIOC_TOUCH_INT_N)
304
#define LINE_SYS_DONE                   PAL_LINE(GPIOC, GPIOC_SYS_DONE)
305
#define LINE_SYS_PROG_N                 PAL_LINE(GPIOC, GPIOC_SYS_PROG_N)
306
#define LINE_PATH_DC                    PAL_LINE(GPIOC, GPIOC_PATH_DC)
307
#define LINE_SYS_SPI_DIR                PAL_LINE(GPIOC, GPIOC_SYS_SPI_DIR)
308
#define LINE_BT_RX                      PAL_LINE(GPIOC, GPIOC_BT_RX)
309
#define LINE_BT_TX                      PAL_LINE(GPIOC, GPIOC_BT_TX)
310
#define LINE_SYS_INT_N                  PAL_LINE(GPIOC, GPIOC_SYS_INT_N)
311
#define LINE_SYS_PD_N                   PAL_LINE(GPIOC, GPIOC_SYS_PD_N)
312
#define LINE_SYS_WARMRST_N              PAL_LINE(GPIOC, GPIOC_SYS_WARMRST_N)
313
#define LINE_BT_RST                     PAL_LINE(GPIOC, GPIOC_BT_RST)
314

    
315
#define LINE_CHARGE_EN2_N               PAL_LINE(GPIOD, GPIOD_CHARGE_EN2_N)
316

    
317
#define LINE_OSC_IN                     PAL_LINE(GPIOH, 0U)
318
#define LINE_OSC_OUT                    PAL_LINE(GPIOH, 1U)
319

    
320
/*===========================================================================*/
321
/* Driver pre-compile time settings.                                         */
322