mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 14:33:52 +01:00
boards/waspmote-pro: make use of common stdio init code
This commit is contained in:
parent
391cc83881
commit
64791d0c82
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen
|
||||
* 2015 Kaspar Schleiser <kaspar@schleiser.de>
|
||||
* 2015-18 Kaspar Schleiser <kaspar@schleiser.de>
|
||||
* 2016 INRIA, Francisco Acosta
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
@ -13,7 +13,7 @@
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific implementations for the Waspmote PRO v1.2 board
|
||||
* @brief Board specific initializations
|
||||
*
|
||||
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
|
||||
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
||||
@ -22,48 +22,8 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "cpu.h"
|
||||
#include "uart_stdio.h"
|
||||
|
||||
void led_init(void);
|
||||
void SystemInit(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 UART_1 on AUX1 */
|
||||
SET_MUX_AUX1_MODULE;
|
||||
|
||||
#ifdef XBEE_UART
|
||||
#if XBEE_UART == 0
|
||||
/* initialize UART0 on SOCKET0 (XBee) */
|
||||
SET_MUX_SOCKET0;
|
||||
#else
|
||||
/* Initialize UART0 on USB */
|
||||
SET_MUX_USB_MODULE;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* initialize stdio via UART_STDIO_DEV */
|
||||
SystemInit();
|
||||
|
||||
/* initialize the CPU */
|
||||
cpu_init();
|
||||
|
||||
/* initialize the boards LEDs */
|
||||
led_init();
|
||||
|
||||
irq_enable();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Initialize the boards on-board LEDs (green and red)
|
||||
@ -83,32 +43,23 @@ void led_init(void)
|
||||
LED_RED_ON;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize the System, initialize IO via UART_0
|
||||
*/
|
||||
void SystemInit(void)
|
||||
void board_init(void)
|
||||
{
|
||||
/* initialize UART_0 for use as stdout */
|
||||
uart_stdio_init();
|
||||
/* initialize UART_1 on AUX1 */
|
||||
SET_MUX_AUX1_MODULE;
|
||||
|
||||
stdout = &uart_stdout;
|
||||
stdin = &uart_stdin;
|
||||
#ifdef XBEE_UART
|
||||
#if XBEE_UART == 0
|
||||
/* initialize UART0 on SOCKET0 (XBee) */
|
||||
SET_MUX_SOCKET0;
|
||||
#else
|
||||
/* Initialize UART0 on USB */
|
||||
SET_MUX_USB_MODULE;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* 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;
|
||||
atmega_stdio_init();
|
||||
cpu_init();
|
||||
led_init();
|
||||
irq_enable();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user