-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
boards/adafruit-clue: add initial support
- Loading branch information
Showing
10 changed files
with
399 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
MODULE = board | ||
|
||
include $(RIOTBASE)/Makefile.base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
ifneq (,$(filter saul_default,$(USEMODULE))) | ||
USEMODULE += saul_gpio | ||
USEMODULE += bmp280_i2c | ||
USEMODULE += lis3mdl | ||
USEMODULE += sht3x | ||
endif | ||
|
||
# Provide stdio over USB by default | ||
DEFAULT_MODULE += stdio_cdc_acm | ||
|
||
# Default auto-initialization of usbus for stdio other USB | ||
DEFAULT_MODULE += auto_init_usbus | ||
|
||
# This boards requires support for Arduino bootloader. | ||
USEMODULE += arduino_bootloader | ||
|
||
# include common nrf52 dependencies | ||
include $(RIOTBOARD)/common/nrf52/Makefile.dep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
CPU_MODEL = nrf52840xxaa | ||
|
||
# Put defined MCU peripherals here (in alphabetical order) | ||
FEATURES_PROVIDED += periph_i2c | ||
FEATURES_PROVIDED += periph_spi | ||
FEATURES_PROVIDED += periph_uart | ||
FEATURES_PROVIDED += periph_usbdev | ||
|
||
# Various other features (if any) | ||
FEATURES_PROVIDED += radio_nrf802154 | ||
|
||
include $(RIOTBOARD)/common/nrf52/Makefile.features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Bossa is the default programmer | ||
PROGRAMMER ?= adafruit-nrfutil | ||
|
||
ifeq ($(PROGRAMMER),adafruit-nrfutil) | ||
# The preinstalled bootloader must also be taken into account so | ||
# ROM_OFFSET skips the space taken by such bootloader. | ||
ROM_OFFSET = 0x26000 | ||
|
||
ifneq (,$(filter reset flash flash-only, $(MAKECMDGOALS))) | ||
# Add 2 seconds delay before opening terminal: this is required when opening | ||
# the terminal right after flashing. In this case, the stdio over USB needs | ||
# some time after reset before being ready. | ||
TERM_DELAY = 2 | ||
TERMDEPS += term-delay | ||
endif | ||
|
||
include $(RIOTMAKE)/tools/adafruit-nrfutil.inc.mk | ||
endif | ||
|
||
term-delay: | ||
sleep $(TERM_DELAY) | ||
|
||
TESTRUNNER_CONNECT_DELAY ?= 2 | ||
$(call target-export-variables,test,TESTRUNNER_CONNECT_DELAY) | ||
|
||
include $(RIOTBOARD)/common/nrf52/Makefile.include |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (C) 2020 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_adafruit-clue | ||
* @{ | ||
* | ||
* @file | ||
* @brief Board initialization for the Adafruit Clue | ||
* | ||
* @author Alexandre Abadie <[email protected]> | ||
* | ||
* @} | ||
*/ | ||
|
||
#include "cpu.h" | ||
#include "board.h" | ||
|
||
#include "periph/gpio.h" | ||
|
||
void board_init(void) | ||
{ | ||
/* initialize the CPU */ | ||
cpu_init(); | ||
|
||
/* initialize the boards LEDs */ | ||
gpio_init(LED0_PIN, GPIO_OUT); /* Red LED */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
@defgroup boards_adafruit-clue Adafruit Clue | ||
@ingroup boards | ||
@brief Support for the Adafruit Clue | ||
|
||
### General information | ||
|
||
The [Adafruit Clue](https://www.adafruit.com/clue) board | ||
is an opensource, micro development kit using the nRF52840 SoC. | ||
This board provides 802.15.4 and BLE connectivity. | ||
|
||
<img src="https://raw.githubusercontent.com/adafruit/Adafruit-CLUE-PCB/master/assets/4500.jpg" | ||
alt="Adafruit Clue" style="height:800px;"/> | ||
|
||
### Schematics | ||
|
||
The board detailed description and schematic is available | ||
[here](https://github.com/adafruit/Adafruit-CLUE-PCB). | ||
|
||
### Flash the board | ||
|
||
The board is flashed using the `nrfutil` Python package. | ||
|
||
Once `nrfutil` is installed, ase `BOARD=adafruit-clue` with the `make` command.<br/> | ||
Example with `hello-world` application: | ||
``` | ||
make BOARD=adafruit-clue -C examples/hello-world flash | ||
``` | ||
|
||
### Accessing STDIO via UART | ||
|
||
The STDIO is directly accessible via the USB port. On a Linux host, it's | ||
generally mapped to `/dev/ttyACM0`. | ||
|
||
Use the `term` target to connect to the board serial port<br/> | ||
``` | ||
make BOARD=adafruit-clue -C examples/hello-world term | ||
``` | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright (C) 2020 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_adafruit-clue | ||
* @{ | ||
* | ||
* @file | ||
* @brief Board specific configuration for the Adafruit Clue board | ||
* | ||
* @author Alexandre Abadie <[email protected]> | ||
*/ | ||
|
||
#ifndef BOARD_H | ||
#define BOARD_H | ||
|
||
#include "cpu.h" | ||
#include "board_common.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @name LEDs pin configuration | ||
* @{ | ||
*/ | ||
#define LED0_PIN GPIO_PIN(1, 1) | ||
#define LED0_MASK (1 << 1) | ||
#define LED0_ON (NRF_P1->OUTCLR = LED0_MASK) | ||
#define LED0_OFF (NRF_P1->OUTSET = LED0_MASK) | ||
#define LED0_TOGGLE (NRF_P1->OUT ^= LED0_MASK) | ||
/** @} */ | ||
|
||
/** | ||
* @name Button pin configuration | ||
* @{ | ||
*/ | ||
#define BTN0_PIN GPIO_PIN(1, 10) /* Right button */ | ||
#define BTN0_MODE GPIO_IN_PU | ||
|
||
#define BTN1_PIN GPIO_PIN(1, 2) /* Left button */ | ||
#define BTN1_MODE GPIO_IN_PU | ||
/** @} */ | ||
|
||
/** | ||
* @name LIS3MDL 3-axis magnetometer I2C address | ||
*/ | ||
#define LIS3MDL_PARAM_ADDR (0x1C) | ||
/** @} */ | ||
|
||
/** | ||
* @name STH31 temperature and humidity sensor I2C address | ||
*/ | ||
#define SHT3X_PARAM_I2C_ADDR (SHT3X_I2C_ADDR_1) | ||
/** @} */ | ||
|
||
/** | ||
* @name Button pin configuration | ||
* @{ | ||
*/ | ||
#define ILI9341_PARAM_SPI SPI_DEV(1) | ||
#define ILI9341_PARAM_CS GPIO_PIN(0, 12) | ||
#define ILI9341_PARAM_DCX GPIO_PIN(0, 13) | ||
#define ILI9341_PARAM_NUM_LINES (240U) | ||
#define ILI9341_PARAM_RGB (1) | ||
#define ILI9341_PARAM_INVERTED (1) | ||
/** @} */ | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* BOARD_H */ | ||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright (C) 2020 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_adafruit-clue | ||
* @{ | ||
* | ||
* @file | ||
* @brief Configuration of SAUL mapped GPIO pins | ||
* | ||
* @author Alexandre Abadie <[email protected]> | ||
*/ | ||
|
||
#ifndef GPIO_PARAMS_H | ||
#define GPIO_PARAMS_H | ||
|
||
#include "board.h" | ||
#include "saul/periph.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief LED configuration | ||
*/ | ||
static const saul_gpio_params_t saul_gpio_params[] = | ||
{ | ||
{ | ||
.name = "LED0 (Red)", | ||
.pin = LED0_PIN, | ||
.mode = GPIO_OUT, | ||
}, | ||
{ | ||
.name = "Button (Right)", | ||
.pin = BTN0_PIN, | ||
.mode = BTN0_MODE, | ||
.flags = SAUL_GPIO_INVERTED, | ||
}, | ||
{ | ||
.name = "Button (Left)", | ||
.pin = BTN1_PIN, | ||
.mode = BTN1_MODE, | ||
.flags = SAUL_GPIO_INVERTED, | ||
} | ||
}; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* GPIO_PARAMS_H */ | ||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
* Copyright (C) 2020 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_adafruit-clue | ||
* @{ | ||
* | ||
* @file | ||
* @brief Peripheral configuration for the Adafruit Clue board | ||
* | ||
* @author Alexandre Abadie <[email protected]> | ||
* | ||
*/ | ||
|
||
#ifndef PERIPH_CONF_H | ||
#define PERIPH_CONF_H | ||
|
||
#include "periph_cpu.h" | ||
#include "cfg_clock_32_1.h" | ||
#include "cfg_rtt_default.h" | ||
#include "cfg_timer_default.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @name UART configuration | ||
* @{ | ||
*/ | ||
static const uart_conf_t uart_config[] = { | ||
{ | ||
.dev = NRF_UARTE0, | ||
.rx_pin = GPIO_PIN(0, 4), | ||
.tx_pin = GPIO_PIN(0, 5), | ||
.rts_pin = (uint8_t)GPIO_UNDEF, | ||
.cts_pin = (uint8_t)GPIO_UNDEF, | ||
.irqn = UARTE0_UART0_IRQn, | ||
}, | ||
}; | ||
|
||
#define UART_0_ISR (isr_uart0) | ||
|
||
#define UART_NUMOF ARRAY_SIZE(uart_config) | ||
/** @} */ | ||
|
||
/** | ||
* @name I2C configuration | ||
* @{ | ||
*/ | ||
static const i2c_conf_t i2c_config[] = { | ||
{ | ||
.dev = NRF_TWIM0, | ||
.scl = GPIO_PIN(0, 25), | ||
.sda = GPIO_PIN(0, 24), | ||
.speed = I2C_SPEED_NORMAL | ||
}, | ||
}; | ||
|
||
#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0])) | ||
/** @} */ | ||
|
||
/** | ||
* @name SPI configuration | ||
* @{ | ||
*/ | ||
static const spi_conf_t spi_config[] = { | ||
{ | ||
.dev = NRF_SPI0, | ||
.sclk = GPIO_PIN(0, 8), | ||
.mosi = GPIO_PIN(0, 26), | ||
.miso = GPIO_PIN(0, 06), | ||
}, | ||
{ /* TFT LCD screen */ | ||
.dev = NRF_SPI1, | ||
.sclk = GPIO_PIN(0, 14), | ||
.mosi = GPIO_PIN(0, 15), | ||
.miso = GPIO_PIN(0, 0), | ||
}, | ||
}; | ||
|
||
#define SPI_NUMOF ARRAY_SIZE(spi_config) | ||
/** @} */ | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* PERIPH_CONF_H */ |
Oops, something went wrong.