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 #define UART_NUMOF (1U)
90 #define UART_0_EN 1
91 #define UART_IRQ_PRIO 1
92 
93 /* UART 0 device configuration */
94 #define UART_0_DEV UART0
95 #define UART_0_IRQ UART0_IRQn
96 #define UART_0_ISR isr_uart0
97 /* UART 0 pin configuration */
98 #define UART_0_TX_PIN GPIO_PA1
99 #define UART_0_RX_PIN GPIO_PA0
100 
106 #define I2C_NUMOF 1
107 #define I2C_0_EN 1
108 #define I2C_IRQ_PRIO 1
109 
110 /* I2C 0 device configuration */
111 #define I2C_0_DEV 0
112 #define I2C_0_IRQ I2C_IRQn
113 #define I2C_0_IRQ_HANDLER isr_i2c
114 #define I2C_0_SCL_PIN GPIO_PB3 /* OpenBattery */
115 #define I2C_0_SDA_PIN GPIO_PB4 /* OpenBattery */
116 
117 static const i2c_conf_t i2c_config[I2C_NUMOF] = {
118  {
119  .scl_pin = GPIO_PB3, /* OpenBattery */
120  .sda_pin = GPIO_PB4, /* OpenBattery */
121  },
122 };
132 static const spi_clk_conf_t spi_clk_config[] = {
133  { .cpsr = 10, .scr = 31 }, /* 100khz */
134  { .cpsr = 2, .scr = 39 }, /* 400khz */
135  { .cpsr = 2, .scr = 15 }, /* 1MHz */
136  { .cpsr = 2, .scr = 2 }, /* ~4.5MHz */
137  { .cpsr = 2, .scr = 1 } /* ~10.7MHz */
138 };
139 
144 static const spi_conf_t spi_config[] = {
145  {
146  .dev = SSI0,
147  .mosi_pin = GPIO_PA5,
148  .miso_pin = GPIO_PA4,
149  .sck_pin = GPIO_PA2,
150  .cs_pin = GPIO_PA3,
151  },
152 };
153 
154 #define SPI_NUMOF (sizeof(spi_config) / sizeof(spi_config[0]))
155 
161 #define RADIO_IRQ_PRIO 1
162 
164 #ifdef __cplusplus
165 } /* end extern "C" */
166 #endif
167 
168 #endif /* PERIPH_CONF_H */
169 
PB3.
Definition: cc2538_gpio.h:168
I2C configuration options.
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
gpio_t scl_pin
pin used for SCL
PA5.
Definition: cc2538_gpio.h:162
PB4.
Definition: cc2538_gpio.h:169
static const spi_clk_conf_t spi_clk_config[]
Pre-calculated clock divider values based on a CLOCK_CORECLOCK (32MHz)
Datafields for static SPI clock configuration values.
uint_fast8_t chn
number of channels
PA4.
Definition: cc2538_gpio.h:161
16-bit timer configuration
32-bit timer configuration
PA2.
Definition: cc2538_gpio.h:159
Driver for the cc2538 GPIO controller.
SPI module configuration options.
uint8_t cpsr
CPSR clock divider.
CPU specific ADC configuration.
Timer configuration.
#define SSI0
SSI0 Instance.
Definition: cc2538_ssi.h:77
PA3.
Definition: cc2538_gpio.h:160
cc2538_ssi_t * dev
SSI device.