board.h
1 /*
2  * Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen
3  * 2016 Laurent Navet <laurent.navet@gmail.com>
4  * 2018 Matthew Blue <matthew.blue.neuro@gmail.com>
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  * @ingroup boards_mega-xplained
13  * @brief Support for the Mega Xplained board.
14  * @{
15  *
16  * @file
17  * @brief Board specific definitions for the Mega Xplained board.
18  *
19  * @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
20  * @author Laurent Navet <laurent.navet@gmail.com>
21  * @author Matthew Blue <matthew.blue.neuro@gmail.com>
22  */
23 
24 #ifndef BOARD_H
25 #define BOARD_H
26 
27 #include "cpu.h"
28 #include "periph_cpu.h"
29 #include "mega-xplained_pinmap.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
42 #ifndef STDIO_UART_BAUDRATE
43 #define STDIO_UART_BAUDRATE (9600U)
44 #endif
45 
50 #define STDIO_UART_DEV (UART_DEV(1))
51 
58 #define XTIMER_DEV (0)
59 #define XTIMER_CHAN (0)
60 #define XTIMER_WIDTH (16)
61 #define XTIMER_HZ (125000UL)
62 #define XTIMER_BACKOFF (40)
63 
69 /* LED0,2 currently unsupported due to lack of GPIO_OD support */
70 #define LED1_PIN GPIO_PIN(PORT_B, 3)
71 #define LED1_MODE GPIO_OUT
72 
73 #define LED3_PIN GPIO_PIN(PORT_B, 2)
74 #define LED3_MODE GPIO_OUT
75 
81 /* LED0,2 currently unsupported due to lack of GPIO_OD support */
82 #define LED1_ENABLE_PORT DDRB |= LED1_PIN
83 #define LED1_ON PORTB |= LED1_PIN
84 #define LED1_OFF PORTB &= ~LED1_PIN
85 #define LED1_TOGGLE PORTB ^= LED1_PIN
86 
87 #define LED3_ENABLE_PORT DDRB |= LED3_PIN
88 #define LED3_ON PORTB |= LED3_PIN
89 #define LED3_OFF PORTB &= ~LED3_PIN
90 #define LED3_TOGGLE PORTB ^= LED3_PIN
91 
97 #define LED_PANIC LED1_ON
98 
104 #define BTN0_PIN GPIO_PIN(PORT_B, 0)
105 #define BTN0_MODE GPIO_IN
106 
107 #define BTN1_PIN GPIO_PIN(PORT_B, 1)
108 #define BTN1_MODE GPIO_IN
109 
110 /* BTN2 currently unsupported due to lack of GPIO_OD support */
111 
116 #define NTC_OUTPUT ADC_LINE(7)
117 #define LIGHT_SENSOR_OUTPUT ADC_LINE(6)
118 #define FILTER_OUTPUT ADC_LINE(5)
119 
125 #define CPU_ATMEGA_CLK_SCALE_INIT CPU_ATMEGA_CLK_SCALE_DIV1
126 
131 void board_init(void);
132 
133 #ifdef __cplusplus
134 }
135 #endif
136 
137 #endif /* BOARD_H */
138 
mega-xplained_pinmap.h
Mapping from MCU pins to Mega Xplained pins.
board_init
void board_init(void)
Board level initialization.