forked from RIOT-OS/RIOT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
20027: boards: add support for Adafruit Feather nRF52840 Sense r=benpicco a=MichelRottleuthner Co-authored-by: Michel Rottleuthner <[email protected]>
- Loading branch information
Showing
10 changed files
with
329 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,31 @@ | ||
# Copyright (c) 2023 HAW Hamburg | ||
# | ||
# 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. | ||
|
||
config BOARD | ||
default "feather-nrf52840-sense" if BOARD_FEATHER_NRF52840_SENSE | ||
|
||
config BOARD_FEATHER_NRF52840_SENSE | ||
bool | ||
default y | ||
select BOARD_COMMON_NRF52 | ||
select CPU_MODEL_NRF52840XXAA | ||
select HAS_PERIPH_I2C | ||
select HAS_PERIPH_SPI | ||
select HAS_PERIPH_UART | ||
select HAS_PERIPH_USBDEV | ||
select HAS_HIGHLEVEL_STDIO | ||
|
||
select HAVE_APDS9960 | ||
select HAVE_BMP280_I2C | ||
select HAVE_LIS3MDL | ||
select HAVE_SAUL_GPIO | ||
select HAVE_SHT3X | ||
select MODULE_USB_BOARD_RESET if KCONFIG_USB && TEST_KCONFIG | ||
|
||
config FORCE_USB_STDIO | ||
default y | ||
|
||
source "$(RIOTBOARD)/common/nrf52/Kconfig" |
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,11 @@ | ||
ifneq (,$(filter saul_default,$(USEMODULE))) | ||
USEMODULE += apds9960 | ||
USEMODULE += bmp280_i2c | ||
USEMODULE += lis3mdl | ||
USEMODULE += saul_gpio | ||
USEMODULE += sht3x | ||
endif | ||
|
||
# include common nrf52 dependencies | ||
include $(RIOTBOARD)/common/nrf52/bootloader_nrfutil.dep.mk | ||
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 += highlevel_stdio | ||
|
||
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 @@ | ||
../feather-nrf52840/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,26 @@ | ||
/** | ||
@defgroup boards_feather-nrf52840-sense Adafruit Feather nRF52840 Sense | ||
@ingroup boards | ||
@brief Support for the Adafruit Feather nRF52840 Sense | ||
|
||
### General information | ||
|
||
[The Feather nRF52840 Sense][feather-nrf52840-sense] is a development board | ||
from Adafruits Feather board family. It is very similar to the [The Feather | ||
nRF52840 Express][feather-nrf52840] but comes with more sensors. | ||
|
||
It provides native USB support, Bluetooth | ||
Low Energy and IEEE 802.15.4 support via the nRF52840 MCU. | ||
|
||
![top-down view on feather-nrf52840-sense][top-down view] | ||
|
||
[feather-nrf52840]: https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/ | ||
[feather-nrf52840-sense]: https://learn.adafruit.com/adafruit-feather-sense | ||
[top-down view]: https://cdn-learn.adafruit.com/assets/assets/000/089/096/original/sensors_Feather_Sense_top.jpg | ||
|
||
### Flashing, Bootloader, and Terminal | ||
|
||
Refer to [The Feather nRF52840 Express | ||
documentation](https://doc.riot-os.org/group__boards__feather-nrf52840.html) for further details. | ||
Both use the same flasher, bootloader, and terminal settings. | ||
*/ |
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,90 @@ | ||
/* | ||
* Copyright (C) 2020 Freie Universität Berlin | ||
* Copyright (C) 2023 HAW Hamburg | ||
* | ||
* 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-nrf52840-sense | ||
* @{ | ||
* | ||
* @file | ||
* @brief Board specific configuration for the Adafruit Feather nRF52840 | ||
* Sense | ||
* | ||
* @author Martine S. Lenders <[email protected]> | ||
* @author Michel Rottleuthner <[email protected]> | ||
*/ | ||
|
||
#ifndef BOARD_H | ||
#define BOARD_H | ||
|
||
#include "cpu.h" | ||
#include "board_common.h" | ||
#include "periph/gpio.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @name LED pin configuration | ||
* @{ | ||
*/ | ||
#define LED0_PIN GPIO_PIN(1, 9) | ||
#define LED1_PIN GPIO_PIN(1, 10) | ||
|
||
#define LED_PORT (NRF_P1) | ||
#define LED0_MASK (1 << 9) | ||
#define LED1_MASK (1 << 10) | ||
#define LED_MASK (LED0_MASK | LED1_MASK) | ||
|
||
#define LED0_ON (LED_PORT->OUTSET = LED0_MASK) | ||
#define LED0_OFF (LED_PORT->OUTCLR = LED0_MASK) | ||
#define LED0_TOGGLE (LED_PORT->OUT ^= LED0_MASK) | ||
|
||
#define LED1_ON (LED_PORT->OUTSET = LED1_MASK) | ||
#define LED1_OFF (LED_PORT->OUTCLR = LED1_MASK) | ||
#define LED1_TOGGLE (LED_PORT->OUT ^= LED1_MASK) | ||
/** @} */ | ||
|
||
/** | ||
* @name Button pin configuration | ||
* @{ | ||
*/ | ||
#define BTN0_PIN GPIO_PIN(1, 2) | ||
#define BTN0_MODE GPIO_IN_PU | ||
/** @} */ | ||
|
||
/** | ||
* @name BMP280 sensor configuration | ||
* @{ | ||
*/ | ||
#define BMX280_PARAM_I2C_DEV I2C_DEV(0) /**< I2C device */ | ||
/** @} */ | ||
|
||
/** | ||
* @name LIS3MDL 3-axis magnetometer | ||
* @{ | ||
*/ | ||
#define LIS3MDL_PARAM_I2C I2C_DEV(0) /**< I2C device */ | ||
#define LIS3MDL_PARAM_ADDR (0x1C) /**< I2C address */ | ||
/** @} */ | ||
|
||
/** | ||
* @name SHT30 temperature and humidity sensor | ||
* @{ | ||
*/ | ||
#define SHT3X_PARAM_I2C_DEV I2C_DEV(0) /**< I2C device */ | ||
#define SHT3X_PARAM_I2C_ADDR (SHT3X_I2C_ADDR_1) /**< I2C address */ | ||
/** @} */ | ||
|
||
#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,61 @@ | ||
/* | ||
* Copyright (C) 2020 Freie Universität Berlin | ||
* Copyright (C) 2023 HAW Hamburg | ||
* | ||
* 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-nrf52840-sense | ||
* @{ | ||
* | ||
* @file | ||
* @brief Configuration of SAUL mapped GPIO pins | ||
* | ||
* @author Martine S. Lenders <[email protected]> | ||
* @author Michel Rottleuthner <[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 = "LED Red (D13)", | ||
.pin = LED0_PIN, | ||
.mode = GPIO_OUT, | ||
.flags = (SAUL_GPIO_INIT_CLEAR), | ||
}, | ||
{ | ||
.name = "LED Blue (Conn)", | ||
.pin = LED1_PIN, | ||
.mode = GPIO_OUT, | ||
.flags = (SAUL_GPIO_INIT_CLEAR), | ||
}, | ||
{ | ||
.name = "UserSw", | ||
.pin = BTN0_PIN, | ||
.mode = BTN0_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,93 @@ | ||
/* | ||
* Copyright (C) 2020 Freie Universität Berlin | ||
* Copyright (C) 2023 HAW Hamburg | ||
* | ||
* 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-nrf52840-sense | ||
* @{ | ||
* | ||
* @file | ||
* @brief Peripheral configuration for the Adafruit Feather nRF52840 | ||
* Sense | ||
* | ||
* @author Martine S. Lenders <[email protected]> | ||
* @author Michel Rottleuthner <[email protected]> | ||
* | ||
*/ | ||
|
||
#ifndef PERIPH_CONF_H | ||
#define PERIPH_CONF_H | ||
|
||
#include "periph_cpu.h" | ||
#include "cfg_clock_32_0.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, 24), | ||
.tx_pin = GPIO_PIN(0, 25), | ||
#ifdef MODULE_PERIPH_UART_HW_FC | ||
.rts_pin = GPIO_UNDEF, | ||
.cts_pin = GPIO_UNDEF, | ||
#endif | ||
.irqn = UARTE0_UART0_IRQn, | ||
}, | ||
}; | ||
|
||
#define UART_0_ISR (isr_uart0) | ||
|
||
#define UART_NUMOF ARRAY_SIZE(uart_config) | ||
/** @} */ | ||
|
||
/** | ||
* @name SPI configuration | ||
* @{ | ||
*/ | ||
static const spi_conf_t spi_config[] = { | ||
{ | ||
.dev = NRF_SPIM0, | ||
.sclk = 14, | ||
.mosi = 13, | ||
.miso = 15, | ||
} | ||
}; | ||
|
||
#define SPI_NUMOF ARRAY_SIZE(spi_config) | ||
/** @} */ | ||
|
||
/** | ||
* @name I2C configuration | ||
* @{ | ||
*/ | ||
static const i2c_conf_t i2c_config[] = { | ||
{ | ||
.dev = NRF_TWIM1, | ||
.scl = 11, | ||
.sda = 12, | ||
.speed = I2C_SPEED_NORMAL | ||
} | ||
}; | ||
#define I2C_NUMOF ARRAY_SIZE(i2c_config) | ||
/** @} */ | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* PERIPH_CONF_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 @@ | ||
../feather-nrf52840/reset.c |