35#ifndef PERIPH_CONF_ATMEGA_COMMON_H
36#define PERIPH_CONF_ATMEGA_COMMON_H
38#include "periph_cpu.h"
48#ifndef CLOCK_CORECLOCK
49#define CLOCK_CORECLOCK (16000000UL)
64#if defined(CPU_ATMEGA128RFA1) || defined(CPU_ATMEGA256RFR2) || \
65 defined(CPU_ATMEGA1281) || defined(CPU_ATMEGA1284P) || defined(CPU_ATMEGA2560)
66 #define UART_NUMOF (2U)
69 #define UART_0 MEGA_UART0
70 #define UART_0_ISR USART0_RX_vect
71 #define UART_0_ISR_TX USART0_TX_vect
73 #define UART_1 MEGA_UART1
74 #define UART_1_ISR USART1_RX_vect
75 #define UART_1_ISR_TX USART1_TX_vect
76#elif defined(CPU_ATMEGA8)
77 #define UART_NUMOF (1U)
79 #define UART_0 MEGA_UART
80 #define UART_0_ISR USART_RXC_vect
81 #define UART_0_ISR_TX USART_TXC_vect
82#elif defined(CPU_ATMEGA328P)
83 #define UART_NUMOF (1U)
85 #define UART_0 MEGA_UART0
86 #define UART_0_ISR USART_RX_vect
87 #define UART_0_ISR_TX USART_TX_vect
88#elif defined(CPU_ATMEGA32U4)
89 #define UART_NUMOF (1U)
91 #define UART_0 MEGA_UART1
92 #define UART_0_ISR USART1_RX_vect
93 #define UART_0_ISR_TX USART1_TX_vect
95 #define UART_NUMOF (0U)
141#define SPI_NUMOF (1U)
150#define I2C_BUS_SPEED I2C_SPEED_FAST
151#define I2C_NUMOF (1U)
166#if defined(CPU_ATMEGA128RFA1) || defined(CPU_ATMEGA256RFR2) || defined(CPU_ATMEGA328P) || \
167 defined(CPU_ATMEGA1281) || defined(CPU_ATMEGA1284P) || defined(CPU_ATMEGA32U4) || \
169 #define ADC_NUMOF (8U)
170#elif defined (CPU_ATMEGA2560)
171 #define ADC_NUMOF (16U)
173 #define ADC_NUMOF (0U)
192#if defined(CPU_ATMEGA8)
193 #define PWM_PINS_CH0 { GPIO_PIN(PORT_B, 3), GPIO_UNDEF }
194#elif defined(CPU_ATMEGA328P)
195 #define PWM_PINS_CH0 { GPIO_PIN(PORT_D, 6), GPIO_PIN(PORT_D, 5) }
196 #define PWM_PINS_CH1 { GPIO_PIN(PORT_B, 3), GPIO_PIN(PORT_D, 3) }
197#elif defined(CPU_ATMEGA1281)
198 #define PWM_PINS_CH0 { GPIO_PIN(PORT_B, 7), GPIO_PIN(PORT_G, 5) }
199 #define PWM_PINS_CH1 { GPIO_PIN(PORT_B, 4), GPIO_UNDEF }
200#elif defined(CPU_ATMEGA1284P)
201 #define PWM_PINS_CH0 { GPIO_PIN(PORT_B, 3), GPIO_PIN(PORT_B, 4) }
202 #define PWM_PINS_CH1 { GPIO_PIN(PORT_D, 7), GPIO_PIN(PORT_D, 6) }
203#elif defined(CPU_ATMEGA2560)
204 #define PWM_PINS_CH0 { GPIO_PIN(PORT_B, 7), GPIO_PIN(PORT_G, 5) }
205 #define PWM_PINS_CH1 { GPIO_PIN(PORT_B, 4), GPIO_PIN(PORT_H, 6) }
206#elif defined(CPU_ATMEGA32U4)
207 #define PWM_PINS_CH0 { GPIO_PIN(PORT_B, 7), GPIO_PIN(PORT_D, 0) }
209 #define PWM_NUMOF (0U)
212#if defined(CPU_ATMEGA32U4) || defined(CPU_ATMEGA328P) || \
213 defined(CPU_ATMEGA1281) || defined(CPU_ATMEGA1284P) || \
214 defined(CPU_ATMEGA2560) || defined(CPU_ATMEGA8)
219 .pin_ch = PWM_PINS_CH0,
220 .div = MINI_TIMER0_DIV,
222#ifndef CPU_ATMEGA32U4
225 .pin_ch = PWM_PINS_CH1,
226 .div = MINI_TIMER2_DIV,
232 .pin_ch = PWM_PINS_CH0,
233 .div = MINI_TIMER2_DIV,
238 #define PWM_NUMOF ARRAY_SIZE(pwm_conf)
PWM device configuration.