3 * Copyright (c) 2020 Project CHIP Authors
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 /*******************************************************************************
21 *******************************************************************************
23 * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
24 *******************************************************************************
26 * The licensor of this software is Silicon Laboratories Inc. Your use of this
27 * software is governed by the terms of Silicon Labs Master Software License
28 * Agreement (MSLA) available at
29 * www.silabs.com/about-us/legal/master-software-license-agreement. This
30 * software is distributed to you in Source Code format and is governed by the
31 * sections of the MSLA applicable to Source Code.
33 ******************************************************************************/
37 #include "board_features.h"
38 #include "em_device.h"
39 #include "hal-config-app-common.h"
40 #include "hal-config-types.h"
42 #ifndef HAL_I2CSENSOR_ENABLE
43 #define HAL_I2CSENSOR_ENABLE (0)
46 #ifndef HAL_SPIDISPLAY_ENABLE
47 #define HAL_SPIDISPLAY_ENABLE (1)
49 #define HAL_SPIDISPLAY_EXTCOMIN_CALLBACK
50 #if defined(FEATURE_IOEXPANDER)
51 #define HAL_SPIDISPLAY_EXTMODE_EXTCOMIN (0)
53 #define HAL_SPIDISPLAY_EXTMODE_EXTCOMIN (1)
55 #define HAL_SPIDISPLAY_EXTMODE_SPI (0)
56 #define HAL_SPIDISPLAY_EXTCOMIN_USE_PRS (0)
57 #define HAL_SPIDISPLAY_EXTCOMIN_USE_CALLBACK (0)
58 #define HAL_SPIDISPLAY_FREQUENCY (1000000)
60 #define HAL_CLK_HFCLK_SOURCE (HAL_CLK_HFCLK_SOURCE_HFXO)
61 #define HAL_CLK_LFECLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFXO)
62 #define HAL_CLK_LFBCLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFXO)
63 #define HAL_CLK_LFACLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
64 #define HAL_CLK_HFXO_AUTOSTART (HAL_CLK_HFXO_AUTOSTART_NONE)
66 #define HAL_DCDC_BYPASS (0)
69 #define HAL_PA_ENABLE (1)
72 #define HAL_SERIAL_USART0_ENABLE (0)
73 #define HAL_SERIAL_LEUART0_ENABLE (0)
74 #define HAL_SERIAL_USART1_ENABLE (0)
75 #define HAL_SERIAL_USART2_ENABLE (0)
76 #define HAL_SERIAL_USART3_ENABLE (0)
77 #define HAL_SERIAL_RXWAKE_ENABLE (0)
79 #define HAL_SERIAL_APP_RX_QUEUE_SIZE (128)
80 #define HAL_SERIAL_APP_BAUD_RATE (115200)
81 #define HAL_SERIAL_APP_RXSTOP (16)
82 #define HAL_SERIAL_APP_RXSTART (16)
83 #define HAL_SERIAL_APP_TX_QUEUE_SIZE (128)
84 #define HAL_SERIAL_APP_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_NONE)
87 #define HAL_USART0_ENABLE (1)
88 #define HAL_USART0_RX_QUEUE_SIZE (128)
89 #define HAL_USART0_BAUD_RATE (115200)
90 #define HAL_USART0_RXSTOP (16)
91 #define HAL_USART0_RXSTART (16)
92 #define HAL_USART0_TX_QUEUE_SIZE (128)
93 #define HAL_USART0_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_NONE)
97 #define BSP_BTL_BUTTON_PIN (14U)
98 #define BSP_BTL_BUTTON_PORT (gpioPortD)
103 #define BSP_BUTTON_PRESENT (1)
105 #define BSP_BUTTON0_PIN (14U)
106 #define BSP_BUTTON0_PORT (gpioPortD)
108 #define BSP_BUTTON1_PIN (15U)
109 #define BSP_BUTTON1_PORT (gpioPortD)
111 #define BSP_BUTTON_COUNT (2U)
112 #define BSP_BUTTON_INIT \
114 { BSP_BUTTON0_PORT, BSP_BUTTON0_PIN }, { BSP_BUTTON1_PORT, BSP_BUTTON1_PIN } \
116 #define BSP_BUTTON_GPIO_DOUT (HAL_GPIO_DOUT_LOW)
117 #define BSP_BUTTON_GPIO_MODE (HAL_GPIO_MODE_INPUT)
121 #define BSP_CLK_HFXO_PRESENT (1)
122 #define BSP_CLK_HFXO_FREQ (38400000UL)
123 #define BSP_CLK_HFXO_INIT CMU_HFXOINIT_DEFAULT
124 #define BSP_CLK_HFXO_CTUNE (332)
125 #define BSP_CLK_LFXO_PRESENT (1)
126 #define BSP_CLK_LFXO_INIT CMU_LFXOINIT_DEFAULT
127 #define BSP_CLK_LFXO_FREQ (32768U)
128 #define BSP_CLK_LFXO_CTUNE (32U)
132 #define BSP_DCDC_PRESENT (1)
134 #define BSP_DCDC_INIT EMU_DCDCINIT_DEFAULT
138 #define BSP_EXTFLASH_CS_PIN (1U)
139 #define BSP_EXTFLASH_CS_PORT (gpioPortK)
141 #define BSP_EXTFLASH_INTERNAL (0)
142 #define BSP_EXTFLASH_USART (HAL_SPI_PORT_USART2)
143 #define BSP_EXTFLASH_MOSI_PIN (0U)
144 #define BSP_EXTFLASH_MOSI_PORT (gpioPortK)
145 #define BSP_EXTFLASH_MOSI_LOC (29U)
147 #define BSP_EXTFLASH_MISO_PIN (2U)
148 #define BSP_EXTFLASH_MISO_PORT (gpioPortK)
149 #define BSP_EXTFLASH_MISO_LOC (30U)
151 #define BSP_EXTFLASH_CLK_PIN (7U)
152 #define BSP_EXTFLASH_CLK_PORT (gpioPortF)
153 #define BSP_EXTFLASH_CLK_LOC (18U)
158 #define PORTIO_GPIO_SWV_PIN (2U)
159 #define PORTIO_GPIO_SWV_PORT (gpioPortF)
160 #define PORTIO_GPIO_SWV_LOC (0U)
162 #define BSP_TRACE_SWO_PIN (2U)
163 #define BSP_TRACE_SWO_PORT (gpioPortF)
164 #define BSP_TRACE_SWO_LOC (0U)
169 #define PORTIO_I2C0_SCL_PIN (11U)
170 #define PORTIO_I2C0_SCL_PORT (gpioPortC)
171 #define PORTIO_I2C0_SCL_LOC (15U)
173 #define PORTIO_I2C0_SDA_PIN (10U)
174 #define PORTIO_I2C0_SDA_PORT (gpioPortC)
175 #define PORTIO_I2C0_SDA_LOC (15U)
177 #define BSP_I2C0_SCL_PIN (11U)
178 #define BSP_I2C0_SCL_PORT (gpioPortC)
179 #define BSP_I2C0_SCL_LOC (15U)
181 #define BSP_I2C0_SDA_PIN (10U)
182 #define BSP_I2C0_SDA_PORT (gpioPortC)
183 #define BSP_I2C0_SDA_LOC (15U)
188 #define PORTIO_I2C1_SCL_PIN (5U)
189 #define PORTIO_I2C1_SCL_PORT (gpioPortC)
190 #define PORTIO_I2C1_SCL_LOC (17U)
192 #define PORTIO_I2C1_SDA_PIN (4U)
193 #define PORTIO_I2C1_SDA_PORT (gpioPortC)
194 #define PORTIO_I2C1_SDA_LOC (17U)
196 #define BSP_I2C1_SCL_PIN (5U)
197 #define BSP_I2C1_SCL_PORT (gpioPortC)
198 #define BSP_I2C1_SCL_LOC (17U)
200 #define BSP_I2C1_SDA_PIN (4U)
201 #define BSP_I2C1_SDA_PORT (gpioPortC)
202 #define BSP_I2C1_SDA_LOC (17U)
208 #define BSP_I2CSENSOR_PERIPHERAL (HAL_I2C_PORT_I2C0)
209 #define BSP_I2CSENSOR_SCL_PIN (11U)
210 #define BSP_I2CSENSOR_SCL_PORT (gpioPortC)
211 #define BSP_I2CSENSOR_SCL_LOC (15U)
213 #define BSP_I2CSENSOR_SDA_PIN (10U)
214 #define BSP_I2CSENSOR_SDA_PORT (gpioPortC)
215 #define BSP_I2CSENSOR_SDA_LOC (15U)
220 #define BSP_LED_PRESENT (1)
222 #define BSP_LED0_PIN (8U)
223 #define BSP_LED0_PORT (gpioPortD)
225 #define BSP_LED1_PIN (9U)
226 #define BSP_LED1_PORT (gpioPortD)
228 #define BSP_LED_COUNT (2U)
229 #define BSP_LED_INIT \
231 { BSP_LED0_PORT, BSP_LED0_PIN }, { BSP_LED1_PORT, BSP_LED1_PIN } \
233 #define BSP_LED_POLARITY (1)
238 #define BSP_PA_VOLTAGE (1800U)
242 #define PORTIO_PTI_DCLK_PIN (11U)
243 #define PORTIO_PTI_DCLK_PORT (gpioPortB)
244 #define PORTIO_PTI_DCLK_LOC (6U)
246 #define PORTIO_PTI_DFRAME_PIN (13U)
247 #define PORTIO_PTI_DFRAME_PORT (gpioPortB)
248 #define PORTIO_PTI_DFRAME_LOC (6U)
250 #define PORTIO_PTI_DOUT_PIN (12U)
251 #define PORTIO_PTI_DOUT_PORT (gpioPortB)
252 #define PORTIO_PTI_DOUT_LOC (6U)
254 #define BSP_PTI_DFRAME_PIN (13U)
255 #define BSP_PTI_DFRAME_PORT (gpioPortB)
256 #define BSP_PTI_DFRAME_LOC (6U)
258 #define BSP_PTI_DOUT_PIN (12U)
259 #define BSP_PTI_DOUT_PORT (gpioPortB)
260 #define BSP_PTI_DOUT_LOC (6U)
265 #define BSP_SERIAL_APP_TX_PIN (0U)
266 #define BSP_SERIAL_APP_TX_PORT (gpioPortA)
267 #define BSP_SERIAL_APP_TX_LOC (0U)
269 #define BSP_SERIAL_APP_RX_PIN (1U)
270 #define BSP_SERIAL_APP_RX_PORT (gpioPortA)
271 #define BSP_SERIAL_APP_RX_LOC (0U)
273 #define BSP_SERIAL_APP_CTS_PIN (2U)
274 #define BSP_SERIAL_APP_CTS_PORT (gpioPortA)
275 #define BSP_SERIAL_APP_CTS_LOC (30U)
277 #define BSP_SERIAL_APP_RTS_PIN (3U)
278 #define BSP_SERIAL_APP_RTS_PORT (gpioPortA)
279 #define BSP_SERIAL_APP_RTS_LOC (30U)
284 #define BSP_SPINCP_NHOSTINT_PIN (6U)
285 #define BSP_SPINCP_NHOSTINT_PORT (gpioPortA)
287 #define BSP_SPINCP_NWAKE_PIN (7U)
288 #define BSP_SPINCP_NWAKE_PORT (gpioPortA)
290 #define BSP_SPINCP_USART_PORT (HAL_SPI_PORT_USART2)
291 #define BSP_SPINCP_MOSI_PIN (0U)
292 #define BSP_SPINCP_MOSI_PORT (gpioPortK)
293 #define BSP_SPINCP_MOSI_LOC (29U)
295 #define BSP_SPINCP_MISO_PIN (2U)
296 #define BSP_SPINCP_MISO_PORT (gpioPortK)
297 #define BSP_SPINCP_MISO_LOC (30U)
299 #define BSP_SPINCP_CLK_PIN (7U)
300 #define BSP_SPINCP_CLK_PORT (gpioPortF)
301 #define BSP_SPINCP_CLK_LOC (18U)
303 #define BSP_SPINCP_CS_PIN (5U)
304 #define BSP_SPINCP_CS_PORT (gpioPortA)
305 #define BSP_SPINCP_CS_LOC (29U)
310 #define PORTIO_TIMER0_CC0_PIN (11U)
311 #define PORTIO_TIMER0_CC0_PORT (gpioPortD)
312 #define PORTIO_TIMER0_CC0_LOC (19U)
314 #define PORTIO_TIMER0_CC1_PIN (12U)
315 #define PORTIO_TIMER0_CC1_PORT (gpioPortD)
316 #define PORTIO_TIMER0_CC1_LOC (19U)
318 #define PORTIO_TIMER0_CC2_PIN (13U)
319 #define PORTIO_TIMER0_CC2_PORT (gpioPortD)
320 #define PORTIO_TIMER0_CC2_LOC (19U)
322 #define BSP_TIMER0_CC0_PIN (11U)
323 #define BSP_TIMER0_CC0_PORT (gpioPortD)
324 #define BSP_TIMER0_CC0_LOC (19U)
326 #define BSP_TIMER0_CC1_PIN (12U)
327 #define BSP_TIMER0_CC1_PORT (gpioPortD)
328 #define BSP_TIMER0_CC1_LOC (19U)
330 #define BSP_TIMER0_CC2_PIN (13U)
331 #define BSP_TIMER0_CC2_PORT (gpioPortD)
332 #define BSP_TIMER0_CC2_LOC (19U)
337 #define BSP_UARTNCP_USART_PORT (HAL_SERIAL_PORT_USART0)
338 #define BSP_UARTNCP_TX_PIN (0U)
339 #define BSP_UARTNCP_TX_PORT (gpioPortA)
340 #define BSP_UARTNCP_TX_LOC (0U)
342 #define BSP_UARTNCP_RX_PIN (1U)
343 #define BSP_UARTNCP_RX_PORT (gpioPortA)
344 #define BSP_UARTNCP_RX_LOC (0U)
346 #define BSP_UARTNCP_CTS_PIN (2U)
347 #define BSP_UARTNCP_CTS_PORT (gpioPortA)
348 #define BSP_UARTNCP_CTS_LOC (30U)
350 #define BSP_UARTNCP_RTS_PIN (3U)
351 #define BSP_UARTNCP_RTS_PORT (gpioPortA)
352 #define BSP_UARTNCP_RTS_LOC (30U)
357 #define PORTIO_USART0_CTS_PIN (2U)
358 #define PORTIO_USART0_CTS_PORT (gpioPortA)
359 #define PORTIO_USART0_CTS_LOC (30U)
361 #define PORTIO_USART0_RTS_PIN (3U)
362 #define PORTIO_USART0_RTS_PORT (gpioPortA)
363 #define PORTIO_USART0_RTS_LOC (30U)
365 #define PORTIO_USART0_RX_PIN (1U)
366 #define PORTIO_USART0_RX_PORT (gpioPortA)
367 #define PORTIO_USART0_RX_LOC (0U)
369 #define PORTIO_USART0_TX_PIN (0U)
370 #define PORTIO_USART0_TX_PORT (gpioPortA)
371 #define PORTIO_USART0_TX_LOC (0U)
373 #define BSP_USART0_TX_PIN (0U)
374 #define BSP_USART0_TX_PORT (gpioPortA)
375 #define BSP_USART0_TX_LOC (0U)
377 #define BSP_USART0_RX_PIN (1U)
378 #define BSP_USART0_RX_PORT (gpioPortA)
379 #define BSP_USART0_RX_LOC (0U)
381 #define BSP_USART0_CTS_PIN (2U)
382 #define BSP_USART0_CTS_PORT (gpioPortA)
383 #define BSP_USART0_CTS_LOC (30U)
385 #define BSP_USART0_RTS_PIN (3U)
386 #define BSP_USART0_RTS_PORT (gpioPortA)
387 #define BSP_USART0_RTS_LOC (30U)
392 #define PORTIO_USART1_CLK_PIN (8U)
393 #define PORTIO_USART1_CLK_PORT (gpioPortC)
394 #define PORTIO_USART1_CLK_LOC (11U)
396 #define PORTIO_USART1_CS_PIN (9U)
397 #define PORTIO_USART1_CS_PORT (gpioPortC)
398 #define PORTIO_USART1_CS_LOC (11U)
400 #define PORTIO_USART1_RX_PIN (7U)
401 #define PORTIO_USART1_RX_PORT (gpioPortC)
402 #define PORTIO_USART1_RX_LOC (11U)
404 #define PORTIO_USART1_TX_PIN (6U)
405 #define PORTIO_USART1_TX_PORT (gpioPortC)
406 #define PORTIO_USART1_TX_LOC (11U)
408 #define BSP_USART1_MOSI_PIN (6U)
409 #define BSP_USART1_MOSI_PORT (gpioPortC)
410 #define BSP_USART1_MOSI_LOC (11U)
412 #define BSP_USART1_MISO_PIN (7U)
413 #define BSP_USART1_MISO_PORT (gpioPortC)
414 #define BSP_USART1_MISO_LOC (11U)
416 #define BSP_USART1_CLK_PIN (8U)
417 #define BSP_USART1_CLK_PORT (gpioPortC)
418 #define BSP_USART1_CLK_LOC (11U)
420 #define BSP_USART1_CS_PIN (9U)
421 #define BSP_USART1_CS_PORT (gpioPortC)
422 #define BSP_USART1_CS_LOC (11U)
427 #define PORTIO_USART2_CLK_PIN (7U)
428 #define PORTIO_USART2_CLK_PORT (gpioPortF)
429 #define PORTIO_USART2_CLK_LOC (18U)
431 #define PORTIO_USART2_CS_PIN (5U)
432 #define PORTIO_USART2_CS_PORT (gpioPortA)
433 #define PORTIO_USART2_CS_LOC (29U)
435 #define PORTIO_USART2_RX_PIN (2U)
436 #define PORTIO_USART2_RX_PORT (gpioPortK)
437 #define PORTIO_USART2_RX_LOC (30U)
439 #define PORTIO_USART2_TX_PIN (0U)
440 #define PORTIO_USART2_TX_PORT (gpioPortK)
441 #define PORTIO_USART2_TX_LOC (29U)
443 #define BSP_USART2_MOSI_PIN (0U)
444 #define BSP_USART2_MOSI_PORT (gpioPortK)
445 #define BSP_USART2_MOSI_LOC (29U)
447 #define BSP_USART2_MISO_PIN (2U)
448 #define BSP_USART2_MISO_PORT (gpioPortK)
449 #define BSP_USART2_MISO_LOC (30U)
451 #define BSP_USART2_CLK_PIN (7U)
452 #define BSP_USART2_CLK_PORT (gpioPortF)
453 #define BSP_USART2_CLK_LOC (18U)
455 #define BSP_USART2_CS_PIN (5U)
456 #define BSP_USART2_CS_PORT (gpioPortA)
457 #define BSP_USART2_CS_LOC (29U)
462 #define PORTIO_USART3_CLK_PIN (2U)
463 #define PORTIO_USART3_CLK_PORT (gpioPortC)
464 #define PORTIO_USART3_CLK_LOC (18U)
466 #define PORTIO_USART3_CS_PIN (3U)
467 #define PORTIO_USART3_CS_PORT (gpioPortC)
468 #define PORTIO_USART3_CS_LOC (18U)
470 #define PORTIO_USART3_RX_PIN (1U)
471 #define PORTIO_USART3_RX_PORT (gpioPortC)
472 #define PORTIO_USART3_RX_LOC (18U)
474 #define PORTIO_USART3_TX_PIN (0U)
475 #define PORTIO_USART3_TX_PORT (gpioPortC)
476 #define PORTIO_USART3_TX_LOC (18U)
478 #define BSP_USART3_MOSI_PIN (0U)
479 #define BSP_USART3_MOSI_PORT (gpioPortC)
480 #define BSP_USART3_MOSI_LOC (18U)
482 #define BSP_USART3_MISO_PIN (1U)
483 #define BSP_USART3_MISO_PORT (gpioPortC)
484 #define BSP_USART3_MISO_LOC (18U)
486 #define BSP_USART3_CLK_PIN (2U)
487 #define BSP_USART3_CLK_PORT (gpioPortC)
488 #define BSP_USART3_CLK_LOC (18U)
490 #define BSP_USART3_CS_PIN (3U)
491 #define BSP_USART3_CS_PORT (gpioPortC)
492 #define BSP_USART3_CS_LOC (18U)
496 // $[Custom pin names]
497 #define HALL_ENABLE_PIN (10U)
498 #define HALL_ENABLE_PORT (gpioPortB)
500 #define HALL_OUT1_PIN (11U)
501 #define HALL_OUT1_PORT (gpioPortB)
503 #define IMU_ENABLE_PIN (8U)
504 #define IMU_ENABLE_PORT (gpioPortF)
506 #define ENV_SENSE_ENABLE_PIN (9U)
507 #define ENV_SENSE_ENABLE_PORT (gpioPortF)
509 #define MIC_ENABLE_PIN (10U)
510 #define MIC_ENABLE_PORT (gpioPortF)
512 #define UV_ALS_INT_PIN (11U)
513 #define UV_ALS_INT_PORT (gpioPortF)
515 #define IMU_INT_PIN (12U)
516 #define IMU_INT_PORT (gpioPortF)
518 #define CCS811_INT_PIN (13U)
519 #define CCS811_INT_PORT (gpioPortF)
521 #define CCS811_ENABLE_PIN (14U)
522 #define CCS811_ENABLE_PORT (gpioPortF)
524 #define CCS811_WAKE_PIN (15U)
525 #define CCS811_WAKE_PORT (gpioPortF)
527 #define RGB_LED_ENABLE_PIN (14U)
528 #define RGB_LED_ENABLE_PORT (gpioPortJ)
530 // [Custom pin names]$
532 #if defined(_SILICON_LABS_MODULE)
533 #include "sl_module.h"