Wirepas SDK
board.h
Go to the documentation of this file.
1 /* Copyright 2018 Wirepas Ltd. All Rights Reserved.
2  *
3  * See file LICENSE.txt for full license details.
4  *
5  */
6 
13 #ifndef BOARD_TBSENSE2_BOARD_H_
14 #define BOARD_TBSENSE2_BOARD_H_
15 
16 // Waps usart defines
17 #if defined USE_FTDI
18 
19 // Serial port
20 #define BOARD_USART_ID 1
21 #define BOARD_USART_TX_PORT GPIOF
22 #define BOARD_USART_TX_PIN 3
23 #define BOARD_USART_RX_PORT GPIOF
24 #define BOARD_USART_RX_PIN 4
25 
26 // ROUTELOC are dependent on GPIO defined above and mapping
27 // can be founded chip datasheet from Silabs
28 #define BOARD_USART_ROUTELOC_RXLOC USART_ROUTELOC0_RXLOC_LOC27
29 #define BOARD_USART_ROUTELOC_TXLOC USART_ROUTELOC0_TXLOC_LOC27
30 
31 // List of GPIO pins
32 #define BOARD_GPIO_PIN_LIST {{GPIOD, 8}, /* PD08 */\
33  {GPIOD, 9}, /* PD09 */\
34  {GPIOD, 14}, /* PD14 */\
35  {GPIOD, 15}, /* PD15 */\
36  {GPIOF, 4}, /* PF04. required by the dual_mcu app. usart wakeup pin (= BOARD_USART_RX) */\
37  {GPIOF, 6}} /* PF06. required by the dual_mcu app (indication signal) */
38 #else
39 
40 // Serial port
41 #define BOARD_USART_ID 0
42 #define BOARD_USART_TX_PORT GPIOA
43 #define BOARD_USART_TX_PIN 0
44 #define BOARD_USART_RX_PORT GPIOA
45 #define BOARD_USART_RX_PIN 1
46 
47 // VCOM port only supports 115200 baudrate
48 // This speed will be used independently of UART_BAUDRATE flag value
49 #define BOARD_USART_FORCE_BAUDRATE 115200
50 
51 // ROUTELOC are dependent on GPIO defined above and mapping
52 // can be founded chip datasheet from Silabs
53 #define BOARD_USART_ROUTELOC_RXLOC USART_ROUTELOC0_RXLOC_LOC0
54 #define BOARD_USART_ROUTELOC_TXLOC USART_ROUTELOC0_TXLOC_LOC0
55 
56 // List of GPIO pins
57 #define BOARD_GPIO_PIN_LIST {{GPIOD, 8}, /* PD08 */\
58  {GPIOD, 9}, /* PD09 */\
59  {GPIOD, 14}, /* PD14 */\
60  {GPIOD, 15}, /* PD15 */\
61  {GPIOA, 1}, /* PA01. required by the dual_mcu app. usart wakeup pin (= BOARD_USART_RX) */\
62  {GPIOF, 6}} /* PF06. required by the dual_mcu app (indication signal) */
63 #endif
64 
65 // User friendly name for GPIOs (IDs mapped to the BOARD_GPIO_PIN_LIST table)
66 #define BOARD_GPIO_ID_LED_R 0 // mapped to pin PD08
67 #define BOARD_GPIO_ID_LED_G 1 // mapped to pin PD09
68 #define BOARD_GPIO_ID_BUTTON0 2 // mapped to pin PD14
69 #define BOARD_GPIO_ID_BUTTON1 3 // mapped to pin PD15
70 #define BOARD_GPIO_ID_USART_WAKEUP 4 // mapped to BOARD_USART_RX_PIN
71 #define BOARD_GPIO_ID_UART_IRQ 5 // mapped to pin PF06
72 
73 // I2C configuration: SDA on PC4, SCL on PC5 (ENV_I2C on Thunderboard Sense 2)
74 #define USE_I2C1
75 #define BOARD_I2C_GPIO_PORT GPIOC
76 #define BOARD_I2C_SDA_PIN 4
77 #define BOARD_I2C_SCL_PIN 5
78 #define BOARD_I2C_ROUTELOC_SDALOC I2C_ROUTELOC0_SDALOC_LOC17
79 #define BOARD_I2C_ROUTELOC_SCLLOC I2C_ROUTELOC0_SCLLOC_LOC17
80 
81 // List of LED IDs
82 #define BOARD_LED_ID_LIST {BOARD_GPIO_ID_LED_R, BOARD_GPIO_ID_LED_G}
83 
84 // Active high polarity for LEDs
85 #define BOARD_LED_ACTIVE_LOW false
86 
87 // List of button IDs
88 #define BOARD_BUTTON_ID_LIST {BOARD_GPIO_ID_BUTTON0, BOARD_GPIO_ID_BUTTON1}
89 
90 // Active low polarity for buttons
91 #define BOARD_BUTTON_ACTIVE_LOW true
92 
93 // Board has external pull-up for buttons
94 #define BOARD_BUTTON_INTERNAL_PULL false
95 
96 
97 #endif /* BOARD_TBSENSE2_BOARD_H_ */