Contiki 3.x
board.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014, 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  * 3. Neither the name of the copyright holder nor the names of its
14  * contributors may be used to endorse or promote products derived
15  * from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28  * OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  * This file is part of the Contiki operating system.
31  *
32  */
33 /* -------------------------------------------------------------------------- */
34 /**
35  * \addtogroup openmote-cc2538
36  * @{
37  *
38  * \file
39  * This file provides connectivity information on LEDs, Buttons, UART and
40  * other OpenMote-CC2538 peripherals.
41  *
42  * This file can be used as the basis to configure other platforms using the
43  * cc2538 SoC.
44  *
45  * \note Do not include this file directly. It gets included by contiki-conf
46  * after all relevant directives have been set.
47  */
48 
49 #ifndef BOARD_H_
50 #define BOARD_H_
51 /*---------------------------------------------------------------------------*/
52 #include "dev/gpio.h"
53 #include "dev/nvic.h"
54 /*---------------------------------------------------------------------------*/
55 /** \name OpenMote-CC2538 LED configuration
56  *
57  * LEDs on the OpenMote-CC2538 are connected as follows:
58  * - LED1 (Red) -> PC4
59  * - LED2 (Yellow) -> PC6
60  * - LED3 (Green) -> PC7
61  * - LED4 (Orange) -> PC5
62  *
63  * @{
64  */
65 /*---------------------------------------------------------------------------*/
66 /* Some files include leds.h before us, so we need to get rid of defaults in
67  * leds.h before we provide correct definitions */
68 #undef LEDS_GREEN
69 #undef LEDS_YELLOW
70 #undef LEDS_RED
71 #undef LEDS_CONF_ALL
72 
73 #define LEDS_RED 16 /**< LED1 (Red) -> PC4 */
74 #define LEDS_YELLOW 64 /**< LED2 (Yellow) -> PC6 */
75 #define LEDS_GREEN 128 /**< LED3 (Green) -> PC7 */
76 #define LEDS_ORANGE 32 /**< LED4 (Orange) -> PC5 */
77 #define LEDS_CONF_ALL 240
78 
79 /* Notify various examples that we have LEDs */
80 #define PLATFORM_HAS_LEDS 1
81 /** @} */
82 /*---------------------------------------------------------------------------*/
83 /** \name USB configuration
84  *
85  * The USB pullup is driven by PC0
86  */
87 #define USB_PULLUP_PORT GPIO_C_NUM
88 #define USB_PULLUP_PIN 0
89 /** @} */
90 /*---------------------------------------------------------------------------*/
91 /** \name UART configuration
92  *
93  * On the OpenMote, the UART is connected to the
94  * following ports/pins
95  * - RX: PA0
96  * - TX: PA1
97  * - CTS: PB0 (Can only be used with UART1)
98  * - RTS: PD3 (Can only be used with UART1)
99  *
100  * We configure the port to use UART0. To use UART1, replace UART0_* with
101  * UART1_* below.
102  * @{
103  */
104 #define UART0_RX_PORT GPIO_A_NUM
105 #define UART0_RX_PIN 0
106 #define UART0_TX_PORT GPIO_A_NUM
107 #define UART0_TX_PIN 1
108 
109 #define UART1_RX_PORT GPIO_B_NUM
110 #define UART1_RX_PIN 0
111 #define UART1_TX_PORT GPIO_D_NUM
112 #define UART1_TX_PIN 3
113 #define UART1_CTS_PORT (-1)
114 #define UART1_CTS_PIN (-1)
115 #define UART1_RTS_PORT (-1)
116 #define UART1_RTS_PIN (-1)
117 /** @} */
118 /*---------------------------------------------------------------------------*/
119 /** \name OpenMote-CC2538 Button configuration
120  *
121  * Buttons on the OpenMote-CC2538 are connected as follows:
122  * - BUTTON_USER -> PC3
123  * @{
124  */
125 /** BUTTON_USER -> PC3 */
126 #define BUTTON_USER_PORT GPIO_C_NUM
127 #define BUTTON_USER_PIN 3
128 #define BUTTON_USER_VECTOR NVIC_INT_GPIO_PORT_C
129 /* Notify various examples that we have Buttons */
130 #define PLATFORM_HAS_BUTTON 1
131 /** @} */
132 /*---------------------------------------------------------------------------*/
133 /**
134  * \name SPI (SSI0) configuration
135  *
136  * These values configure which CC2538 pins to use for the SPI (SSI0) lines.
137  * The SSI0 is currently used to interface with the Ethernet driver (ENC28J60)
138  * on the OpenBase board.
139  * @{
140  */
141 #define SPI_CLK_PORT GPIO_A_NUM
142 #define SPI_CLK_PIN 2
143 #define SPI_MOSI_PORT GPIO_A_NUM
144 #define SPI_MOSI_PIN 5
145 #define SPI_MISO_PORT GPIO_A_NUM
146 #define SPI_MISO_PIN 4
147 /** @} */
148 /*---------------------------------------------------------------------------*/
149 /**
150  * \name SPI (SSI1) configuration
151  *
152  * These values configure which CC2538 pins to use for the SPI (SSI1) lines.
153  * The SSI1 is currently not used.
154  * @{
155  */
156 #define SPI1_CLK_PORT GPIO_C_NUM
157 #define SPI1_CLK_PIN 4
158 #define SPI1_TX_PORT GPIO_C_NUM
159 #define SPI1_TX_PIN 5
160 #define SPI1_RX_PORT GPIO_C_NUM
161 #define SPI1_RX_PIN 6
162 /** @} */
163 /*---------------------------------------------------------------------------*/
164 /**
165  * \name I2C configuration
166  *
167  * These values configure which CC2538 pins to use for the I2C lines.
168  * @{
169  */
170 #define I2C_SCL_PORT GPIO_B_NUM
171 #define I2C_SCL_PIN 3
172 #define I2C_SDA_PORT GPIO_B_NUM
173 #define I2C_SDA_PIN 4
174 /** @} */
175 /*---------------------------------------------------------------------------*/
176 /**
177  * \name Device string used on startup
178  * @{
179  */
180 #define BOARD_STRING "OpenMote-CC2538"
181 /** @} */
182 /*---------------------------------------------------------------------------*/
183 #endif /* BOARD_H_ */
184 /*---------------------------------------------------------------------------*/
185 /**
186  * @}
187  */
Header file for the ARM Nested Vectored Interrupt Controller.