board/weio : Added a new board definition for WeIO (www.we-io.net)

This board use a NXP LPC11U34
dev/timer
Paul Rathgeb 8 years ago
parent 100bd51a64
commit c1a3c729ff

@ -0,0 +1,4 @@
# tell the Makefile.base which module to build
MODULE = $(BOARD)_base
include $(RIOTBASE)/Makefile.base

@ -0,0 +1,5 @@
FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_gpio
FEATURES_MCU_GROUP = cortex_m0

@ -0,0 +1,21 @@
# define the cpu used by the weio board
export CPU = lpc11u34
export FLASHER =
export DEBUGGER =
export DEBUGSERVER =
export OFLAGS = -O binary
export HEXFILE = $(ELFFILE:.elf=.bin)
export FFLAGS =
export DEBUGGER_FLAGS =
# define the default port depending on the host OS
PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(shell ls -1 /dev/tty.SLAB_USBtoUART* | head -n 1)
# setup serial terminal
include $(RIOTBOARD)/Makefile.include.serial
# include cortex defaults
include $(RIOTBOARD)/Makefile.include.cortexm_common

@ -0,0 +1,52 @@
/*
* Copyright (C) 2015 Freie Universität Berlin
*
* 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.
*/
/**
* @ingroup boards_weio
* @{
*
* @file
* @brief Board specific implementations for the WeIO board
*
* @author Paul RATHGEB <paul.rathgeb@skynet.be>
*
* @}
*/
#include "board.h"
static void leds_init(void);
extern void SystemInit(void);
void board_init(void)
{
/* initialize the CPU */
cpu_init();
/* initialize the boards LEDs */
leds_init();
}
/**
* @brief Initialize the boards on-board LEDs (LED1 to LED4)
*
* The LED initialization is hard-coded in this function. As the LEDs are soldered
* onto the board they are fixed to their CPU pins.
*
* The LEDs are connected to the following pins:
* - LED1: P1.13
* - LED2: P1.14
* - LED3: P1.15
*/
static void leds_init(void)
{
/* configure LED pins as output */
LED_PORT->DIR[1] = (LED1_PIN | LED2_PIN | LED3_PIN);
/* clear all LEDs */
LED_PORT->SET[1] = (LED1_PIN | LED2_PIN | LED3_PIN);
}

@ -0,0 +1,89 @@
/*
* Copyright (C) 2015 Freie Universität Berlin
*
* 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.
*/
/**
* @defgroup boards_weio WeIO development kit
* @ingroup boards
* @brief Support for the WeIO board
* @{
*
* @file
* @brief Board specific definitions for the WeIO board
*
* @author Paul RATHGEB <paul.rathgeb@skynet.be>
*/
#ifndef BOARD_H_
#define BOARD_H_
#include <stdint.h>
#include "bitarithm.h"
#include "cpu.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief The nominal CPU core clock in this board
*/
#define F_CPU (48000000)
/**
* @name Assign the UART interface to be used for stdio
* @{
*/
#define STDIO UART_0
#define STDIO_BAUDRATE (115200U)
#define STDIO_RX_BUFSIZE (64U)
/** @} */
/**
* @name LED pin definitions
* @{
*/
#define LED_PORT LPC_GPIO
#define LED1_PIN BIT13
#define LED2_PIN BIT14
#define LED3_PIN BIT15
/** @} */
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED1_ON (LED_PORT->CLR[1] = LED1_PIN)
#define LED1_OFF (LED_PORT->SET[1] = LED1_PIN)
#define LED1_TOGGLE (LED_PORT->NOT[1] = LED1_PIN)
#define LED2_ON (LED_PORT->CLR[1] = LED2_PIN)
#define LED2_OFF (LED_PORT->SET[1] = LED2_PIN)
#define LED2_TOGGLE (LED_PORT->NOT[1] = LED2_PIN)
#define LED3_ON (LED_PORT->CLR[1] = LED3_PIN)
#define LED3_OFF (LED_PORT->SET[1] = LED3_PIN)
#define LED3_TOGGLE (LED_PORT->NOT[1] = LED3_PIN)
/* for compatibility to other boards */
#define LED_GREEN_ON LED2_ON
#define LED_GREEN_OFF LED2_OFF
#define LED_GREEN_TOGGLE LED2_TOGGLE
#define LED_RED_ON LED1_ON
#define LED_RED_OFF LED1_OFF
#define LED_RED_TOGGLE LED1_TOGGLE
/** @} */
/**
* @brief Initialize board specific hardware, include clocks, LEDs and stdio
*/
void board_init(void);
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H_ */
/** @} */

