boards/openmote-cc2538/include/periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Freie Universit├Ąt Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
8 
20 #ifndef PERIPH_CONF_H
21 #define PERIPH_CONF_H
22 
23 #include "cc2538_gpio.h"
24 #include "periph_cpu.h"
25 
26 #ifdef __cplusplus
27  extern "C" {
28 #endif
29 
34 #define CLOCK_CORECLOCK (32000000U) /* desired core clock frequency, 32MHz */
35 
45 static const timer_conf_t timer_config[] = {
46  {
47  .chn = 2,
48  .cfg = GPTMCFG_16_BIT_TIMER, /* required for XTIMER */
49  },
50  {
51  .chn = 1,
52  .cfg = GPTMCFG_32_BIT_TIMER,
53  },
54  {
55  .chn = 2,
56  .cfg = GPTMCFG_16_BIT_TIMER,
57  },
58  {
59  .chn = 1,
60  .cfg = GPTMCFG_32_BIT_TIMER,
61  },
62 };
63 
64 #define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0]))
65 #define TIMER_IRQ_PRIO 1
66 
72 #define SOC_ADC_ADCCON_REF SOC_ADC_ADCCON_REF_AVDD5
73 
74 static const adc_conf_t adc_config[] = {
75  GPIO_PIN(0, 2),
76  GPIO_PIN(0, 3),
77  GPIO_PIN(0, 4),
78  GPIO_PIN(0, 5),
79  GPIO_PIN(0, 6),
80 };
81 
82 #define ADC_NUMOF (sizeof(adc_config) / sizeof(adc_config[0]))
83 
89 static const uart_conf_t uart_config[] = {
90  {
92  .rx_pin = GPIO_PIN(0, 0),
93  .tx_pin = GPIO_PIN(0, 1),
94  .cts_pin = GPIO_UNDEF,
95  .rts_pin = GPIO_UNDEF
96  }
97 };
98 
99 /* interrupt function name mapping */
100 #define UART_0_ISR isr_uart0
101 
102 /* macros common across all UARTs */
103 #define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0]))
104 
111 #define I2C_NUMOF 1
112 #define I2C_0_EN 1
113 #define I2C_IRQ_PRIO 1
114 
115 /* I2C 0 device configuration */
116 #define I2C_0_DEV 0
117 #define I2C_0_IRQ I2C_IRQn
118 #define I2C_0_IRQ_HANDLER isr_i2c
119 #define I2C_0_SCL_PIN GPIO_PB3 /* OpenBattery */
120 #define I2C_0_SDA_PIN GPIO_PB4 /* OpenBattery */
121 
122 static const i2c_conf_t i2c_config[I2C_NUMOF] = {
123  {
124  .scl_pin = GPIO_PB3, /* OpenBattery */
125  .sda_pin = GPIO_PB4, /* OpenBattery */
126  },
127 };
137 static const spi_clk_conf_t spi_clk_config[] = {
138  { .cpsr = 10, .scr = 31 }, /* 100khz */
139  { .cpsr = 2, .scr = 39 }, /* 400khz */
140  { .cpsr = 2, .scr = 15 }, /* 1MHz */
141  { .cpsr = 2, .scr = 2 }, /* ~4.5MHz */
142  { .cpsr = 2, .scr = 1 } /* ~10.7MHz */
143 };
144 
149 static const spi_conf_t spi_config[] = {
150  {
151  .dev = SSI0,
152  .mosi_pin = GPIO_PA5,
153  .miso_pin = GPIO_PA4,
154  .sck_pin = GPIO_PA2,
155  .cs_pin = GPIO_PA3,
156  },
157 };
158 
159 #define SPI_NUMOF (sizeof(spi_config) / sizeof(spi_config[0]))
160 
166 #define RADIO_IRQ_PRIO 1
167 
169 #ifdef __cplusplus
170 } /* end extern "C" */
171 #endif
172 
173 #endif /* PERIPH_CONF_H */
174 
cc2538_uart_t * dev
pointer to the used UART device
I2C configuration options.
32-bit timer configuration
gpio_t scl_pin
pin used for SCL
16-bit timer configuration
PA4.
Definition: cc2538_gpio.h:150
PA5.
Definition: cc2538_gpio.h:151
PA2.
Definition: cc2538_gpio.h:148
static const spi_clk_conf_t spi_clk_config[]
Pre-calculated clock divider values based on a CLOCK_CORECLOCK (32MHz)
#define UART0_BASEADDR
UART0 Instance.
Definition: cc2538_uart.h:183
Datafields for static SPI clock configuration values.
uint_fast8_t chn
number of channels
PB3.
Definition: cc2538_gpio.h:157
UART device configuration.
PA3.
Definition: cc2538_gpio.h:149
PB4.
Definition: cc2538_gpio.h:158
Driver for the cc2538 GPIO controller.
SPI module configuration options.
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
uint8_t cpsr
CPSR clock divider.
ADC device configuration.
Timer configuration.
#define SSI0
SSI0 Instance.
Definition: cc2538_ssi.h:77
cc2538_ssi_t * dev
SSI device.