boards/jiminy-mega256rfr2: make use of common/atmega
This commit is contained in:
parent
60a55eb06d
commit
9c18e62364
@ -1,3 +1,5 @@
|
|||||||
MODULE = board
|
MODULE = board
|
||||||
|
|
||||||
|
DIRS = $(RIOTBOARD)/common/atmega
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.base
|
include $(RIOTBASE)/Makefile.base
|
||||||
|
|||||||
1
boards/jiminy-mega256rfr2/Makefile.dep
Normal file
1
boards/jiminy-mega256rfr2/Makefile.dep
Normal file
@ -0,0 +1 @@
|
|||||||
|
USEMODULE += boards_common_atmega
|
||||||
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2016 RWTH Aachen, Josua Arndt
|
* Copyright (C) 2018 Kaspar Schleiser <kaspar@schleiser.de>
|
||||||
|
* 2016 RWTH Aachen, Josua Arndt
|
||||||
*
|
*
|
||||||
* This file is subject to the terms and conditions of the GNU Lesser
|
* 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
|
* General Public License v2.1. See the file LICENSE in the top level
|
||||||
@ -11,70 +12,22 @@
|
|||||||
* @{
|
* @{
|
||||||
*
|
*
|
||||||
* @file
|
* @file
|
||||||
* @brief Board specific implementations for the Jiminy Mega 256rfr2 board
|
* @brief Board specific LED initialization
|
||||||
* developed by the IAS of the RWTH Aachen University
|
|
||||||
*
|
*
|
||||||
* @author Josua Arndt <jarndt@ias.rwth-aachen.de>
|
* @author Josua Arndt <jarndt@ias.rwth-aachen.de>
|
||||||
|
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
||||||
*
|
*
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <avr/io.h>
|
|
||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "uart_stdio.h"
|
|
||||||
|
|
||||||
void SystemInit(void);
|
void led_init(void)
|
||||||
static int uart_putchar(char c, FILE *stream);
|
|
||||||
static int uart_getchar(FILE *stream);
|
|
||||||
|
|
||||||
static FILE uart_stdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE);
|
|
||||||
static FILE uart_stdin = FDEV_SETUP_STREAM(NULL, uart_getchar, _FDEV_SETUP_READ);
|
|
||||||
|
|
||||||
void board_init(void)
|
|
||||||
{
|
{
|
||||||
/* initialize stdio via USART_0 */
|
|
||||||
SystemInit();
|
|
||||||
|
|
||||||
/* initialize the CPU */
|
|
||||||
cpu_init();
|
|
||||||
|
|
||||||
/* initialize the board LED (connected to pin PB7) */
|
/* initialize the board LED (connected to pin PB7) */
|
||||||
/* Ports Pins as Output */
|
/* Ports Pins as Output */
|
||||||
LED_PORT_DDR |= LED2_MASK | LED1_MASK | LED0_MASK;
|
LED_PORT_DDR |= LED2_MASK | LED1_MASK | LED0_MASK;
|
||||||
/* All Pins Low so LEDs are off */
|
/* All Pins Low so LEDs are off */
|
||||||
LED_PORT &= ~(LED2_MASK | LED1_MASK | LED0_MASK);
|
LED_PORT &= ~(LED2_MASK | LED1_MASK | LED0_MASK);
|
||||||
|
|
||||||
irq_enable();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Initialize the System, initialize IO via UART_0*/
|
|
||||||
void SystemInit(void)
|
|
||||||
{
|
|
||||||
/* initialize UART_0 for use as stdout */
|
|
||||||
uart_stdio_init();
|
|
||||||
|
|
||||||
stdout = &uart_stdout;
|
|
||||||
stdin = &uart_stdin;
|
|
||||||
|
|
||||||
/* Flush stdout */
|
|
||||||
puts("\f");
|
|
||||||
}
|
|
||||||
|
|
||||||
static int uart_putchar(char c, FILE *stream)
|
|
||||||
{
|
|
||||||
(void) stream;
|
|
||||||
uart_stdio_write(&c, 1);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int uart_getchar(FILE *stream)
|
|
||||||
{
|
|
||||||
(void) stream;
|
|
||||||
char c;
|
|
||||||
uart_stdio_read(&c, 1);
|
|
||||||
return (int)c;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user