Skip to content

Commit 7842b70

Browse files
boards: add support for Adafruit Feather nRF52840 Sense
1 parent 7da2817 commit 7842b70

File tree

10 files changed

+329
-0
lines changed

10 files changed

+329
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (c) 2023 HAW Hamburg
2+
#
3+
# This file is subject to the terms and conditions of the GNU Lesser
4+
# General Public License v2.1. See the file LICENSE in the top level
5+
# directory for more details.
6+
7+
config BOARD
8+
default "feather-nrf52840-sense" if BOARD_FEATHER_NRF52840_SENSE
9+
10+
config BOARD_FEATHER_NRF52840_SENSE
11+
bool
12+
default y
13+
select BOARD_COMMON_NRF52
14+
select CPU_MODEL_NRF52840XXAA
15+
select HAS_PERIPH_I2C
16+
select HAS_PERIPH_SPI
17+
select HAS_PERIPH_UART
18+
select HAS_PERIPH_USBDEV
19+
select HAS_HIGHLEVEL_STDIO
20+
21+
select HAVE_APDS9960
22+
select HAVE_BMP280_I2C
23+
select HAVE_LIS3MDL
24+
select HAVE_SAUL_GPIO
25+
select HAVE_SHT3X
26+
select MODULE_USB_BOARD_RESET if KCONFIG_USB && TEST_KCONFIG
27+
28+
config FORCE_USB_STDIO
29+
default y
30+
31+
source "$(RIOTBOARD)/common/nrf52/Kconfig"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
MODULE = board
2+
3+
include $(RIOTBASE)/Makefile.base
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ifneq (,$(filter saul_default,$(USEMODULE)))
2+
USEMODULE += apds9960
3+
USEMODULE += bmp280_i2c
4+
USEMODULE += lis3mdl
5+
USEMODULE += saul_gpio
6+
USEMODULE += sht3x
7+
endif
8+
9+
# include common nrf52 dependencies
10+
include $(RIOTBOARD)/common/nrf52/bootloader_nrfutil.dep.mk
11+
include $(RIOTBOARD)/common/nrf52/Makefile.dep
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CPU_MODEL = nrf52840xxaa
2+
3+
# Put defined MCU peripherals here (in alphabetical order)
4+
FEATURES_PROVIDED += periph_i2c
5+
FEATURES_PROVIDED += periph_spi
6+
FEATURES_PROVIDED += periph_uart
7+
FEATURES_PROVIDED += periph_usbdev
8+
9+
# Various other features (if any)
10+
FEATURES_PROVIDED += highlevel_stdio
11+
12+
include $(RIOTBOARD)/common/nrf52/Makefile.features
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../feather-nrf52840/Makefile.include
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
@defgroup boards_feather-nrf52840-sense Adafruit Feather nRF52840 Sense
3+
@ingroup boards
4+
@brief Support for the Adafruit Feather nRF52840 Sense
5+
6+
### General information
7+
8+
[The Feather nRF52840 Sense][feather-nrf52840-sense] is a development board
9+
from Adafruits Feather board family. It is very similar to the [The Feather
10+
nRF52840 Express][feather-nrf52840] but comes with more sensors.
11+
12+
It provides native USB support, Bluetooth
13+
Low Energy and IEEE 802.15.4 support via the nRF52840 MCU.
14+
15+
![top-down view on feather-nrf52840-sense][top-down view]
16+
17+
[feather-nrf52840]: https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/
18+
[feather-nrf52840-sense]: https://learn.adafruit.com/adafruit-feather-sense
19+
[top-down view]: https://cdn-learn.adafruit.com/assets/assets/000/089/096/original/sensors_Feather_Sense_top.jpg
20+
21+
### Flashing, Bootloader, and Terminal
22+
23+
Refer to [The Feather nRF52840 Express
24+
documentation](https://doc.riot-os.org/group__boards__feather-nrf52840.html) for further details.
25+
Both use the same flasher, bootloader, and terminal settings.
26+
*/
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/*
2+
* Copyright (C) 2020 Freie Universität Berlin
3+
* Copyright (C) 2023 HAW Hamburg
4+
*
5+
* This file is subject to the terms and conditions of the GNU Lesser
6+
* General Public License v2.1. See the file LICENSE in the top level
7+
* directory for more details.
8+
*/
9+
10+
/**
11+
* @ingroup boards_feather-nrf52840-sense
12+
* @{
13+
*
14+
* @file
15+
* @brief Board specific configuration for the Adafruit Feather nRF52840
16+
* Sense
17+
*
18+
* @author Martine S. Lenders <[email protected]>
19+
* @author Michel Rottleuthner <[email protected]>
20+
*/
21+
22+
#ifndef BOARD_H
23+
#define BOARD_H
24+
25+
#include "cpu.h"
26+
#include "board_common.h"
27+
#include "periph/gpio.h"
28+
29+
#ifdef __cplusplus
30+
extern "C" {
31+
#endif
32+
33+
/**
34+
* @name LED pin configuration
35+
* @{
36+
*/
37+
#define LED0_PIN GPIO_PIN(1, 9)
38+
#define LED1_PIN GPIO_PIN(1, 10)
39+
40+
#define LED_PORT (NRF_P1)
41+
#define LED0_MASK (1 << 9)
42+
#define LED1_MASK (1 << 10)
43+
#define LED_MASK (LED0_MASK | LED1_MASK)
44+
45+
#define LED0_ON (LED_PORT->OUTSET = LED0_MASK)
46+
#define LED0_OFF (LED_PORT->OUTCLR = LED0_MASK)
47+
#define LED0_TOGGLE (LED_PORT->OUT ^= LED0_MASK)
48+
49+
#define LED1_ON (LED_PORT->OUTSET = LED1_MASK)
50+
#define LED1_OFF (LED_PORT->OUTCLR = LED1_MASK)
51+
#define LED1_TOGGLE (LED_PORT->OUT ^= LED1_MASK)
52+
/** @} */
53+
54+
/**
55+
* @name Button pin configuration
56+
* @{
57+
*/
58+
#define BTN0_PIN GPIO_PIN(1, 2)
59+
#define BTN0_MODE GPIO_IN_PU
60+
/** @} */
61+
62+
/**
63+
* @name BMP280 sensor configuration
64+
* @{
65+
*/
66+
#define BMX280_PARAM_I2C_DEV I2C_DEV(0) /**< I2C device */
67+
/** @} */
68+
69+
/**
70+
* @name LIS3MDL 3-axis magnetometer
71+
* @{
72+
*/
73+
#define LIS3MDL_PARAM_I2C I2C_DEV(0) /**< I2C device */
74+
#define LIS3MDL_PARAM_ADDR (0x1C) /**< I2C address */
75+
/** @} */
76+
77+
/**
78+
* @name SHT30 temperature and humidity sensor
79+
* @{
80+
*/
81+
#define SHT3X_PARAM_I2C_DEV I2C_DEV(0) /**< I2C device */
82+
#define SHT3X_PARAM_I2C_ADDR (SHT3X_I2C_ADDR_1) /**< I2C address */
83+
/** @} */
84+
85+
#ifdef __cplusplus
86+
}
87+
#endif
88+
89+
#endif /* BOARD_H */
90+
/** @} */
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (C) 2020 Freie Universität Berlin
3+
* Copyright (C) 2023 HAW Hamburg
4+
*
5+
* This file is subject to the terms and conditions of the GNU Lesser
6+
* General Public License v2.1. See the file LICENSE in the top level
7+
* directory for more details.
8+
*/
9+
10+
/**
11+
* @ingroup boards_feather-nrf52840-sense
12+
* @{
13+
*
14+
* @file
15+
* @brief Configuration of SAUL mapped GPIO pins
16+
*
17+
* @author Martine S. Lenders <[email protected]>
18+
* @author Michel Rottleuthner <[email protected]>
19+
*/
20+
21+
#ifndef GPIO_PARAMS_H
22+
#define GPIO_PARAMS_H
23+
24+
#include "board.h"
25+
#include "saul/periph.h"
26+
27+
#ifdef __cplusplus
28+
extern "C" {
29+
#endif
30+
31+
/**
32+
* @brief LED configuration
33+
*/
34+
static const saul_gpio_params_t saul_gpio_params[] =
35+
{
36+
{
37+
.name = "LED Red (D13)",
38+
.pin = LED0_PIN,
39+
.mode = GPIO_OUT,
40+
.flags = (SAUL_GPIO_INIT_CLEAR),
41+
},
42+
{
43+
.name = "LED Blue (Conn)",
44+
.pin = LED1_PIN,
45+
.mode = GPIO_OUT,
46+
.flags = (SAUL_GPIO_INIT_CLEAR),
47+
},
48+
{
49+
.name = "UserSw",
50+
.pin = BTN0_PIN,
51+
.mode = BTN0_MODE,
52+
.flags = SAUL_GPIO_INVERTED,
53+
},
54+
};
55+
56+
#ifdef __cplusplus
57+
}
58+
#endif
59+
60+
#endif /* GPIO_PARAMS_H */
61+
/** @} */
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/*
2+
* Copyright (C) 2020 Freie Universität Berlin
3+
* Copyright (C) 2023 HAW Hamburg
4+
*
5+
* This file is subject to the terms and conditions of the GNU Lesser
6+
* General Public License v2.1. See the file LICENSE in the top level
7+
* directory for more details.
8+
*/
9+
10+
/**
11+
* @ingroup boards_feather-nrf52840-sense
12+
* @{
13+
*
14+
* @file
15+
* @brief Peripheral configuration for the Adafruit Feather nRF52840
16+
* Sense
17+
*
18+
* @author Martine S. Lenders <[email protected]>
19+
* @author Michel Rottleuthner <[email protected]>
20+
*
21+
*/
22+
23+
#ifndef PERIPH_CONF_H
24+
#define PERIPH_CONF_H
25+
26+
#include "periph_cpu.h"
27+
#include "cfg_clock_32_0.h"
28+
#include "cfg_rtt_default.h"
29+
#include "cfg_timer_default.h"
30+
31+
#ifdef __cplusplus
32+
extern "C" {
33+
#endif
34+
35+
/**
36+
* @name UART configuration
37+
* @{
38+
*/
39+
static const uart_conf_t uart_config[] = {
40+
{
41+
.dev = NRF_UARTE0,
42+
.rx_pin = GPIO_PIN(0, 24),
43+
.tx_pin = GPIO_PIN(0, 25),
44+
#ifdef MODULE_PERIPH_UART_HW_FC
45+
.rts_pin = GPIO_UNDEF,
46+
.cts_pin = GPIO_UNDEF,
47+
#endif
48+
.irqn = UARTE0_UART0_IRQn,
49+
},
50+
};
51+
52+
#define UART_0_ISR (isr_uart0)
53+
54+
#define UART_NUMOF ARRAY_SIZE(uart_config)
55+
/** @} */
56+
57+
/**
58+
* @name SPI configuration
59+
* @{
60+
*/
61+
static const spi_conf_t spi_config[] = {
62+
{
63+
.dev = NRF_SPIM0,
64+
.sclk = 14,
65+
.mosi = 13,
66+
.miso = 15,
67+
}
68+
};
69+
70+
#define SPI_NUMOF ARRAY_SIZE(spi_config)
71+
/** @} */
72+
73+
/**
74+
* @name I2C configuration
75+
* @{
76+
*/
77+
static const i2c_conf_t i2c_config[] = {
78+
{
79+
.dev = NRF_TWIM1,
80+
.scl = 11,
81+
.sda = 12,
82+
.speed = I2C_SPEED_NORMAL
83+
}
84+
};
85+
#define I2C_NUMOF ARRAY_SIZE(i2c_config)
86+
/** @} */
87+
88+
#ifdef __cplusplus
89+
}
90+
#endif
91+
92+
#endif /* PERIPH_CONF_H */
93+
/** @} */
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../feather-nrf52840/reset.c

0 commit comments

Comments
 (0)