@ -0,0 +1,214 @@
/*
* Copyright (C) 2014 Freie Universität Berlin
*
* 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.
*/
/**
* @ingroup boards_weio
* @{
*
* @file
* @brief Peripheral MCU configuration for the WeIO board
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* @author Paul RATHGEB <paul.rathgeb@skynet.be>
*/
#ifndef PERIPH_CONF_H_
#define PERIPH_CONF_H_
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Timer configuration
* @{
*/
#define TIMER_NUMOF (1U)
#define TIMER_0_EN 1
#define TIMER_IRQ_PRIO 1
/* Timer 0 configuration */
#define TIMER_0_DEV LPC_CT32B0
#define TIMER_0_CHANNELS 4
#define TIMER_0_PRESCALER (48U)
#define TIMER_0_MAX_VALUE (0xffffffff)
#define TIMER_0_CLKEN() (LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 9))
#define TIMER_0_CLKDIS() (LPC_SYSCON->SYSAHBCLKCTRL &= ~(1 << 9))
#define TIMER_0_ISR isr_ct32b0
#define TIMER_0_IRQ TIMER_32_0_IRQn
/** @} */
/**
* @brief UART configuration
* @{
*/
#define UART_NUMOF (1U)
#define UART_0_EN 1
#define UART_IRQ_PRIO 2
/* UART 0 device configuration */
#define UART_0_DEV LPC_USART
#define UART_0_CLKSEL() (LPC_SYSCON->UARTCLKDIV = (1)) /* PCLK := CCLK / 1 */
#define UART_0_CLKEN() (LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 12))
#define UART_0_CLKDIS() (LPC_SYSCON->SYSAHBCLKCTRL &= ~(1 << 12))
#define UART_0_IRQ UART_IRQn
#define UART_0_ISR isr_usart0
/* UART 0 pin configuration */
#define UART_0_TX_PINSEL (LPC_IOCON->PIO0_19)
#define UART_0_RX_PINSEL (LPC_IOCON->PIO0_18)
#define UART_0_TX_PINMODE (LPC_IOCON->PIO0_19)
#define UART_0_RX_PINMODE (LPC_IOCON->PIO0_18)
#define UART_0_TX_PIN (1)
#define UART_0_RX_PIN (2)
#define UART_0_AF (1)
/* @} */
/**
* * @name GPIO configuration
* * @{
*/
#define GPIO_0_EN 1
#define GPIO_1_EN 1
#define GPIO_2_EN 1
#define GPIO_3_EN 1
#define GPIO_4_EN 1
#define GPIO_5_EN 1
#define GPIO_6_EN 1
#define GPIO_7_EN 1
#define GPIO_8_EN 1
#define GPIO_9_EN 1
#define GPIO_10_EN 1
#define GPIO_11_EN 1
#define GPIO_12_EN 1
#define GPIO_13_EN 1
#define GPIO_14_EN 1
#define GPIO_15_EN 1
#define GPIO_16_EN 1
#define GPIO_17_EN 1
#define GPIO_18_EN 1
#define GPIO_19_EN 1
#define GPIO_20_EN 1
#define GPIO_21_EN 1
#define GPIO_22_EN 1
#define GPIO_23_EN 1
#define GPIO_24_EN 1
#define GPIO_25_EN 1
#define GPIO_26_EN 1
#define GPIO_27_EN 1
#define GPIO_28_EN 1
#define GPIO_29_EN 1
#define GPIO_30_EN 1
#define GPIO_31_EN 1
/* WeIO Pin 0 : LPC GPIO0_18 */
#define GPIO_0_PORT 0
#define GPIO_0_PIN 18
/* WeIO Pin 1 : LPC GPIO0_19 */
#define GPIO_1_PORT 0
#define GPIO_1_PIN 19
/* WeIO Pin 2 : LPC GPIO0_9 */
#define GPIO_2_PORT 0
#define GPIO_2_PIN 9
/* WeIO Pin 3 : LPC GPIO0_8 */
#define GPIO_3_PORT 0
#define GPIO_3_PIN 8
/* WeIO Pin 4 : LPC GPIO0_10 */
#define GPIO_4_PORT 0
#define GPIO_4_PIN 10
/* WeIO Pin 5 : LPC GPIO0_2 */
#define GPIO_5_PORT 0
#define GPIO_5_PIN 2
/* WeIO Pin 6 : LPC GPIO0_7 */
#define GPIO_6_PORT 0
#define GPIO_6_PIN 7
/* WeIO Pin 7 : LPC GPIO0_17 */
#define GPIO_7_PORT 0
#define GPIO_7_PIN 17
/* WeIO Pin 8 : LPC GPIO0_21 */
#define GPIO_8_PORT 0
#define GPIO_8_PIN 21
/* WeIO Pin 9 : LPC GPIO1_21 */
#define GPIO_9_PORT 1
#define GPIO_9_PIN 21
/* WeIO Pin 10 : LPC GPIO1_20 */
#define GPIO_10_PORT 1
#define GPIO_10_PIN 20
/* WeIO Pin 11 : LPC GPIO0_20 */
#define GPIO_11_PORT 0
#define GPIO_11_PIN 20
/* WeIO Pin 12 : LPC GPIO1_16 */
#define GPIO_12_PORT 1
#define GPIO_12_PIN 16
/* WeIO Pin 13 : LPC GPIO1_19 */
#define GPIO_13_PORT 1
#define GPIO_13_PIN 19
/* WeIO Pin 14 : LPC GPIO1_22 */
#define GPIO_14_PORT 1
#define GPIO_14_PIN 22
/* WeIO Pin 15 : LPC GPIO1_23 */
#define GPIO_15_PORT 1
#define GPIO_15_PIN 23
/* WeIO Pin 16 : LPC GPIO1_27 */
#define GPIO_16_PORT 1
#define GPIO_16_PIN 27
/* WeIO Pin 17 : LPC GPIO1_28 */
#define GPIO_17_PORT 1
#define GPIO_17_PIN 28
/* WeIO Pin 18 : LPC GPIO1_13 */
#define GPIO_18_PORT 1
#define GPIO_18_PIN 13
/* WeIO Pin 19 : LPC GPIO1_14 */
#define GPIO_19_PORT 1
#define GPIO_19_PIN 14
/* WeIO Pin 20 : LPC GPIO1_15 */
#define GPIO_20_PORT 1
#define GPIO_20_PIN 15
/* WeIO Pin 21 : LPC GPIO1_24 */
#define GPIO_21_PORT 1
#define GPIO_21_PIN 24
/* WeIO Pin 22 : LPC GPIO1_25 */
#define GPIO_22_PORT 1
#define GPIO_22_PIN 25
/* WeIO Pin 23 : LPC GPIO1_26 */
#define GPIO_23_PORT 1
#define GPIO_23_PIN 26
/* WeIO Pin 24 : LPC GPIO0_11 */
#define GPIO_24_PORT 0
#define GPIO_24_PIN 11
/* WeIO Pin 25 : LPC GPIO0_12 */
#define GPIO_25_PORT 0
#define GPIO_25_PIN 12
/* WeIO Pin 26 : LPC GPIO0_13 */
#define GPIO_26_PORT 0
#define GPIO_26_PIN 13
/* WeIO Pin 27 : LPC GPIO0_14 */
#define GPIO_27_PORT 0
#define GPIO_27_PIN 14
/* WeIO Pin 28 : LPC GPIO0_15 */
#define GPIO_28_PORT 0
#define GPIO_28_PIN 15
/* WeIO Pin 29 : LPC GPIO0_16 */
#define GPIO_29_PORT 0
#define GPIO_29_PIN 16
/* WeIO Pin 30 : LPC GPIO0_22 */
#define GPIO_30_PORT 0
#define GPIO_30_PIN 22
/* WeIO Pin 31 : LPC GPIO0_23 */
#define GPIO_31_PORT 0
#define GPIO_31_PIN 23
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* PERIPH_CONF_H_ */
/** @} */
Loading…
Cancel
Save