Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
board_common.h
1
/*
2
* Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen
3
* 2016 Laurent Navet <laurent.navet@gmail.com>
4
* 2017 Thomas Perrot <thomas.perrot@tupi.fr>
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
11
/*
12
* @defgroup boards_common_arduino-atmega Arduino Atmega Common
13
* @ingroup boards_common
14
* @brief Shared files and configuration for Arduino Atmega boards.
15
* @{
16
*
17
* @file
18
* @brief Common board configuration for Arduino Atmega boards
19
*
20
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
21
* @author Laurent Navet <laurent.navet@gmail.com>
22
* @author Thomas Perrot <thomas.perrot@tupi.fr>
23
*/
24
25
#ifndef BOARD_COMMON_H
26
#define BOARD_COMMON_H
27
28
#include "cpu.h"
29
#include "
arduino_pinmap.h
"
30
31
#ifdef __cplusplus
32
extern
"C"
{
33
#endif
34
42
#define STDIO_UART_BAUDRATE (9600U)
43
49
#ifdef CPU_ATMEGA328P
50
#define LED0_PIN GPIO_PIN(1, 5)
51
#define LED0_MASK (1 << DDB5)
52
#endif
53
54
#ifdef CPU_ATMEGA32U4
55
#define LED0_PIN GPIO_PIN(2, 7)
56
#define LED0_MASK (1 << DDC7)
57
#define LED1_PIN GPIO_PIN(1, 0)
58
#define LED1_MASK (1 << DDB0)
59
#define LED2_PIN GPIO_PIN(3, 5)
60
#define LED2_MASK (1 << DDD5)
61
#endif
62
63
#ifdef CPU_ATMEGA2560
64
#define LED0_PIN GPIO_PIN(1, 7)
65
#define LED0_MASK (1 << DDB7)
66
#endif
67
68
#ifdef CPU_ATMEGA32U4
69
#define LED0_ON (PORTC |= LED0_MASK)
70
#define LED0_OFF (PORTC &= ~LED0_MASK)
71
#define LED0_TOGGLE (PORTC ^= LED0_MASK)
72
#define LED1_OFF (PORTB |= LED1_MASK)
73
#define LED1_ON (PORTB &= ~LED1_MASK)
74
#define LED1_TOGGLE (PORTB ^= LED1_MASK)
75
#define LED2_OFF (PORTD |= LED2_MASK)
76
#define LED2_ON (PORTD &= ~LED2_MASK)
77
#define LED2_TOGGLE (PORTD ^= LED2_MASK)
78
#else
79
#define LED0_ON (PORTD |= LED0_MASK)
80
#define LED0_OFF (PORTD &= ~LED0_MASK)
81
#define LED0_TOGGLE (PORTD ^= LED0_MASK)
82
#endif
83
89
#define LED_PANIC LED0_ON
90
96
#define CPU_ATMEGA_CLK_SCALE_INIT CPU_ATMEGA_CLK_SCALE_DIV1
97
103
#define XTIMER_WIDTH (16)
104
#define XTIMER_HZ (250000UL)
105
#define XTIMER_BACKOFF (40)
106
112
#define CONFIG_ZTIMER_USEC_TYPE ZTIMER_TYPE_PERIPH_TIMER
113
#define CONFIG_ZTIMER_USEC_DEV (TIMER_DEV(0))
114
#define CONFIG_ZTIMER_USEC_FREQ (250000LU)
115
#define CONFIG_ZTIMER_USEC_WIDTH (16)
116
122
#ifndef W5100_PARAM_CS
123
#define W5100_PARAM_CS (ARDUINO_PIN_10)
124
#endif
125
#ifndef W5100_PARAM_EVT
126
#define W5100_PARAM_EVT (ARDUINO_PIN_2)
127
#endif
128
133
void
board_init
(
void
);
134
135
#ifdef __cplusplus
136
}
137
#endif
138
139
#endif
/* BOARD_COMMON_H */
140
arduino_pinmap.h
Mapping from MCU pins to Arduino pins for Arduino Atmega boards.
board_init
void board_init(void)
Initialize board specific hardware, including clock, LEDs and std-IO.
Generated on Tue Nov 24 2020 19:46:49 by
1.8.17