2014-07-15 12:10:14 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2015-02-12 13:34:50 +01:00
|
|
|
* @defgroup boards_arduino-mega2560 Arduino Mega 2560
|
2014-07-15 12:10:14 +02:00
|
|
|
* @ingroup boards
|
|
|
|
* @brief Board specific files for the Arduino Mega 2560 board.
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Board specific definitions for the Arduino Mega 2560 board.
|
|
|
|
*
|
|
|
|
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
|
|
|
|
*/
|
|
|
|
|
2015-04-23 05:00:54 +02:00
|
|
|
#ifndef BOARD_H_
|
|
|
|
#define BOARD_H_
|
2014-07-15 12:10:14 +02:00
|
|
|
|
|
|
|
#include "cpu.h"
|
2015-11-19 13:59:41 +01:00
|
|
|
#include "arduino_pinmap.h"
|
2014-07-15 12:10:14 +02:00
|
|
|
|
2014-10-13 15:25:50 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2014-07-15 12:10:14 +02:00
|
|
|
/**
|
2016-01-05 12:07:48 +01:00
|
|
|
* @brief As the CPU is too slow to handle 115200 baud, we set the default
|
|
|
|
* baudrate to 9600 for this board
|
2014-07-15 12:10:14 +02:00
|
|
|
*/
|
2016-03-09 19:39:34 +01:00
|
|
|
#define UART_STDIO_BAUDRATE (9600U)
|
2014-07-15 12:10:14 +02:00
|
|
|
|
|
|
|
/**
|
2016-03-11 17:57:53 +01:00
|
|
|
* @brief LED pin definitions and handlers
|
2014-07-15 12:10:14 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2016-03-11 17:57:53 +01:00
|
|
|
#define LED0_PIN GPIO_PIN(1, 7)
|
2014-07-15 12:10:14 +02:00
|
|
|
|
2016-03-11 17:57:53 +01:00
|
|
|
#define LED0_MASK (1 << DDB7)
|
2014-07-15 12:10:14 +02:00
|
|
|
|
2016-03-11 17:57:53 +01:00
|
|
|
#define LED0_ON (PORTB |= LED0_MASK)
|
|
|
|
#define LED0_OFF (PORTB &= ~LED0_MASK)
|
|
|
|
#define LED0_TOGGLE (PORTB ^= LED0_MASK)
|
2014-07-15 12:10:14 +02:00
|
|
|
/** @} */
|
|
|
|
|
2016-08-20 15:24:03 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Context swap defines
|
|
|
|
* Setup to use PJ6 which is pin change interrupt 15 (PCINT15)
|
|
|
|
* This emulates a software triggered interrupt
|
|
|
|
**/
|
|
|
|
#define AVR_CONTEXT_SWAP_INIT do { \
|
|
|
|
DDRJ |= (1 << PJ6); \
|
|
|
|
PCICR |= (1 << PCIE1); \
|
|
|
|
PCMSK1 |= (1 << PCINT15); \
|
|
|
|
} while (0)
|
|
|
|
#define AVR_CONTEXT_SWAP_INTERRUPT_VECT PCINT1_vect
|
|
|
|
#define AVR_CONTEXT_SWAP_TRIGGER PORTJ ^= (1 << PJ6)
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-14 00:30:39 +02:00
|
|
|
/**
|
|
|
|
* @brief xtimer configuration values
|
|
|
|
* @{
|
|
|
|
*/
|
2016-05-06 22:10:52 +02:00
|
|
|
#define XTIMER_WIDTH (16)
|
2015-09-14 00:30:39 +02:00
|
|
|
#define XTIMER_SHIFT (2)
|
2016-07-05 21:04:58 +02:00
|
|
|
#define XTIMER_HZ (250000UL)
|
2015-09-14 00:30:39 +02:00
|
|
|
#define XTIMER_BACKOFF (40)
|
|
|
|
/** @} */
|
2014-07-15 12:10:14 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
|
|
|
*/
|
|
|
|
void board_init(void);
|
|
|
|
|
2014-10-13 15:25:50 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2014-07-15 12:10:14 +02:00
|
|
|
|
2015-05-26 22:03:40 +02:00
|
|
|
#endif /* BOARD_H_ */
|
2014-07-15 12:10:14 +02:00
|
|
|
/** @} */
|