arduino-atmega/include/board_common.h
1 /*
2  * Copyright (C) 2014 Freie Universit├Ąt Berlin, Hinnerk van Bruinehsen
3  * 2016 Laurent Navet <laurent.navet@gmail.com>
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
10 /*
11  * @defgroup boards_common_arduino-atmega Arduino Atmega Common
12  * @ingroup boards_common
13  * @brief Shared files and configuration for Arduino Atmega boards.
14  * @{
15  *
16  * @file
17  * @brief Common board configuration for Arduino Atmega boards
18  *
19  * @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
20  * @author Laurent Navet <laurent.navet@gmail.com>
21  */
22 
23 #ifndef BOARD_COMMON_H
24 #define BOARD_COMMON_H
25 
26 #include "cpu.h"
27 #include "arduino_pinmap.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
40 #define STDIO_UART_BAUDRATE (9600U)
41 
47 #ifdef CPU_ATMEGA328P
48 #define LED0_PIN GPIO_PIN(1, 5)
49 #define LED0_MASK (1 << DDB5)
50 #endif
51 
52 #ifdef CPU_ATMEGA2560
53 #define LED0_PIN GPIO_PIN(1, 7)
54 #define LED0_MASK (1 << DDB7)
55 #endif
56 
57 #define LED0_ON (PORTB |= LED0_MASK)
58 #define LED0_OFF (PORTB &= ~LED0_MASK)
59 #define LED0_TOGGLE (PORTB ^= LED0_MASK)
60 
66 #define LED_PANIC LED0_ON
67 
73 #define CPU_ATMEGA_CLK_SCALE_INIT CPU_ATMEGA_CLK_SCALE_DIV1
74 
80 #define XTIMER_WIDTH (16)
81 #define XTIMER_HZ (250000UL)
82 #define XTIMER_BACKOFF (40)
83 
88 void board_init(void);
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif /* BOARD_COMMON_H */
95 
Mapping from MCU pins to Arduino pins for Arduino Atmega boards.
void board_init(void)
Initialize board specific hardware, including clock, LEDs and std-IO.