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 
110 #define I2C_NUMOF 1
111 #define I2C_0_EN 1
112 #define I2C_IRQ_PRIO 1
113 
114 /* I2C 0 device configuration */
115 #define I2C_0_DEV 0
116 #define I2C_0_IRQ I2C_IRQn
117 #define I2C_0_IRQ_HANDLER isr_i2c
118 #define I2C_0_SCL_PIN GPIO_PB3 /* OpenBattery */
119 #define I2C_0_SDA_PIN GPIO_PB4 /* OpenBattery */
120 
121 static const i2c_conf_t i2c_config[I2C_NUMOF] = {
122  {
123  .scl_pin = GPIO_PB3, /* OpenBattery */
124  .sda_pin = GPIO_PB4, /* OpenBattery */
125  },
126 };
136 static const spi_clk_conf_t spi_clk_config[] = {
137  { .cpsr = 10, .scr = 31 }, /* 100khz */
138  { .cpsr = 2, .scr = 39 }, /* 400khz */
139  { .cpsr = 2, .scr = 15 }, /* 1MHz */
140  { .cpsr = 2, .scr = 2 }, /* ~4.5MHz */
141  { .cpsr = 2, .scr = 1 } /* ~10.7MHz */
142 };
143 
148 static const spi_conf_t spi_config[] = {
149  {
150  .dev = SSI0,
151  .mosi_pin = GPIO_PA5,
152  .miso_pin = GPIO_PA4,
153  .sck_pin = GPIO_PA2,
154  .cs_pin = GPIO_PA3,
155  },
156 };
157 
158 #define SPI_NUMOF (sizeof(spi_config) / sizeof(spi_config[0]))
159 
165 #define RADIO_IRQ_PRIO 1
166 
168 #ifdef __cplusplus
169 } /* end extern "C" */
170 #endif
171 
172 #endif /* PERIPH_CONF_H */
173 
PA4.
Definition: cc2538_gpio.h:150
cc2538_uart_t * dev
pointer to the used UART device
I2C configuration options.
PA3.
Definition: cc2538_gpio.h:149
PB3.
Definition: cc2538_gpio.h:157
gpio_t scl_pin
pin used for SCL
16-bit timer configuration
PB4.
Definition: cc2538_gpio.h:158
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
32-bit timer configuration
UART device configuration.
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
PA5.
Definition: cc2538_gpio.h:151
cc2538_ssi_t * dev
SSI device.