diff --git a/boards/arduino-common/Makefile b/boards/arduino-atmega-common/Makefile similarity index 53% rename from boards/arduino-common/Makefile rename to boards/arduino-atmega-common/Makefile index 233ad5878b..b2ec734f93 100644 --- a/boards/arduino-common/Makefile +++ b/boards/arduino-atmega-common/Makefile @@ -1,3 +1,3 @@ -MODULE = arduino-common +MODULE = arduino-atmega-common include $(RIOTBASE)/Makefile.base diff --git a/boards/arduino-common/Makefile.dep b/boards/arduino-atmega-common/Makefile.dep similarity index 100% rename from boards/arduino-common/Makefile.dep rename to boards/arduino-atmega-common/Makefile.dep diff --git a/boards/arduino-common/Makefile.features b/boards/arduino-atmega-common/Makefile.features similarity index 100% rename from boards/arduino-common/Makefile.features rename to boards/arduino-atmega-common/Makefile.features diff --git a/boards/arduino-atmega-common/Makefile.include b/boards/arduino-atmega-common/Makefile.include new file mode 100644 index 0000000000..2721a0cbc1 --- /dev/null +++ b/boards/arduino-atmega-common/Makefile.include @@ -0,0 +1,29 @@ +# include optional dependencies +include $(RIOTBOARD)/arduino-atmega-common/Makefile.dep + +# define port used to flash the board +OS = $(shell uname) +ifeq ($(OS),Linux) + PORT = $(LINUX_PORT) +else ifeq ($(OS),Darwin) + PORT ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) +else + $(info CAUTION: No flash tool for your host system found!) + # TODO: fix for building under windows +endif + +export TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm +export TERMFLAGS ?= -b 9600 -p $(PORT) +export FLASHER = avrdude +export PORT +export DIST_PATH = $(RIOTBOARD)/$(BOARD)/dist +export DEBUGSERVER_PORT = 4242 +export DEBUGSERVER = $(DIST_PATH)/debug_srv.sh +export DEBUGSERVER_FLAGS = "-g -j usb :$(DEBUGSERVER_PORT)" +export DEBUGGER_FLAGS = "-x $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE)" +export DEBUGGER = $(DIST_PATH)/debug.sh $(DEBUGSERVER_FLAGS) $(DIST_PATH) $(DEBUGSERVER_PORT) + +export PROGRAMMER_FLAGS = -P $(PORT) -b $(PROGRAMMER_SPEED) + +export OFLAGS += -j .text -j .data -O ihex +export FFLAGS += -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -F -D -U flash:w:bin/$(BOARD)/$(PROJECT)$(APPLICATION).hex diff --git a/boards/arduino-common/board.c b/boards/arduino-atmega-common/board.c similarity index 91% rename from boards/arduino-common/board.c rename to boards/arduino-atmega-common/board.c index abca37ac28..0442c112f8 100644 --- a/boards/arduino-common/board.c +++ b/boards/arduino-atmega-common/board.c @@ -9,7 +9,7 @@ */ /** - * @ingroup boards_arduino-common + * @ingroup boards_arduino-atmega-common * @{ * * @file @@ -29,6 +29,7 @@ #include "board.h" #include "cpu.h" #include "uart_stdio.h" +#include "periph/gpio.h" void led_init(void); void SystemInit(void); @@ -46,9 +47,9 @@ void board_init(void) /* initialize the CPU */ cpu_init(); - /* initialize the board LED (connected to pin PB5) */ - DDRB |= (1 << DDB5); - PORTB &= ~(1 << 5); + /* initialize the board LED */ + gpio_init(LED0_PIN, GPIO_OUT); + LED0_OFF; irq_enable(); } diff --git a/boards/arduino-common/dist/debug.sh b/boards/arduino-atmega-common/dist/debug.sh old mode 100755 new mode 100644 similarity index 100% rename from boards/arduino-common/dist/debug.sh rename to boards/arduino-atmega-common/dist/debug.sh diff --git a/boards/arduino-common/dist/debug_srv.sh b/boards/arduino-atmega-common/dist/debug_srv.sh old mode 100755 new mode 100644 similarity index 100% rename from boards/arduino-common/dist/debug_srv.sh rename to boards/arduino-atmega-common/dist/debug_srv.sh diff --git a/boards/arduino-common/dist/gdb.conf b/boards/arduino-atmega-common/dist/gdb.conf similarity index 100% rename from boards/arduino-common/dist/gdb.conf rename to boards/arduino-atmega-common/dist/gdb.conf diff --git a/boards/arduino-common/include/arduino_board.h b/boards/arduino-atmega-common/include/arduino_board.h similarity index 52% rename from boards/arduino-common/include/arduino_board.h rename to boards/arduino-atmega-common/include/arduino_board.h index e589511d36..f05d312589 100644 --- a/boards/arduino-common/include/arduino_board.h +++ b/boards/arduino-atmega-common/include/arduino_board.h @@ -7,7 +7,7 @@ */ /** - * @ingroup boards_arduino-common + * @ingroup boards_arduino-atmega-common * @{ * * @file @@ -54,7 +54,59 @@ static const gpio_t arduino_pinmap[] = { ARDUINO_PIN_16, ARDUINO_PIN_17, ARDUINO_PIN_18, - ARDUINO_PIN_19 + ARDUINO_PIN_19, +#ifdef CPU_ATMEGA2560 + ARDUINO_PIN_20, + ARDUINO_PIN_21, + ARDUINO_PIN_22, + ARDUINO_PIN_23, + ARDUINO_PIN_24, + ARDUINO_PIN_25, + ARDUINO_PIN_26, + ARDUINO_PIN_27, + ARDUINO_PIN_28, + ARDUINO_PIN_29, + ARDUINO_PIN_30, + ARDUINO_PIN_31, + ARDUINO_PIN_32, + ARDUINO_PIN_33, + ARDUINO_PIN_34, + ARDUINO_PIN_35, + ARDUINO_PIN_36, + ARDUINO_PIN_37, + ARDUINO_PIN_38, + ARDUINO_PIN_39, + ARDUINO_PIN_40, + ARDUINO_PIN_41, + ARDUINO_PIN_42, + ARDUINO_PIN_43, + ARDUINO_PIN_44, + ARDUINO_PIN_45, + ARDUINO_PIN_46, + ARDUINO_PIN_47, + ARDUINO_PIN_48, + ARDUINO_PIN_49, + ARDUINO_PIN_50, + ARDUINO_PIN_51, + ARDUINO_PIN_52, + ARDUINO_PIN_53, + ARDUINO_PIN_54, + ARDUINO_PIN_55, + ARDUINO_PIN_56, + ARDUINO_PIN_57, + ARDUINO_PIN_58, + ARDUINO_PIN_59, + ARDUINO_PIN_60, + ARDUINO_PIN_61, + ARDUINO_PIN_62, + ARDUINO_PIN_63, + ARDUINO_PIN_64, + ARDUINO_PIN_65, + ARDUINO_PIN_66, + ARDUINO_PIN_67, + ARDUINO_PIN_68, + ARDUINO_PIN_69 +#endif }; #ifdef __cplusplus diff --git a/boards/arduino-atmega-common/include/arduino_pinmap.h b/boards/arduino-atmega-common/include/arduino_pinmap.h new file mode 100644 index 0000000000..30fc88c1cb --- /dev/null +++ b/boards/arduino-atmega-common/include/arduino_pinmap.h @@ -0,0 +1,166 @@ +/* + * Copyright (C) 2015 Freie Universität Berlin + * 2016 Laurent Navet + * + * 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_arduino-atmega-common + * @{ + * + * @file + * @brief Mapping from MCU pins to Arduino pins + * + * You can use the defines in this file for simplified interaction with the + * Arduino specific pin numbers. + * + * @author Hauke Petersen + * @author Daniel Nordahl + * @author Laurent Navet + */ + +#ifndef ARDUINO_PINMAP_H +#define ARDUINO_PINMAP_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Mapping of MCU pins to Arduino pins + * + * @note ISCP pins are not mapped. + */ + +/* Digital pins */ +#ifdef CPU_ATMEGA328P +#define ARDUINO_PIN_0 GPIO_PIN(PORT_D, 0) +#define ARDUINO_PIN_1 GPIO_PIN(PORT_D, 1) +#define ARDUINO_PIN_2 GPIO_PIN(PORT_D, 2) +#define ARDUINO_PIN_3 GPIO_PIN(PORT_D, 3) +#define ARDUINO_PIN_4 GPIO_PIN(PORT_D, 4) +#define ARDUINO_PIN_5 GPIO_PIN(PORT_D, 5) +#define ARDUINO_PIN_6 GPIO_PIN(PORT_D, 6) +#define ARDUINO_PIN_7 GPIO_PIN(PORT_D, 7) +#define ARDUINO_PIN_8 GPIO_PIN(PORT_B, 0) +#define ARDUINO_PIN_9 GPIO_PIN(PORT_B, 1) +#define ARDUINO_PIN_10 GPIO_PIN(PORT_B, 2) +#define ARDUINO_PIN_11 GPIO_PIN(PORT_B, 3) +#define ARDUINO_PIN_12 GPIO_PIN(PORT_B, 4) +#define ARDUINO_PIN_13 GPIO_PIN(PORT_B, 5) +/* Analog pins */ +#define ARDUINO_PIN_14 GPIO_PIN(PORT_C, 0) +#define ARDUINO_PIN_15 GPIO_PIN(PORT_C, 1) +#define ARDUINO_PIN_16 GPIO_PIN(PORT_C, 2) +#define ARDUINO_PIN_17 GPIO_PIN(PORT_C, 3) +#define ARDUINO_PIN_18 GPIO_PIN(PORT_C, 4) +#define ARDUINO_PIN_19 GPIO_PIN(PORT_C, 5) +/* Analog input */ +#define ARDUINO_PIN_A0 ARDUINO_PIN_14 +#define ARDUINO_PIN_A1 ARDUINO_PIN_15 +#define ARDUINO_PIN_A2 ARDUINO_PIN_16 +#define ARDUINO_PIN_A3 ARDUINO_PIN_17 +#define ARDUINO_PIN_A4 ARDUINO_PIN_18 +#define ARDUINO_PIN_A5 ARDUINO_PIN_19 +#endif + +#ifdef CPU_ATMEGA2560 +#define ARDUINO_PIN_0 GPIO_PIN(PORT_E, 0) +#define ARDUINO_PIN_1 GPIO_PIN(PORT_E, 1) +#define ARDUINO_PIN_2 GPIO_PIN(PORT_E, 4) +#define ARDUINO_PIN_3 GPIO_PIN(PORT_E, 5) +#define ARDUINO_PIN_4 GPIO_PIN(PORT_G, 5) +#define ARDUINO_PIN_5 GPIO_PIN(PORT_E, 3) +#define ARDUINO_PIN_6 GPIO_PIN(PORT_H, 3) +#define ARDUINO_PIN_7 GPIO_PIN(PORT_H, 4) +#define ARDUINO_PIN_8 GPIO_PIN(PORT_H, 5) +#define ARDUINO_PIN_9 GPIO_PIN(PORT_H, 6) +#define ARDUINO_PIN_10 GPIO_PIN(PORT_B, 4) +#define ARDUINO_PIN_11 GPIO_PIN(PORT_B, 5) +#define ARDUINO_PIN_12 GPIO_PIN(PORT_B, 6) +#define ARDUINO_PIN_13 GPIO_PIN(PORT_B, 7) +#define ARDUINO_PIN_14 GPIO_PIN(PORT_J, 1) +#define ARDUINO_PIN_15 GPIO_PIN(PORT_J, 0) +#define ARDUINO_PIN_16 GPIO_PIN(PORT_H, 1) +#define ARDUINO_PIN_17 GPIO_PIN(PORT_H, 0) +#define ARDUINO_PIN_18 GPIO_PIN(PORT_D, 3) +#define ARDUINO_PIN_19 GPIO_PIN(PORT_D, 2) +#define ARDUINO_PIN_20 GPIO_PIN(PORT_D, 1) +#define ARDUINO_PIN_21 GPIO_PIN(PORT_D, 0) +#define ARDUINO_PIN_22 GPIO_PIN(PORT_A, 0) +#define ARDUINO_PIN_23 GPIO_PIN(PORT_A, 1) +#define ARDUINO_PIN_24 GPIO_PIN(PORT_A, 2) +#define ARDUINO_PIN_25 GPIO_PIN(PORT_A, 3) +#define ARDUINO_PIN_26 GPIO_PIN(PORT_A, 4) +#define ARDUINO_PIN_27 GPIO_PIN(PORT_A, 5) +#define ARDUINO_PIN_28 GPIO_PIN(PORT_A, 6) +#define ARDUINO_PIN_29 GPIO_PIN(PORT_A, 7) +#define ARDUINO_PIN_30 GPIO_PIN(PORT_C, 7) +#define ARDUINO_PIN_31 GPIO_PIN(PORT_C, 6) +#define ARDUINO_PIN_32 GPIO_PIN(PORT_C, 5) +#define ARDUINO_PIN_33 GPIO_PIN(PORT_C, 4) +#define ARDUINO_PIN_34 GPIO_PIN(PORT_C, 3) +#define ARDUINO_PIN_35 GPIO_PIN(PORT_C, 2) +#define ARDUINO_PIN_36 GPIO_PIN(PORT_C, 1) +#define ARDUINO_PIN_37 GPIO_PIN(PORT_E, 0) +#define ARDUINO_PIN_38 GPIO_PIN(PORT_D, 7) +#define ARDUINO_PIN_39 GPIO_PIN(PORT_G, 2) +#define ARDUINO_PIN_40 GPIO_PIN(PORT_G, 1) +#define ARDUINO_PIN_41 GPIO_PIN(PORT_G, 0) +#define ARDUINO_PIN_42 GPIO_PIN(PORT_L, 7) +#define ARDUINO_PIN_43 GPIO_PIN(PORT_L, 6) +#define ARDUINO_PIN_44 GPIO_PIN(PORT_L, 5) +#define ARDUINO_PIN_45 GPIO_PIN(PORT_L, 4) +#define ARDUINO_PIN_46 GPIO_PIN(PORT_L, 3) +#define ARDUINO_PIN_47 GPIO_PIN(PORT_L, 2) +#define ARDUINO_PIN_48 GPIO_PIN(PORT_L, 1) +#define ARDUINO_PIN_49 GPIO_PIN(PORT_L, 0) +#define ARDUINO_PIN_50 GPIO_PIN(PORT_B, 3) +#define ARDUINO_PIN_51 GPIO_PIN(PORT_B, 2) +#define ARDUINO_PIN_52 GPIO_PIN(PORT_B, 1) +#define ARDUINO_PIN_53 GPIO_PIN(PORT_B, 0) +#define ARDUINO_PIN_54 GPIO_PIN(PORT_F, 0) +#define ARDUINO_PIN_55 GPIO_PIN(PORT_F, 1) +#define ARDUINO_PIN_56 GPIO_PIN(PORT_F, 2) +#define ARDUINO_PIN_57 GPIO_PIN(PORT_F, 3) +#define ARDUINO_PIN_58 GPIO_PIN(PORT_F, 4) +#define ARDUINO_PIN_59 GPIO_PIN(PORT_F, 5) +#define ARDUINO_PIN_60 GPIO_PIN(PORT_F, 6) +#define ARDUINO_PIN_61 GPIO_PIN(PORT_F, 7) +#define ARDUINO_PIN_62 GPIO_PIN(PORT_K, 0) +#define ARDUINO_PIN_63 GPIO_PIN(PORT_K, 1) +#define ARDUINO_PIN_64 GPIO_PIN(PORT_K, 2) +#define ARDUINO_PIN_65 GPIO_PIN(PORT_K, 3) +#define ARDUINO_PIN_66 GPIO_PIN(PORT_K, 4) +#define ARDUINO_PIN_67 GPIO_PIN(PORT_K, 5) +#define ARDUINO_PIN_68 GPIO_PIN(PORT_K, 6) +#define ARDUINO_PIN_69 GPIO_PIN(PORT_K, 7) +#define ARDUINO_PIN_A0 ARDUINO_PIN_54 +#define ARDUINO_PIN_A1 ARDUINO_PIN_55 +#define ARDUINO_PIN_A2 ARDUINO_PIN_56 +#define ARDUINO_PIN_A3 ARDUINO_PIN_57 +#define ARDUINO_PIN_A4 ARDUINO_PIN_58 +#define ARDUINO_PIN_A5 ARDUINO_PIN_59 +#define ARDUINO_PIN_A6 ARDUINO_PIN_60 +#define ARDUINO_PIN_A7 ARDUINO_PIN_61 +#define ARDUINO_PIN_A8 ARDUINO_PIN_62 +#define ARDUINO_PIN_A9 ARDUINO_PIN_63 +#define ARDUINO_PIN_A10 ARDUINO_PIN_64 +#define ARDUINO_PIN_A11 ARDUINO_PIN_65 +#define ARDUINO_PIN_A12 ARDUINO_PIN_66 +#define ARDUINO_PIN_A13 ARDUINO_PIN_67 +#define ARDUINO_PIN_A14 ARDUINO_PIN_68 +#define ARDUINO_PIN_A15 ARDUINO_PIN_69 +#endif + +/** @ */ + +#ifdef __cplusplus +} +#endif + +#endif /* ARDUINO_PINMAP_H */ +/** @} */ diff --git a/boards/arduino-common/include/board.h b/boards/arduino-atmega-common/include/board.h similarity index 80% rename from boards/arduino-common/include/board.h rename to boards/arduino-atmega-common/include/board.h index 72f7fa933a..256e732d4a 100644 --- a/boards/arduino-common/include/board.h +++ b/boards/arduino-atmega-common/include/board.h @@ -8,7 +8,7 @@ */ /** - * @defgroup boards_arduino-common Arduino common + * @defgroup boards_arduino-atmega-common Arduino common * @ingroup boards * @brief Board specific files for the arduino Uno and * @brief Duemilanove boards. @@ -44,9 +44,15 @@ extern "C" { * @brief LED pin definitions and handlers * @{ */ +#ifdef CPU_ATMEGA328P #define LED0_PIN GPIO_PIN(1, 5) - #define LED0_MASK (1 << DDB5) +#endif + +#ifdef CPU_ATMEGA2560 +#define LED0_PIN GPIO_PIN(1, 7) +#define LED0_MASK (1 << DDB7) +#endif #define LED0_ON (PORTB |= LED0_MASK) #define LED0_OFF (PORTB &= ~LED0_MASK) @@ -58,6 +64,7 @@ extern "C" { ** Setup to use PC5 which is pin change interrupt 13 (PCINT13) ** This emulates a software triggered interrupt ***/ +#ifdef CPU_ATMEGA328P #define AVR_CONTEXT_SWAP_INIT do { \ DDRC |= (1 << PC5); \ PCICR |= (1 << PCIE1); \ @@ -65,7 +72,17 @@ extern "C" { } while (0) #define AVR_CONTEXT_SWAP_INTERRUPT_VECT PCINT1_vect #define AVR_CONTEXT_SWAP_TRIGGER PORTC ^= (1 << PC5) +#endif +#ifdef CPU_ATMEGA2560 +#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) +#endif /** * @brief xtimer configuration values diff --git a/boards/arduino-common/include/gpio_params.h b/boards/arduino-atmega-common/include/gpio_params.h similarity index 94% rename from boards/arduino-common/include/gpio_params.h rename to boards/arduino-atmega-common/include/gpio_params.h index bb502a0c2e..6f61915ff4 100644 --- a/boards/arduino-common/include/gpio_params.h +++ b/boards/arduino-atmega-common/include/gpio_params.h @@ -7,7 +7,7 @@ */ /** - * @ingroup boards_arduino-common + * @ingroup boards_arduino-atmega-common * @{ * * @file diff --git a/boards/arduino-atmega-common/include/periph_conf.h b/boards/arduino-atmega-common/include/periph_conf.h new file mode 100644 index 0000000000..a485208392 --- /dev/null +++ b/boards/arduino-atmega-common/include/periph_conf.h @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen + * 2016 Laurent Navet + * + * 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_arduino-atmega-common + * @{ + * + * @file + * @brief Peripheral MCU configuration for the arduino Uno and + * @brief Dumilanove boards. + * + * @author Hinnerk van Bruinehsen + * @author Laurent Navet + * @author Hauke Petersen + */ + +#ifndef PERIPH_CONF_H +#define PERIPH_CONF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Clock configuration + * @{ + */ +#define CLOCK_CORECLOCK (16000000L) +/** @} */ + +/** + * @name Timer configuration + * + * arduino uno and arduino duemilanove: + * The timer driver only supports the 16-bit timer (Timer1) + * so this is the only one we can use here. + * + * arduino mega2560: + * The timer driver only supports the four 16-bit timers (Timer1, Timer3, + * Timer4, Timer5), so those are the only onces we can use here. + * + * @{ + */ +#ifdef CPU_ATMEGA328P +#define TIMER_NUMOF (2U) + +#define TIMER_0 MEGA_TIMER1 +#define TIMER_0_MASK &TIMSK1 +#define TIMER_0_FLAG &TIFR1 +#define TIMER_0_ISRA TIMER1_COMPA_vect +#define TIMER_0_ISRB TIMER1_COMPB_vect +#endif + +#ifdef CPU_ATMEGA2560 +#define TIMER_NUMOF (2U) + +#define TIMER_0 MEGA_TIMER1 +#define TIMER_0_MASK &TIMSK1 +#define TIMER_0_FLAG &TIFR1 +#define TIMER_0_ISRA TIMER1_COMPA_vect +#define TIMER_0_ISRB TIMER1_COMPB_vect +#define TIMER_0_ISRC TIMER1_COMPC_vect + +#define TIMER_1 MEGA_TIMER4 +#define TIMER_1_MASK &TIMSK4 +#define TIMER_1_FLAG &TIFR4 +#define TIMER_1_ISRA TIMER4_COMPA_vect +#define TIMER_1_ISRB TIMER4_COMPB_vect +#define TIMER_1_ISRC TIMER4_COMPC_vect +#endif + + +/** @} */ + +/** + * @name UART configuration + * + * The UART devices have fixed pin mappings, so all we need to do, is to specify + * which devices we would like to use and their corresponding RX interrupts. See + * the reference manual for the fixed pin mapping. + * + * @{ + */ +#ifdef CPU_ATMEGA328P +#define UART_NUMOF (1U) + +#define UART_0 MEGA_UART0 +#define UART_0_ISR USART_RX_vect +#endif + +#ifdef CPU_ATMEGA2560 +#define UART_NUMOF (4U) + +#define UART_0 MEGA_UART0 +#define UART_0_ISR USART0_RX_vect + +#define UART_1 MEGA_UART1 +#define UART_1_ISR USART1_RX_vect + +#define UART_2 MEGA_UART2 +#define UART_2_ISR USART2_RX_vect + +#define UART_3 MEGA_UART3 +#define UART_3_ISR USART3_RX_vect +#endif +/** @} */ + +/** + * @name SPI configuration + * + * The atmega2560 has only one hardware SPI with fixed pin configuration, so all + * we can do here, is to enable or disable it... + * + * The fixed pins for arduino uno and duemilanove are: + * MOSI - PB3 (Arduino pin 11) + * MISO - PB4 (Arduino pin 12) + * SCK - PB5 (Arduino pin 13) + * SS - PB2 (Arduino pin 10) -> this pin is configured as output, but not used + * + * The fixed pins for arduino mega2560 are: + * MOSI - PB2 (Arduino pin 51) + * MISO - PB3 (Arduino pin 50) + * SCK - PB1 (Arduino pin 52) + * SS - PB0 (Arduino pin 53) -> this pin is configured as output, but not used + * + * @{ + */ +#define SPI_NUMOF 1 /* set to 0 to disable SPI */ + +#ifdef CPU_ATMEGA328P +#define MEGA_PRR PRR /* Power Reduction Register is PRR */ +#endif + +#ifdef CPU_ATMEGA2560 +#define MEGA_PRR PRR0 /* Power Reduction Register is PRR0 */ +#endif +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* PERIPH_CONF_H */ diff --git a/boards/arduino-common/Makefile.include b/boards/arduino-common/Makefile.include deleted file mode 100644 index 753113bd17..0000000000 --- a/boards/arduino-common/Makefile.include +++ /dev/null @@ -1,47 +0,0 @@ -# define the cpu used by the arduino uno and duemilanove boards -export CPU = atmega328p - -# include optional dependencies -include $(RIOTBOARD)/arduino-common/Makefile.dep - -# define port used to flash the board -OS = $(shell uname) -ifeq ($(OS),Linux) - PORT = $(LINUX_PORT) -else ifeq ($(OS),Darwin) - PORT ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) -else - $(info CAUTION: No flash tool for your host system found!) - # TODO: fix for building under windows -endif - -export TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm -export TERMFLAGS = -b 9600 -p $(PORT) -export FLASHER = avrdude -export PORT -export DIST_PATH = $(RIOTBOARD)/$(BOARD)/dist -export DEBUGSERVER_PORT = 4242 -export DEBUGSERVER = $(DIST_PATH)/debug_srv.sh -export DEBUGSERVER_FLAGS = "-g -j usb :$(DEBUGSERVER_PORT)" -export DEBUGGER_FLAGS = "-x $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE)" -export DEBUGGER = $(DIST_PATH)/debug.sh $(DEBUGSERVER_FLAGS) $(DIST_PATH) $(DEBUGSERVER_PORT) - -# PROGRAMMER defaults to arduino which is the internal flasher via USB. Can be -# overridden for debugging (which requires changes that require to use an ISP) -export PROGRAMMER ?= arduino - -ifeq ($(PROGRAMMER), arduino) - export PROGRAMMER_FLAGS = -P $(PORT) -b $(PROGRAMMER_SPEED) -endif - -# define build specific options -export CFLAGS_CPU = -mmcu=atmega328p $(CFLAGS_FPU) -export CFLAGS_LINK = -ffunction-sections -fdata-sections -fno-builtin -fshort-enums -export CFLAGS_DBG ?= -ggdb -g3 -export CFLAGS_OPT ?= -Os - -export CFLAGS += $(CFLAGS_CPU) $(CFLAGS_LINK) $(CFLAGS_DBG) $(CFLAGS_OPT) -export ASFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG) -export LINKFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG) $(CFLAGS_OPT) -static -lgcc -e reset_handler -export OFLAGS += -j .text -j .data -O ihex -export FFLAGS += -p atmega328p -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -F -D -U flash:w:bin/$(BOARD)/$(PROJECT)$(APPLICATION).hex diff --git a/boards/arduino-common/include/arduino_pinmap.h b/boards/arduino-common/include/arduino_pinmap.h deleted file mode 100644 index 67e4067714..0000000000 --- a/boards/arduino-common/include/arduino_pinmap.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2015 Freie Universität Berlin - * 2016 Laurent Navet - * - * 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_arduino-common - * @{ - * - * @file - * @brief Mapping from MCU pins to Arduino pins - * - * You can use the defines in this file for simplified interaction with the - * Arduino specific pin numbers. - * - * @author Hauke Petersen - * @author Daniel Nordahl - * @author Laurent Navet - */ - -#ifndef ARDUINO_PINMAP_H -#define ARDUINO_PINMAP_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Mapping of MCU pins to Arduino pins - * - * @note ISCP pins are not mapped. - */ - -/* Digital pins */ -#define ARDUINO_PIN_0 GPIO_PIN(PORT_D, 0) -#define ARDUINO_PIN_1 GPIO_PIN(PORT_D, 1) -#define ARDUINO_PIN_2 GPIO_PIN(PORT_D, 2) -#define ARDUINO_PIN_3 GPIO_PIN(PORT_D, 3) -#define ARDUINO_PIN_4 GPIO_PIN(PORT_D, 4) -#define ARDUINO_PIN_5 GPIO_PIN(PORT_D, 5) -#define ARDUINO_PIN_6 GPIO_PIN(PORT_D, 6) -#define ARDUINO_PIN_7 GPIO_PIN(PORT_D, 7) -#define ARDUINO_PIN_8 GPIO_PIN(PORT_B, 0) -#define ARDUINO_PIN_9 GPIO_PIN(PORT_B, 1) -#define ARDUINO_PIN_10 GPIO_PIN(PORT_B, 2) -#define ARDUINO_PIN_11 GPIO_PIN(PORT_B, 3) -#define ARDUINO_PIN_12 GPIO_PIN(PORT_B, 4) -#define ARDUINO_PIN_13 GPIO_PIN(PORT_B, 5) -/* Analog pins */ -#define ARDUINO_PIN_14 GPIO_PIN(PORT_C, 0) -#define ARDUINO_PIN_15 GPIO_PIN(PORT_C, 1) -#define ARDUINO_PIN_16 GPIO_PIN(PORT_C, 2) -#define ARDUINO_PIN_17 GPIO_PIN(PORT_C, 3) -#define ARDUINO_PIN_18 GPIO_PIN(PORT_C, 4) -#define ARDUINO_PIN_19 GPIO_PIN(PORT_C, 5) -/* Analog input */ -#define ARDUINO_PIN_A0 ARDUINO_PIN_14 -#define ARDUINO_PIN_A1 ARDUINO_PIN_15 -#define ARDUINO_PIN_A2 ARDUINO_PIN_16 -#define ARDUINO_PIN_A3 ARDUINO_PIN_17 -#define ARDUINO_PIN_A4 ARDUINO_PIN_18 -#define ARDUINO_PIN_A5 ARDUINO_PIN_19 -/** @ */ - -#ifdef __cplusplus -} -#endif - -#endif /* ARDUINO_PINMAP_H */ -/** @} */ diff --git a/boards/arduino-common/include/periph_conf.h b/boards/arduino-common/include/periph_conf.h deleted file mode 100644 index d19d20b914..0000000000 --- a/boards/arduino-common/include/periph_conf.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen - * 2016 Laurent Navet - * - * 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_arduino-common - * @{ - * - * @file - * @brief Peripheral MCU configuration for the arduino Uno and - * @brief Dumilanove boards. - * - * @author Hinnerk van Bruinehsen - * @author Laurent Navet - */ - -#ifndef PERIPH_CONF_H -#define PERIPH_CONF_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Clock configuration - * @{ - */ -#define CLOCK_CORECLOCK (16000000L) -/** @} */ - -/** - * @name Timer configuration - * - * The timer driver only supports the 16-bit timer (Timer1) - * so this is the only one we can use here. - * - * @{ - */ -#define TIMER_NUMOF (2U) - -#define TIMER_0 MEGA_TIMER1 -#define TIMER_0_MASK &TIMSK1 -#define TIMER_0_FLAG &TIFR1 -#define TIMER_0_ISRA TIMER1_COMPA_vect -#define TIMER_0_ISRB TIMER1_COMPB_vect -/** @} */ - -/** - * @name UART configuration - * - * Uno has only one UART, look in atmega_common - * This is where magic happens - * - * @{ - */ -#define UART_NUMOF (1U) - -#define UART_0 MEGA_UART0 -#define UART_0_ISR USART_RX_vect -/** @} */ - -/** - * @name SPI configuration - * - * The atmega2560 has only one hardware SPI with fixed pin configuration, so all - * we can do here, is to enable or disable it... - * - * The fixed pins used, are: - * MOSI - PB3 (Arduino pin 11) - * MISO - PB4 (Arduino pin 12) - * SCK - PB5 (Arduino pin 13) - * SS - PB2 (Arduino pin 10) -> this pin is configured as output, but not used - * - * @{ - */ -#define SPI_NUMOF 1 /* set to 0 to disable SPI */ -#define MEGA_PRR PRR /* Power Reduction Register is PRR */ -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* PERIPH_CONF_H */