boards/common/arduino-atmega/include/periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Freie Universit├Ąt Berlin, Hinnerk van Bruinehsen
3  * 2016 Laurent Navet <laurent.navet@gmail.com>
4  * 2017 HAW Hamburg, Dimitri Nahm
5  *
6  * This file is subject to the terms and conditions of the GNU Lesser
7  * General Public License v2.1. See the file LICENSE in the top level
8  * directory for more details.
9  */
10 
24 #ifndef PERIPH_CONF_H
25 #define PERIPH_CONF_H
26 
27 #include "periph_cpu.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
37 #define CLOCK_CORECLOCK (16000000UL)
38 
53 #ifdef CPU_ATMEGA328P
54 #define TIMER_NUMOF (1U)
55 #define TIMER_CHANNELS (2)
56 
57 #define TIMER_0 MEGA_TIMER1
58 #define TIMER_0_MASK &TIMSK1
59 #define TIMER_0_FLAG &TIFR1
60 #define TIMER_0_ISRA TIMER1_COMPA_vect
61 #define TIMER_0_ISRB TIMER1_COMPB_vect
62 #endif
63 
64 #ifdef CPU_ATMEGA2560
65 #define TIMER_NUMOF (2U)
66 #define TIMER_CHANNELS (3)
67 
68 #define TIMER_0 MEGA_TIMER1
69 #define TIMER_0_MASK &TIMSK1
70 #define TIMER_0_FLAG &TIFR1
71 #define TIMER_0_ISRA TIMER1_COMPA_vect
72 #define TIMER_0_ISRB TIMER1_COMPB_vect
73 #define TIMER_0_ISRC TIMER1_COMPC_vect
74 
75 #define TIMER_1 MEGA_TIMER4
76 #define TIMER_1_MASK &TIMSK4
77 #define TIMER_1_FLAG &TIFR4
78 #define TIMER_1_ISRA TIMER4_COMPA_vect
79 #define TIMER_1_ISRB TIMER4_COMPB_vect
80 #define TIMER_1_ISRC TIMER4_COMPC_vect
81 #endif
82 
93 #ifdef CPU_ATMEGA328P
94 #define UART_NUMOF (1U)
95 
96 #define UART_0 MEGA_UART0
97 #define UART_0_ISR USART_RX_vect
98 #endif
99 
100 #ifdef CPU_ATMEGA2560
101 #define UART_NUMOF (4U)
102 
103 #define UART_0 MEGA_UART0
104 #define UART_0_ISR USART0_RX_vect
105 
106 #define UART_1 MEGA_UART1
107 #define UART_1_ISR USART1_RX_vect
108 
109 #define UART_2 MEGA_UART2
110 #define UART_2_ISR USART2_RX_vect
111 
112 #define UART_3 MEGA_UART3
113 #define UART_3_ISR USART3_RX_vect
114 #endif
115 
141 #define SPI_NUMOF 1 /* set to 0 to disable SPI */
142 
148 #define I2C_BUS_SPEED I2C_SPEED_FAST
149 #define I2C_NUMOF 1
150 
163 #if defined (CPU_ATMEGA328P) || defined (CPU_ATMEGA1281)
164 #define ADC_NUMOF (8U)
165 #elif defined (CPU_ATMEGA2560)
166 #define ADC_NUMOF (16U)
167 #endif
168 
182 #if defined(CPU_ATMEGA328P)
183 #define PWM_PINS_CH0 { GPIO_PIN(PORT_D, 6), GPIO_PIN(PORT_D, 5) }
184 #define PWM_PINS_CH1 { GPIO_PIN(PORT_B, 3), GPIO_PIN(PORT_D, 3) }
185 
186 #elif defined(CPU_ATMEGA2560)
187 #define PWM_PINS_CH0 { GPIO_PIN(PORT_B, 7), GPIO_PIN(PORT_G, 5) }
188 #define PWM_PINS_CH1 { GPIO_PIN(PORT_B, 4), GPIO_PIN(PORT_H, 6) }
189 
190 #elif defined(CPU_ATMEGA1281)
191 #define PWM_PINS_CH0 { GPIO_PIN(PORT_B, 7), GPIO_PIN(PORT_G, 5) }
192 #define PWM_PINS_CH1 { GPIO_PIN(PORT_B, 4), GPIO_UNDEF }
193 #endif
194 
195 static const pwm_conf_t pwm_conf[] = {
196  {
197  .dev = MINI_TIMER0,
198  .pin_ch = PWM_PINS_CH0,
199  .div = MINI_TIMER0_DIV,
200  },
201  {
202  .dev = MINI_TIMER2,
203  .pin_ch = PWM_PINS_CH1,
204  .div = MINI_TIMER2_DIV,
205  }
206 };
207 #define PWM_NUMOF (sizeof(pwm_conf) / sizeof(pwm_conf[0]))
208 
210 #ifdef __cplusplus
211 }
212 #endif
213 
214 #endif /* PERIPH_CONF_H */
mini_timer_t * dev
Timer used.