Skip to content

Commit

Permalink
boards/feather-m0: initial support
Browse files Browse the repository at this point in the history
  • Loading branch information
aabadie committed Nov 5, 2017
1 parent 5fe06c8 commit 337e9d8
Show file tree
Hide file tree
Showing 10 changed files with 532 additions and 0 deletions.
3 changes: 3 additions & 0 deletions boards/feather-m0/Makefile
@@ -0,0 +1,3 @@
MODULE = board

include $(RIOTBASE)/Makefile.base
3 changes: 3 additions & 0 deletions boards/feather-m0/Makefile.dep
@@ -0,0 +1,3 @@
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif
15 changes: 15 additions & 0 deletions boards/feather-m0/Makefile.features
@@ -0,0 +1,15 @@
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_gpio
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart

# The board MPU family (used for grouping by the CI system)
FEATURES_MCU_GROUP = cortex_m0_2

-include $(RIOTCPU)/samd21/Makefile.features
25 changes: 25 additions & 0 deletions boards/feather-m0/Makefile.include
@@ -0,0 +1,25 @@
# define the cpu used by Adafruit Feather M0 boards
export CPU = samd21
export CPU_MODEL = samd21g18a

#export needed for flash rule
export PORT_LINUX ?= /dev/ttyACM0
export PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))

# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk

# setup the flash tool used
ifeq ($(PROGRAMMER),jlink)
# in case J-Link is attached to SWD pins, use a plain CPU memory model
export JLINK_DEVICE := atsamd21
include $(RIOTMAKE)/tools/jlink.inc.mk
else
# by default, we use BOSSA to flash this board to take into account the
# pre-flashed Arduino bootloader
export LINKER_SCRIPT ?= $(RIOTCPU)/sam0_common/ldscripts/$(CPU_MODEL)_arduino_bootloader.ld
include $(RIOTMAKE)/tools/bossa.inc.mk
endif

# setup the boards dependencies
include $(RIOTBOARD)/$(BOARD)/Makefile.dep
31 changes: 31 additions & 0 deletions boards/feather-m0/board.c
@@ -0,0 +1,31 @@
/*
* Copyright (C) 2017 Inria
*
* 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_feather-m0
* @{
*
* @file
* @brief Board specific implementations for the Adafruit Feather M0 boards
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*
* @}
*/

#include "cpu.h"
#include "board.h"
#include "periph/gpio.h"

void board_init(void)
{
/* initialize the CPU */
cpu_init();
/* initialize the on-board red LED on pin PA17 */
gpio_init(LED0_PIN, GPIO_OUT);
}
45 changes: 45 additions & 0 deletions boards/feather-m0/doc.txt
@@ -0,0 +1,45 @@
/**
* @defgroup boards_feather-m0 Adafruit Feather M0
* @ingroup boards
* @brief Support for the Adafruit Feather M0.
*
* ### General information
*
* Feather M0 boards are development boards shipped by
* [Adafruit](https://learn.adafruit.com/adafruit-feather-m0-basic-proto/).
*
* All the feather M0 boards are built based on the same Atmel SAMD21G18A
* microcontroller. See @ref cpu_samd21.
*
* Several types of Feather M0 boards exist:
* * [Feather M0 WiFi](https://learn.adafruit.com/adafruit-feather-m0-wifi-atwinc1500/)
* * [Feather M0 BLE](https://learn.adafruit.com/adafruit-feather-m0-bluefruit-le/overview)
* * [Feather M0 Adalogger](https://learn.adafruit.com/adafruit-feather-m0-adalogger/)
* * [Feather M0 LoRa](https://learn.adafruit.com/adafruit-feather-m0-radio-with-lora-radio-module)
*
* The different modules used to differenciate the boards (ATWINC1500 WiFi,
* Bluefruit LE, SD card, LoRa) are connected via SPI (SPI_DEV(0)) to the
* SAMD21 mcu.
*
* ### Pinout
*
* <img src="https://cdn-learn.adafruit.com/assets/assets/000/030/921/original/adafruit_products_2772_pinout_v1_0.png"
* alt="Adafruit Feather M0 proto pinout" style="width:800px;"/>
*
* ### Flash the board
*
* 1. Put the board in bootloader mode by double tapping the reset button.<br/>
* When the board is in bootloader mode, the user led (red) oscillates smoothly.
*
*
* 2. Use `BOARD=feather-m0` with the `make` command.<br/>
* Example with `hello-world` application:
* ```
* make BOARD=feather-m0 -C examples/hello-world flash
* ```
*
* ### Accessing STDIO via UART
*
* To access the STDIO of RIOT, a FTDI to USB converted needs to be plugged to
* the RX/TX pins on the board.
*/
56 changes: 56 additions & 0 deletions boards/feather-m0/include/board.h
@@ -0,0 +1,56 @@
/*
* Copyright (C) 2017 Inria
*
* 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_feather-m0
* @brief Board specific configuration of the Adafruit Feather M0.
*
* @{
*
* @file
* @brief Board specific configuration for the Adafruit Feather M0
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*/

#ifndef BOARD_H
#define BOARD_H

#include "cpu.h"
#include "periph_conf.h"
#include "periph_cpu.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @name LED pin definitions and handlers
* @{
*/
#define LED0_PIN GPIO_PIN(PA, 17)

#define LED_PORT PORT->Group[PA]
#define LED0_MASK (1 << 17)

#define LED0_ON (LED_PORT.OUTSET.reg = LED0_MASK)
#define LED0_OFF (LED_PORT.OUTCLR.reg = LED0_MASK)
#define LED0_TOGGLE (LED_PORT.OUTTGL.reg = LED0_MASK)
/** @} */

/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);

#ifdef __cplusplus
}
#endif

#endif /* BOARD_H */
/** @} */
46 changes: 46 additions & 0 deletions boards/feather-m0/include/gpio_params.h
@@ -0,0 +1,46 @@
/*
* Copyright (C) 2017 Inria
*
* 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_feather-m0
* @{
*
* @file
* @brief Board specific configuration of direct mapped GPIOs
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*/

#ifndef GPIO_PARAMS_H
#define GPIO_PARAMS_H

#include "board.h"
#include "saul/periph.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief GPIO pin configuration
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
{
.name = "LED(Red)",
.pin = LED0_PIN,
.mode = GPIO_OUT
},
};

#ifdef __cplusplus
}
#endif

#endif /* GPIO_PARAMS_H */
/** @} */

0 comments on commit 337e9d8

Please sign in to comment.