Contiki 3.x
board.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  *
14  * 3. Neither the name of the copyright holder nor the names of its
15  * contributors may be used to endorse or promote products derived
16  * from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29  * OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 /**
32  * \addtogroup cc2538dk
33  * @{
34  *
35  * \defgroup cc2538-smartrf SmartRF06EB Peripherals
36  *
37  * Defines related to the SmartRF06EB
38  *
39  * This file provides connectivity information on LEDs, Buttons, UART and
40  * other SmartRF peripherals
41  *
42  * Notably, PC0 is used to drive LED1 as well as the USB D+ pullup. Therefore
43  * when USB is enabled, LED1 can not be driven by firmware.
44  *
45  * This file can be used as the basis to configure other platforms using the
46  * cc2538 SoC.
47  * @{
48  *
49  * \file
50  * Header file with definitions related to the I/O connections on the TI
51  * SmartRF06EB
52  *
53  * \note Do not include this file directly. It gets included by contiki-conf
54  * after all relevant directives have been set.
55  */
56 #ifndef BOARD_H_
57 #define BOARD_H_
58 
59 #include "dev/gpio.h"
60 #include "dev/nvic.h"
61 /*---------------------------------------------------------------------------*/
62 /** \name SmartRF LED configuration
63  *
64  * LEDs on the SmartRF06 (EB and BB) are connected as follows:
65  * - LED1 (Red) -> PC0
66  * - LED2 (Yellow) -> PC1
67  * - LED3 (Green) -> PC2
68  * - LED4 (Orange) -> PC3
69  *
70  * LED1 shares the same pin with the USB pullup
71  * @{
72  */
73 /*---------------------------------------------------------------------------*/
74 /* Some files include leds.h before us, so we need to get rid of defaults in
75  * leds.h before we provide correct definitions */
76 #undef LEDS_GREEN
77 #undef LEDS_YELLOW
78 #undef LEDS_RED
79 #undef LEDS_CONF_ALL
80 
81 #define LEDS_YELLOW 2 /**< LED2 (Yellow) -> PC1 */
82 #define LEDS_GREEN 4 /**< LED3 (Green) -> PC2 */
83 #define LEDS_ORANGE 8 /**< LED4 (Orange) -> PC3 */
84 
85 #if USB_SERIAL_CONF_ENABLE
86 #define LEDS_CONF_ALL 14
87 #define LEDS_RED LEDS_ORANGE
88 #else
89 #define LEDS_CONF_ALL 15
90 #define LEDS_RED 1 /**< LED1 (Red) -> PC0 */
91 #endif
92 
93 /* Notify various examples that we have LEDs */
94 #define PLATFORM_HAS_LEDS 1
95 /** @} */
96 /*---------------------------------------------------------------------------*/
97 /** \name USB configuration
98  *
99  * The USB pullup is driven by PC0 and is shared with LED1
100  */
101 #define USB_PULLUP_PORT GPIO_C_NUM
102 #define USB_PULLUP_PIN 0
103 /** @} */
104 /*---------------------------------------------------------------------------*/
105 /** \name UART configuration
106  *
107  * On the SmartRF06EB, the UART (XDS back channel) is connected to the
108  * following ports/pins
109  * - RX: PA0
110  * - TX: PA1
111  * - CTS: PB0 (Can only be used with UART1)
112  * - RTS: PD3 (Can only be used with UART1)
113  *
114  * We configure the port to use UART0. To use UART1, replace UART0_* with
115  * UART1_* below.
116  * @{
117  */
118 #define UART0_RX_PORT GPIO_A_NUM
119 #define UART0_RX_PIN 0
120 
121 #define UART0_TX_PORT GPIO_A_NUM
122 #define UART0_TX_PIN 1
123 
124 #define UART1_CTS_PORT GPIO_B_NUM
125 #define UART1_CTS_PIN 0
126 
127 #define UART1_RTS_PORT GPIO_D_NUM
128 #define UART1_RTS_PIN 3
129 /** @} */
130 /*---------------------------------------------------------------------------*/
131 /** \name SmartRF Button configuration
132  *
133  * Buttons on the SmartRF06 are connected as follows:
134  * - BUTTON_SELECT -> PA3
135  * - BUTTON_LEFT -> PC4
136  * - BUTTON_RIGHT -> PC5
137  * - BUTTON_UP -> PC6
138  * - BUTTON_DOWN -> PC7
139  * @{
140  */
141 /** BUTTON_SELECT -> PA3 */
142 #define BUTTON_SELECT_PORT GPIO_A_NUM
143 #define BUTTON_SELECT_PIN 3
144 #define BUTTON_SELECT_VECTOR NVIC_INT_GPIO_PORT_A
145 
146 /** BUTTON_LEFT -> PC4 */
147 #define BUTTON_LEFT_PORT GPIO_C_NUM
148 #define BUTTON_LEFT_PIN 4
149 #define BUTTON_LEFT_VECTOR NVIC_INT_GPIO_PORT_C
150 
151 /** BUTTON_RIGHT -> PC5 */
152 #define BUTTON_RIGHT_PORT GPIO_C_NUM
153 #define BUTTON_RIGHT_PIN 5
154 #define BUTTON_RIGHT_VECTOR NVIC_INT_GPIO_PORT_C
155 
156 /** BUTTON_UP -> PC6 */
157 #define BUTTON_UP_PORT GPIO_C_NUM
158 #define BUTTON_UP_PIN 6
159 #define BUTTON_UP_VECTOR NVIC_INT_GPIO_PORT_C
160 
161 /** BUTTON_DOWN -> PC7 */
162 #define BUTTON_DOWN_PORT GPIO_C_NUM
163 #define BUTTON_DOWN_PIN 7
164 #define BUTTON_DOWN_VECTOR NVIC_INT_GPIO_PORT_C
165 
166 /* Notify various examples that we have Buttons */
167 #define PLATFORM_HAS_BUTTON 1
168 /** @} */
169 /*---------------------------------------------------------------------------*/
170 /**
171  * \name ADC configuration
172  *
173  * These values configure which CC2538 pins and ADC channels to use for the ADC
174  * inputs.
175  *
176  * ADC inputs can only be on port A.
177  * @{
178  */
179 #define ADC_ALS_PWR_PORT GPIO_A_NUM /**< ALS power GPIO control port */
180 #define ADC_ALS_PWR_PIN 7 /**< ALS power GPIO control pin */
181 #define ADC_ALS_OUT_PIN 6 /**< ALS output ADC input pin on port A */
182 /** @} */
183 /*---------------------------------------------------------------------------*/
184 /**
185  * \name SPI configuration
186  *
187  * These values configure which CC2538 pins to use for the SPI lines. Both
188  * SPI instances can be used independently by providing the corresponding
189  * port / pin macros.
190  * @{
191  */
192 #define SPI0_IN_USE 0
193 #define SPI1_IN_USE 0
194 #if SPI0_IN_USE
195 /** Clock port SPI0 */
196 #define SPI0_CLK_PORT GPIO_A_NUM
197 /** Clock pin SPI0 */
198 #define SPI0_CLK_PIN 2
199 /** TX port SPI0 (master mode: MOSI) */
200 #define SPI0_TX_PORT GPIO_A_NUM
201 /** TX pin SPI0 */
202 #define SPI0_TX_PIN 4
203 /** RX port SPI0 (master mode: MISO */
204 #define SPI0_RX_PORT GPIO_A_NUM
205 /** RX pin SPI0 */
206 #define SPI0_RX_PIN 5
207 #endif /* #if SPI0_IN_USE */
208 #if SPI1_IN_USE
209 /** Clock port SPI1 */
210 #define SPI1_CLK_PORT GPIO_A_NUM
211 /** Clock pin SPI1 */
212 #define SPI1_CLK_PIN 2
213 /** TX port SPI1 (master mode: MOSI) */
214 #define SPI1_TX_PORT GPIO_A_NUM
215 /** TX pin SPI1 */
216 #define SPI1_TX_PIN 4
217 /** RX port SPI1 (master mode: MISO) */
218 #define SPI1_RX_PORT GPIO_A_NUM
219 /** RX pin SPI1 */
220 #define SPI1_RX_PIN 5
221 #endif /* #if SPI1_IN_USE */
222 /** @} */
223 /*---------------------------------------------------------------------------*/
224 /**
225  * \name Device string used on startup
226  * @{
227  */
228 #define BOARD_STRING "TI SmartRF06 + cc2538EM"
229 /** @} */
230 
231 #endif /* BOARD_H_ */
232 
233 /**
234  * @}
235  * @}
236  */
Header file for the ARM Nested Vectored Interrupt Controller.