periph_common.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Freie Universit├Ąt Berlin
3  * Copyright (C) 2015 Zolertia SL
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser General
6  * Public License v2.1. See the file LICENSE in the top level directory for more
7  * details.
8  */
9 
21 #ifndef PERIPH_COMMON_H
22 #define PERIPH_COMMON_H
23 
24 #include "periph_cpu.h"
25 
26 #ifdef __cplusplus
27  extern "C" {
28 #endif
29 
34 #define CLOCK_CORECLOCK (32000000U) /* 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 
66 #define TIMER_IRQ_PRIO 1
67 
73 #define RADIO_IRQ_PRIO 1
74 
80 static const uart_conf_t uart_config[] = {
81  /* UART0 is mapped to debug usb */
82  {
84  .rx_pin = GPIO_PIN(PORT_A, 0),
85  .tx_pin = GPIO_PIN(PORT_A, 1),
86  .cts_pin = GPIO_UNDEF,
87  .rts_pin = GPIO_UNDEF
88  },
89  {
90  .dev = UART1_BASEADDR,
91  .rx_pin = GPIO_PIN(PORT_C, 1),
92  .tx_pin = GPIO_PIN(PORT_C, 0),
93  .cts_pin = GPIO_UNDEF,
94  .rts_pin = GPIO_UNDEF
95  }
96 };
97 
98 /* interrupt function name mapping */
99 #define UART_0_ISR isr_uart0
100 #define UART_1_ISR isr_uart1
101 
102 /* macros common across all UARTs */
103 #define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0]))
104 
107 #ifdef __cplusplus
108 } /* end extern "C" */
109 #endif
110 
111 #endif /* PERIPH_COMMON_H */
112 
cc2538_uart_t * dev
pointer to the used UART device
32-bit timer configuration
16-bit timer configuration
#define UART0_BASEADDR
UART0 Instance.
Definition: cc2538_uart.h:183
uint_fast8_t chn
number of channels
UART device configuration.
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Timer configuration.
#define UART1_BASEADDR
UART1 Instance.
Definition: cc2538_uart.h:184