diff --git a/boards/common/nrf52/Makefile.dep b/boards/common/nrf52/Makefile.dep index 327585d2b8..9a45e5e814 100644 --- a/boards/common/nrf52/Makefile.dep +++ b/boards/common/nrf52/Makefile.dep @@ -2,7 +2,7 @@ ifneq (,$(filter saul_default,$(USEMODULE))) USEMODULE += saul_nrf_temperature endif -ifneq (,$(filter nrf52811xxaa nrf52820xxaa rf52833xxaa nrf52840xxaa,$(CPU_MODEL))) +ifneq (,$(filter nrf52811xxaa nrf52820xxaa nrf52833xxaa nrf52840xxaa,$(CPU_MODEL))) # include dependencies for 802.15.4 radio include $(RIOTBOARD)/common/nrf52/Makefile.nrf802154.dep else diff --git a/boards/common/nrf52/include/cfg_clock_32_0.h b/boards/common/nrf52/include/cfg_clock_32_0.h new file mode 100644 index 0000000000..e1278f2ff4 --- /dev/null +++ b/boards/common/nrf52/include/cfg_clock_32_0.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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_common_nrf52 + * @{ + * + * @file + * @brief Common clock configuration for the nRF52 based boards + * + * @author Alexandre Abadie + * + */ + +#ifndef CFG_CLOCK_32_0_H +#define CFG_CLOCK_32_0_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @name Clock configuration + * + * @note The radio will not work with the internal RC oscillator! + * + * @{ + */ +#define CLOCK_HFCLK (32U) /* set to 0: internal RC oscillator + * 32: 32MHz crystal */ +#define CLOCK_LFCLK (0) /* set to 0: internal RC oscillator + * 1: 32.768 kHz crystal + * 2: derived from HFCLK */ +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* CFG_CLOCK_32_0_H */ +/** @} */ diff --git a/boards/microbit-v2/Kconfig b/boards/microbit-v2/Kconfig new file mode 100644 index 0000000000..cadbbbfad4 --- /dev/null +++ b/boards/microbit-v2/Kconfig @@ -0,0 +1,20 @@ +# Copyright (c) 2021 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. + +config BOARD + default "microbit-v2" if BOARD_MICROBIT_V2 + +config BOARD_MICROBIT_V2 + bool + default y + select BOARD_COMMON_NRF52 + select CPU_MODEL_NRF52833XXAA + select HAS_PERIPH_I2C + select HAS_PERIPH_PWM + select HAS_PERIPH_SPI + select HAS_PERIPH_UART + +source "$(RIOTBOARD)/common/nrf52/Kconfig" diff --git a/boards/microbit-v2/Makefile b/boards/microbit-v2/Makefile new file mode 100644 index 0000000000..c3375d9f76 --- /dev/null +++ b/boards/microbit-v2/Makefile @@ -0,0 +1,7 @@ +MODULE = board + +ifneq (,$(filter microbit,$(USEMODULE))) + DIRS += microbit +endif + +include $(RIOTBASE)/Makefile.base diff --git a/boards/microbit-v2/Makefile.dep b/boards/microbit-v2/Makefile.dep new file mode 100644 index 0000000000..f3d41892cb --- /dev/null +++ b/boards/microbit-v2/Makefile.dep @@ -0,0 +1,10 @@ +ifneq (,$(filter microbit,$(USEMODULE))) + USEMODULE += xtimer + USEMODULE += mineplex +endif + +ifneq (,$(filter saul_default,$(USEMODULE))) + USEMODULE += saul_gpio +endif + +include $(RIOTBOARD)/common/nrf52/Makefile.dep diff --git a/boards/microbit-v2/Makefile.features b/boards/microbit-v2/Makefile.features new file mode 100644 index 0000000000..259e50e560 --- /dev/null +++ b/boards/microbit-v2/Makefile.features @@ -0,0 +1,10 @@ +CPU_MODEL = nrf52833xxaa + +# Put defined MCU peripherals here (in alphabetical order) +FEATURES_PROVIDED += periph_i2c +FEATURES_PROVIDED += periph_pwm +FEATURES_PROVIDED += periph_spi +FEATURES_PROVIDED += periph_uart + +# include common nrf52 based boards features +include $(RIOTBOARD)/common/nrf52/Makefile.features diff --git a/boards/microbit-v2/Makefile.include b/boards/microbit-v2/Makefile.include new file mode 100644 index 0000000000..8fde308551 --- /dev/null +++ b/boards/microbit-v2/Makefile.include @@ -0,0 +1,12 @@ +# for this board, flash with OpenOCD by default. PyOCD is also supported. +PROGRAMMER ?= openocd +ifeq (pyocd,$(PROGRAMMER)) + # The board is not recognized automatically by pyocd, so the CPU target + # option is passed explicitly + FLASH_TARGET_TYPE ?= -t $(CPU) +else ifeq (openocd,$(PROGRAMMER)) + DEBUG_ADAPTER = dap +endif + +# include nrf52 boards common configuration +include $(RIOTBOARD)/common/nrf52/Makefile.include diff --git a/boards/microbit-v2/board.c b/boards/microbit-v2/board.c new file mode 100644 index 0000000000..15fd5ecd70 --- /dev/null +++ b/boards/microbit-v2/board.c @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2021 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_microbit_v2 + * @{ + * + * @file + * @brief Board initialization code for the BBC micro:bit v2 + * + * @author Alexandre Abadie + * + * @} + */ + +#include "board.h" +#include "periph/gpio.h" + +void board_init(void) +{ + /* initialize the CPU */ + cpu_init(); + + /* initialize the on board buttons */ + gpio_init(BTN0_PIN, GPIO_IN); + gpio_init(BTN1_PIN, GPIO_IN); +} diff --git a/boards/microbit-v2/doc.txt b/boards/microbit-v2/doc.txt new file mode 100644 index 0000000000..ebce85bf52 --- /dev/null +++ b/boards/microbit-v2/doc.txt @@ -0,0 +1,36 @@ +/** +@defgroup boards_microbit_v2 BBC micro:bit v2 +@ingroup boards +@brief Support for the BBC micro:bit v2 + +## Overview + +The [micro:bit v2](https://www.microbit.co.uk/) was designed by the BBC and +released in 2020. + +The board is based on the Nordic nRF52833 SoC, featuring 128KiB of RAM, 512KiB +of ROM, and a 2.4GHz radio, that supports Bluetooth Low Energy (BLE), 802.15.4 +as well as a Nordic proprietary radio mode. + +Additionally the boards features 2 buttons, a 5x5 LED matrix, a speaker, a +microphone, an accelerometer and a magnetometer. + +## Flashing and Debugging + +The board can be flashed using OpenOCD and PyOCD. Debugger is also available +with both programmers. + +``` +BOARD=microbit make flash +``` + +## STDIO + +The programmer chip provides access to STDIO via USB. On Linux, stdio is +usually available on /dev/ttyACM0. Use the `term` target to access stdio: + +``` +BOARD=microbit make term +``` + + */ diff --git a/boards/microbit-v2/include/board.h b/boards/microbit-v2/include/board.h new file mode 100644 index 0000000000..b97fe394f7 --- /dev/null +++ b/boards/microbit-v2/include/board.h @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2021 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_microbit_v2 + * @{ + * + * @file + * @brief Board specific configuration for the BBC micro:bit v2 + * + * @author Alexandre Abadie + */ + +#ifndef BOARD_H +#define BOARD_H + +#include "board_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @name LED matrix pin configuration + * @{ + */ +#define MICROBIT_LED_COL1 GPIO_PIN(0, 28) +#define MICROBIT_LED_COL2 GPIO_PIN(0, 11) +#define MICROBIT_LED_COL3 GPIO_PIN(0, 31) +#define MICROBIT_LED_COL4 GPIO_PIN(1, 5) +#define MICROBIT_LED_COL5 GPIO_PIN(0, 30) +#define MICROBIT_LED_ROW1 GPIO_PIN(0, 21) +#define MICROBIT_LED_ROW2 GPIO_PIN(0, 22) +#define MICROBIT_LED_ROW3 GPIO_PIN(0, 15) +#define MICROBIT_LED_ROW4 GPIO_PIN(0, 24) +#define MICROBIT_LED_ROW5 GPIO_PIN(0, 19) +/** @} */ + +/** + * @name Button configuration + * @{ + */ +#define BTN0_PIN GPIO_PIN(0, 14) +#define BTN0_MODE GPIO_IN +#define BTN1_PIN GPIO_PIN(0, 23) +#define BTN1_MODE GPIO_IN +/** @} */ + +/** + * @name Microphone + * @{ + */ +#define RUN_MIC_PIN GPIO_PIN(0, 20) +#define MIC_IN_PIN GPIO_PIN(0, 5) +/** @} */ + +/** + * @name Speaker + * @{ + */ +#define SPEAKER_PIN GPIO_PIN(0, 0) +/** @} */ + +/** + * @name LSM303AGR accelerometer/magnetometer + * @{ + */ +#define LSM303AGR_PARAM_ACC_ADDR 0x19 +#define LSM303AGR_PARAM_MAG_ADDR 0x1E +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* BOARD_H */ +/** @} */ diff --git a/boards/microbit-v2/include/gpio_params.h b/boards/microbit-v2/include/gpio_params.h new file mode 100644 index 0000000000..3225945a02 --- /dev/null +++ b/boards/microbit-v2/include/gpio_params.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2021 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_microbit_v2 + * @{ + * + * @file + * @brief Board specific configuration of direct mapped GPIOs + * + * @author Alexandre Abadie + */ + +#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 = "Button A", + .pin = BTN0_PIN, + .mode = BTN0_MODE, + .flags = SAUL_GPIO_INVERTED, + }, + { + .name = "Button B", + .pin = BTN1_PIN, + .mode = BTN1_MODE, + .flags = SAUL_GPIO_INVERTED, + }, +}; + +#ifdef __cplusplus +} +#endif + +#endif /* GPIO_PARAMS_H */ +/** @} */ diff --git a/boards/microbit-v2/include/microbit.h b/boards/microbit-v2/include/microbit.h new file mode 100644 index 0000000000..cb69bda14e --- /dev/null +++ b/boards/microbit-v2/include/microbit.h @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2016 Freie Universität Berlin + * + * 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_microbit + * @{ + * + * @file + * @brief BBC micro:bit specific LED handling + * + * @author Hauke Petersen + */ + +#ifndef MICROBIT_H +#define MICROBIT_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Number of rows of the LED matrix + */ +#define MICROBIT_MATRIX_ROWS (5U) + +/** + * @brief Number of columns of the LED matrix + */ +#define MICROBIT_MATRIX_COLS (5U) + +/** + * @brief Initialize the micro:bit's LED matrix + */ +void microbit_matrix_init(void); + +/** + * @brief Turn on a single LED in the LED matrix + * + * @param[in] row row of the LED + * @param[in] col column of the LED + */ +void microbit_matrix_on(uint8_t row, uint8_t col); + +/** + * @brief Turn off a single LED in the LED matrix + * + * @param[in] row row of the LED + * @param[in] col column of the LED + */ +void microbit_matrix_off(uint8_t row, uint8_t col); + +/** + * @brief Write the given 'image' to the LED matrix + * + * In the given buffer, each byte represents one LED in the matrix, hence the + * buffer MUST be at least 25 byte wide. A byte value of `0` turns an LED off, + * while any other value turns it on. + * + * @param[in] buf new data to display, MUST be at least 25 byte + */ +void microbit_matrix_set_raw(const uint8_t *buf); + +/** + * @brief Write the given character to the matrix, using the Mineplex font + * + * @param[in] c character to display + */ +void microbit_matrix_set_char(char c); + +/** + * @brief Shift the given string through the LED matrix + * + * @param[in] str string do display + * @param[in] delay delay between each step [in us] + */ +void microbit_matrix_shift_str(const char *str, uint32_t delay); + +#ifdef __cplusplus +} +#endif + +#endif /* MICROBIT_H */ +/** @} */ diff --git a/boards/microbit-v2/include/periph_conf.h b/boards/microbit-v2/include/periph_conf.h new file mode 100644 index 0000000000..b5b142514f --- /dev/null +++ b/boards/microbit-v2/include/periph_conf.h @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2021 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_microbit_v2 + * @{ + * + * @file + * @brief Peripheral configuration for the BBC micro:bit v2 + * + * @author Alexandre Abadie + */ + +#ifndef PERIPH_CONF_H +#define PERIPH_CONF_H + +#include "board.h" +#include "periph_cpu.h" +#include "cfg_clock_32_0.h" +#include "cfg_timer_default.h" +#include "cfg_rtt_default.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enable the internal DC/DC converter + */ +#define NRF5X_ENABLE_DCDC + +/** + * @name UART configuration + * @{ + */ +static const uart_conf_t uart_config[] = { + { /* Mapped to USB virtual COM port */ + .dev = NRF_UARTE0, + .rx_pin = GPIO_PIN(1, 8), + .tx_pin = GPIO_PIN(0, 6), +#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 PWM configuration + * @{ + */ +static const pwm_conf_t pwm_config[] = { + { + NRF_PWM0, + { + SPEAKER_PIN, /* configure Speaker pin as PWM */ + GPIO_UNDEF, + GPIO_UNDEF, + GPIO_UNDEF, + } + }, +}; +#define PWM_NUMOF ARRAY_SIZE(pwm_config) +/** @} */ + +/** + * @name I2C configuration + * @{ + */ +static const i2c_conf_t i2c_config[] = { + { /* Internal I2C */ + .dev = NRF_TWIM1, + .scl = GPIO_PIN(0, 8), + .sda = GPIO_PIN(0, 16), + .speed = I2C_SPEED_NORMAL + }, + { /* External I2C */ + .dev = NRF_TWIM0, + .scl = GPIO_PIN(0, 26), /* P19 */ + .sda = GPIO_PIN(1, 0), /* P20 */ + .speed = I2C_SPEED_NORMAL + }, +}; +#define I2C_NUMOF ARRAY_SIZE(i2c_config) +/** @} */ + +/** + * @name SPI configuration + * @{ + */ +static const spi_conf_t spi_config[] = { + { + .dev = NRF_SPIM0, + .sclk = GPIO_PIN(0, 17), /* P13 */ + .mosi = GPIO_PIN(0, 13), /* P15 */ + .miso = GPIO_PIN(0, 1), /* P14 */ +#ifdef ERRATA_SPI_SINGLE_BYTE_WORKAROUND + .ppi = 0, +#endif + } +}; + +#define SPI_NUMOF ARRAY_SIZE(spi_config) +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* PERIPH_CONF_H */ +/** @} */ diff --git a/boards/microbit-v2/microbit/Makefile b/boards/microbit-v2/microbit/Makefile new file mode 100644 index 0000000000..48422e909a --- /dev/null +++ b/boards/microbit-v2/microbit/Makefile @@ -0,0 +1 @@ +include $(RIOTBASE)/Makefile.base diff --git a/boards/microbit-v2/microbit/microbit.c b/boards/microbit-v2/microbit/microbit.c new file mode 100644 index 0000000000..63f3bcaf97 --- /dev/null +++ b/boards/microbit-v2/microbit/microbit.c @@ -0,0 +1,224 @@ +/* + * Copyright (C) 2016 Freie Universität Berlin + * 2021 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_microbit_v2 + * @{ + * + * @file + * @brief BBC micro:bit v2 specific LED matrix handling + * + * @author Hauke Petersen + * @author Alexandre Abadie + * + * @} + */ + +#include +#include "xtimer.h" + +#include "board.h" +#include "microbit.h" +#include "mineplex.h" +#include "periph/gpio.h" +#include "periph/timer.h" + +#define ENABLE_DEBUG 0 +#include "debug.h" + +/** + * @brief The visible number of rows and columns of the LED matrix + */ +#define ROWS MICROBIT_MATRIX_ROWS +#define COLS MICROBIT_MATRIX_COLS + +/** + * @brief The electrical number of rows and columns + */ +#define ROWS_HW (5U) +#define COLS_HW (5U) + +/** + * @brief The refresh rate used for drawing the contents + * + * We want a refresh rate of at least 50Hz (->20ms), so the LEDs do not flicker. + */ +#define REFRESH (6000) /* 6ms * 5 rows -> ~55Hz */ + +/** + * @brief GPIO pins driving the rows + */ +static const gpio_t rows[ROWS_HW] = { + MICROBIT_LED_ROW1, + MICROBIT_LED_ROW2, + MICROBIT_LED_ROW3, + MICROBIT_LED_ROW4, + MICROBIT_LED_ROW5, +}; + +/** + * @brief GPIO pins driving the columns + */ +static const gpio_t cols[COLS_HW] = { + MICROBIT_LED_COL1, + MICROBIT_LED_COL2, + MICROBIT_LED_COL3, + MICROBIT_LED_COL4, + MICROBIT_LED_COL5, +}; + +/** + * @brief Map electrical layout to visible layout + */ +static const uint8_t pixmap[5][5] = { + { 0, 1, 2, 3, 4 }, + { 5, 6, 7, 8, 9 }, + { 10, 11, 12, 13, 14 }, + { 15, 16, 17, 18, 19 }, + { 20, 21, 22, 23, 24 } +}; + +/** + * @brief Buffer holding the current 'image' that is displayed + */ +static uint8_t framebuf[ROWS_HW * COLS_HW] = { 0 }; + +/** + * @brief Internal counter to keep track of which row needs to be refreshed + * next + */ +static unsigned cur_row = 0; + +/** + * @brief Write a Mineplex encoded character into the given buffer + * + * @param[in] c character to write + * @param[out] buf buffer to write the encoded character into, MUST be able to + * hold 25 byte + */ +static void char2buf(char c, uint8_t *buf) +{ + const uint8_t *raw = mineplex_char(c); + + /* set each row */ + for (unsigned row = 0; row < ROWS; row++) { + for (unsigned col = 0; col < COLS; col++) { + buf[(row * COLS) + col] = (raw[row] & (1 << col)); + } + } +} + +/** + * @brief Shift out and replace an image with the next, column by column + * + * @param[in|out] cur current 'image', will be overwritten + * @param[in] next image to shift in + * @param[in] delay delay between each column + */ +static void shift_next(uint8_t *cur, const uint8_t *next, uint32_t delay) +{ + for (unsigned i = 0; i < COLS; i++) { + for (unsigned r = 0; r < ROWS; r++) { + for (unsigned c = 0; c < (COLS - 1); c++) { + cur[(r * COLS) + c] = cur[(r * COLS) + c + 1]; + } + cur[(r * COLS) + COLS - 1] = next[(r * COLS) + i]; + } + microbit_matrix_set_raw((uint8_t *)cur); + xtimer_usleep(delay); + } +} + +static void refresh(void *arg, int channel) +{ + (void)arg; + (void)channel; + + /* set next refresh */ + timer_set(TIMER_DEV(1), 0, REFRESH); + + /* disable current row */ + gpio_clear(rows[cur_row]); + /* goto next row */ + cur_row = ((++cur_row) < ROWS_HW) ? cur_row : 0; + /* setup columns */ + unsigned base = (COLS_HW * cur_row); + for (unsigned i = 0; i < COLS_HW; i++) { + gpio_write(cols[i], !(framebuf[base + i])); + } + /* and finally enable the new row */ + gpio_set(rows[cur_row]); +} + +void microbit_matrix_init(void) +{ + /* initialize rows */ + for (unsigned i = 0; i < ROWS_HW; i++) { + gpio_init(rows[i], GPIO_OUT); + gpio_clear(rows[i]); + } + /* initialize columns */ + for (unsigned i = 0; i < COLS_HW; i++) { + gpio_init(cols[i], GPIO_OUT); + gpio_set(cols[i]); + } + /* and finally initialize and start the refresh timer */ + timer_init(TIMER_DEV(1), 1000000, refresh, NULL); + timer_set(TIMER_DEV(1), 0, REFRESH); +} + +void microbit_matrix_on(uint8_t row, uint8_t col) +{ + if ((row >= 5) || (col >= 5)) { + return; + } + + framebuf[pixmap[row][col]] = 0x01; +} + +void microbit_matrix_off(uint8_t row, uint8_t col) +{ + if ((row >= 5) || (col >= 5)) { + return; + } + + framebuf[pixmap[row][col]] = 0x00; +} + +void microbit_matrix_set_raw(const uint8_t *buf) +{ + for (unsigned row = 0; row < ROWS; row++) { + for (unsigned col = 0; col < COLS; col++) { + framebuf[pixmap[row][col]] = buf[(row * COLS) + col]; + } + } +} + +void microbit_matrix_set_char(char c) +{ + uint8_t buf[ROWS * COLS]; + + char2buf(c, buf); + microbit_matrix_set_raw(buf); +} + +void microbit_matrix_shift_str(const char *str, uint32_t delay) +{ + uint8_t curbuf[ROWS][COLS]; + uint8_t newbuf[ROWS][COLS]; + + char2buf(' ', (uint8_t *)curbuf); + microbit_matrix_set_raw((uint8_t *)curbuf); + while (*str) { + char2buf(*str++, (uint8_t *)newbuf); + shift_next((uint8_t *)curbuf, (uint8_t *)newbuf, delay); + } + char2buf(' ', (uint8_t *)newbuf); + shift_next((uint8_t *)curbuf, (uint8_t *)newbuf, delay); +} diff --git a/cpu/nrf52/Makefile.features b/cpu/nrf52/Makefile.features index 3bcda9ceca..c38bdd3cac 100644 --- a/cpu/nrf52/Makefile.features +++ b/cpu/nrf52/Makefile.features @@ -6,7 +6,7 @@ endif CPU_FAM = nrf52 # The 802.15.4 radio is not available on all SoCs -ifneq (,$(filter nrf52811xxaa nrf52820xxaa rf52833xxaa nrf52840xxaa,$(CPU_MODEL))) +ifneq (,$(filter nrf52811xxaa nrf52820xxaa nrf52833xxaa nrf52840xxaa,$(CPU_MODEL))) FEATURES_PROVIDED += radio_nrf802154 endif diff --git a/cpu/nrf5x_common/include/periph_cpu_common.h b/cpu/nrf5x_common/include/periph_cpu_common.h index d305624d65..38db22ec80 100644 --- a/cpu/nrf5x_common/include/periph_cpu_common.h +++ b/cpu/nrf5x_common/include/periph_cpu_common.h @@ -46,7 +46,7 @@ extern "C" { * * The port definition is used (and zeroed) to suppress compiler warnings */ -#ifdef CPU_MODEL_NRF52840XXAA +#if !defined(CPU_MODEL_NRF52832XXAA) && !defined(CPU_FAM_NRF51) #define GPIO_PIN(x,y) ((x << 5) | y) #else #define GPIO_PIN(x,y) ((x & 0) | y) diff --git a/cpu/nrf5x_common/periph/gpio.c b/cpu/nrf5x_common/periph/gpio.c index dc91a1241e..a838854a18 100644 --- a/cpu/nrf5x_common/periph/gpio.c +++ b/cpu/nrf5x_common/periph/gpio.c @@ -86,7 +86,7 @@ static inline NRF_GPIO_Type *port(gpio_t pin) */ static inline int pin_num(gpio_t pin) { -#ifdef CPU_MODEL_NRF52840XXAA +#if !defined(CPU_MODEL_NRF52832XXAA) && !defined(CPU_FAM_NRF51) return (pin & PIN_MASK); #else return (int)pin; @@ -184,7 +184,7 @@ int gpio_init_int(gpio_t pin, gpio_mode_t mode, gpio_flank_t flank, /* configure the GPIOTE channel: set even mode, pin and active flank */ NRF_GPIOTE->CONFIG[_pin_index] = (GPIOTE_CONFIG_MODE_Event | (pin_num(pin) << GPIOTE_CONFIG_PSEL_Pos) | -#ifdef CPU_MODEL_NRF52840XXAA +#if !defined(CPU_MODEL_NRF52832XXAA) && !defined(CPU_FAM_NRF51) ((pin & PORT_BIT) << 8) | #endif (flank << GPIOTE_CONFIG_POLARITY_Pos)); diff --git a/cpu/nrf5x_common/periph/uart.c b/cpu/nrf5x_common/periph/uart.c index 9f798ccaff..e1778abeba 100644 --- a/cpu/nrf5x_common/periph/uart.c +++ b/cpu/nrf5x_common/periph/uart.c @@ -85,7 +85,7 @@ static inline NRF_UARTE_Type *dev(uart_t uart) */ static uart_isr_ctx_t isr_ctx; -#endif /* CPU_MODEL_NRF52840XXAA || CPU_MODEL_NRF52811XXAA */ +#endif /* !CPU_MODEL_NRF52832XXAA && !CPU_FAM_NRF51 */ int uart_init(uart_t uart, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg) { @@ -415,7 +415,7 @@ static inline void irq_handler(uart_t uart) cortexm_isr_end(); } -#endif /* CPU_MODEL_NRF52840XXAA || CPU_MODEL_NRF5211XXAA */ +#endif /* !CPU_MODEL_NRF52832XXAA && !CPU_FAM_NRF51 */ #ifdef UART_0_ISR void UART_0_ISR(void) diff --git a/examples/default/Makefile b/examples/default/Makefile index 3a396f87e9..a26521b58e 100644 --- a/examples/default/Makefile +++ b/examples/default/Makefile @@ -36,7 +36,7 @@ USEMODULE += saul_default BOARD_PROVIDES_NETIF := acd52832 adafruit-clue airfy-beacon atmega256rfr2-xpro \ arduino-nano-33-ble avr-rss2 b-l072z-lrwan1 cc2538dk dwm1001 fox \ - derfmega128 derfmega256 hamilton iotlab-m3 iotlab-a8-m3 lobaro-lorabox lsn50 mulle microbit msba2 \ + derfmega128 derfmega256 hamilton iotlab-m3 iotlab-a8-m3 lobaro-lorabox lsn50 mulle microbit microbit-v2 msba2 \ microduino-corerf native nrf51dk nrf51dongle nrf52dk nrf52840dk nrf52840-mdk nrf52840dongle nrf6310 \ nucleo-f207zg nucleo-f767zi openmote-b openmote-cc2538 pba-d-01-kw2x remote-pa \ remote-reva ruuvitag same54-xpro samr21-xpro samr30-xpro spark-core telosb thingy52 yunjia-nrf51822 z1 \ diff --git a/tests/board_microbit/Makefile b/tests/board_microbit/Makefile index 6330d8c9d8..bd9b8a08b2 100644 --- a/tests/board_microbit/Makefile +++ b/tests/board_microbit/Makefile @@ -3,7 +3,7 @@ BOARD ?= microbit include ../Makefile.tests_common # This test application is for the BBC micro:bit only -BOARD_WHITELIST := microbit +BOARD_WHITELIST := microbit microbit-v2 # We want to test the microbit support module USEMODULE += microbit