mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
boards/seeedstudio-xiao-nrf52840: Arduino pin map
This commit is contained in:
parent
a636cfe394
commit
72f9fb0c9d
@ -7,6 +7,12 @@ FEATURES_PROVIDED += periph_uart
|
||||
FEATURES_PROVIDED += periph_usbdev
|
||||
|
||||
# Various other features (if any)
|
||||
FEATURES_PROVIDED += arduino_analog
|
||||
FEATURES_PROVIDED += arduino_i2c
|
||||
FEATURES_PROVIDED += arduino_pins
|
||||
FEATURES_PROVIDED += arduino_spi
|
||||
FEATURES_PROVIDED += arduino_uart
|
||||
FEATURES_PROVIDED += highlevel_stdio
|
||||
FEATURES_PROVIDED += xiao_shield
|
||||
|
||||
include $(RIOTBOARD)/common/nrf52/Makefile.features
|
||||
|
132
boards/seeedstudio-xiao-nrf52840/include/arduino_iomap.h
Normal file
132
boards/seeedstudio-xiao-nrf52840/include/arduino_iomap.h
Normal file
@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (C) 2024 TU Dresden
|
||||
*
|
||||
* 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_seeedstudio-xiao-nrf52840
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Mapping from MCU pins to Arduino pins
|
||||
*
|
||||
* You can use the defines in this file for simplified interaction with the
|
||||
* Arduino specific pin numbers.
|
||||
*
|
||||
* @author Mikolai Gütschow <mikolai.guetschow@tu-dresden.de>
|
||||
*/
|
||||
|
||||
#ifndef ARDUINO_IOMAP_H
|
||||
#define ARDUINO_IOMAP_H
|
||||
|
||||
#include "periph/gpio.h"
|
||||
#include "periph/adc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name XIAO's UART devices
|
||||
* @{
|
||||
* @brief Arduino's Serial uses USB-CDC-ACM stdio by default
|
||||
*/
|
||||
#define ARDUINO_UART_DEV UART_UNDEF
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name XIAO's SPI buses
|
||||
* @{
|
||||
*/
|
||||
#define ARDUINO_SPI_DEV SPI_DEV(0)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name XIAO's I2C buses
|
||||
* @{
|
||||
*/
|
||||
#define ARDUINO_I2C_DEV I2C_DEV(0)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name XIAO's on-board LED (LED_BUILTIN)
|
||||
* @{
|
||||
*/
|
||||
#define ARDUINO_LED (11)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Mapping of MCU pins to Arduino pins
|
||||
* @{
|
||||
*/
|
||||
/* Left pins */
|
||||
#define ARDUINO_PIN_0 GPIO_PIN(0, 2)
|
||||
#define ARDUINO_PIN_1 GPIO_PIN(0, 3)
|
||||
#define ARDUINO_PIN_2 GPIO_PIN(0,28)
|
||||
#define ARDUINO_PIN_3 GPIO_PIN(0,29)
|
||||
#define ARDUINO_PIN_4 GPIO_PIN(0, 4)
|
||||
#define ARDUINO_PIN_5 GPIO_PIN(0, 5)
|
||||
#define ARDUINO_PIN_6 GPIO_PIN(1,11)
|
||||
|
||||
/* Right side */
|
||||
#define ARDUINO_PIN_7 GPIO_PIN(1,12)
|
||||
#define ARDUINO_PIN_8 GPIO_PIN(1,13)
|
||||
#define ARDUINO_PIN_9 GPIO_PIN(1,14)
|
||||
#define ARDUINO_PIN_10 GPIO_PIN(1,15)
|
||||
|
||||
/* Internal (LEDs) */
|
||||
#define ARDUINO_PIN_11 GPIO_PIN(0,26)
|
||||
#define ARDUINO_PIN_12 GPIO_PIN(0, 6)
|
||||
#define ARDUINO_PIN_13 GPIO_PIN(0,30)
|
||||
|
||||
#define ARDUINO_PIN_LAST 13
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Aliases for analog pins
|
||||
* @{
|
||||
*/
|
||||
#define ARDUINO_PIN_A0 ARDUINO_PIN_0
|
||||
#define ARDUINO_PIN_A1 ARDUINO_PIN_1
|
||||
#define ARDUINO_PIN_A2 ARDUINO_PIN_2
|
||||
#define ARDUINO_PIN_A3 ARDUINO_PIN_3
|
||||
#define ARDUINO_PIN_A4 ARDUINO_PIN_4
|
||||
#define ARDUINO_PIN_A5 ARDUINO_PIN_5
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Mapping of Arduino analog pins to RIOT ADC lines
|
||||
* @{
|
||||
*/
|
||||
/* The Seeed Studio XIAO nRF52840 has a fixed ADC to GPIO mapping:
|
||||
*
|
||||
* nRF | MCU pin | Exposed as Arduino pin
|
||||
* -----|-----------|-----------------------
|
||||
* AIN0 | P0.02 | A0 (D0)
|
||||
* AIN1 | P0.03 | A1 (D1)
|
||||
* AIN2 | P0.04 | A4 (D4)
|
||||
* AIN3 | P0.05 | A5 (D5)
|
||||
* AIN4 | P0.28 | A2 (D2)
|
||||
* AIN5 | P0.29 | A3 (D3)
|
||||
* AIN6 | P0.30 | - (D13)
|
||||
* AIN7 | P0.31 | - (-)
|
||||
*/
|
||||
#define ARDUINO_A0 ADC_LINE(0)
|
||||
#define ARDUINO_A1 ADC_LINE(1)
|
||||
#define ARDUINO_A2 ADC_LINE(4)
|
||||
#define ARDUINO_A3 ADC_LINE(5)
|
||||
#define ARDUINO_A4 ADC_LINE(2)
|
||||
#define ARDUINO_A5 ADC_LINE(3)
|
||||
|
||||
#define ARDUINO_ANALOG_PIN_LAST 5
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ARDUINO_IOMAP_H */
|
||||
/** @} */
|
@ -90,11 +90,12 @@ mapping. For the official Arduino boards and compatible boards, the
|
||||
Please extend the table below to keep naming among boards of the same form
|
||||
factor consistent:
|
||||
|
||||
| Form Factor | Macro Name | Description |
|
||||
|:------------- |:--------------------- |:--------------------------------- |
|
||||
| Arduino Nano | `ARDUINO_UART_D0D1` | UART on D0 (RXD) and D1 (TXD) |
|
||||
| Arduino Uno | `ARDUINO_UART_D0D1` | UART on D0 (RXD) and D1 (TXD) |
|
||||
| Arduino Mega | `ARDUINO_UART_D0D1` | UART on D0 (RXD) and D1 (TXD) |
|
||||
| Form Factor | Macro Name | Description |
|
||||
|:---------------- |:--------------------- |:--------------------------------- |
|
||||
| Arduino Nano | `ARDUINO_UART_D0D1` | UART on D0 (RXD) and D1 (TXD) |
|
||||
| Arduino Uno | `ARDUINO_UART_D0D1` | UART on D0 (RXD) and D1 (TXD) |
|
||||
| Arduino Mega | `ARDUINO_UART_D0D1` | UART on D0 (RXD) and D1 (TXD) |
|
||||
| Seeedstudio XIAO | `ARDUINO_UART_DEV` | UART on D7 (RXD) and D6 (TXD) |
|
||||
|
||||
I²C Buses {#iomaps-mapping-i2c}
|
||||
---------
|
||||
@ -102,13 +103,14 @@ I²C Buses {#iomaps-mapping-i2c}
|
||||
The feature `arduino_i2c` is provided by boards that do provide an I²C bus
|
||||
mapping.
|
||||
|
||||
| Form Factor | Macro Name | Description |
|
||||
|:------------- |:--------------------- |:--------------------------------- |
|
||||
| Arduino Nano | `ARDUINO_I2C_NANO` | D18 (SDA) / D19 (SCL) |
|
||||
| Arduino Uno | `ARDUINO_I2C_UNO` | D18 (SDA) / D19 (SCL) |
|
||||
| Arduino Mega | `ARDUINO_I2C_UNO` | D20 (SDA) / D21 (SCL) |
|
||||
| Arduino Zero | `ARDUINO_I2C_UNO` | D20 (SDA) / D21 (SCL) |
|
||||
| Arduino Due | `ARDUINO_I2C_UNO` | D70 (SDA) / D71 (SCL) |
|
||||
| Form Factor | Macro Name | Description |
|
||||
|:---------------- |:--------------------- |:--------------------------------- |
|
||||
| Arduino Nano | `ARDUINO_I2C_NANO` | D18 (SDA) / D19 (SCL) |
|
||||
| Arduino Uno | `ARDUINO_I2C_UNO` | D18 (SDA) / D19 (SCL) |
|
||||
| Arduino Mega | `ARDUINO_I2C_UNO` | D20 (SDA) / D21 (SCL) |
|
||||
| Arduino Zero | `ARDUINO_I2C_UNO` | D20 (SDA) / D21 (SCL) |
|
||||
| Arduino Due | `ARDUINO_I2C_UNO` | D70 (SDA) / D71 (SCL) |
|
||||
| Seeedstudio XIAO | `ARDUINO_I2C_DEV` | D4 (SDA) / D5 (SCL) |
|
||||
|
||||
The `ARDUINO_I2C_UNO` refers to the I²C bus next to the AREF pin (the topmost
|
||||
pins on header on the top right) of an Arduino Uno compatible board, e.g.
|
||||
@ -123,14 +125,15 @@ SPI Buses {#iomaps-mapping-spi}
|
||||
The feature `arduino_spi` is provided by boards that do provide an SPI bus
|
||||
mapping.
|
||||
|
||||
| Form Factor | Macro Name | Description |
|
||||
|:------------- |:------------------------- |:------------------------------------- |
|
||||
| Arduino Nano | `ARDUINO_SPI_ISP` | The SPI on the ISP header |
|
||||
| Arduino Nano | `ARDUINO_SPI_D11D12D13` | D11 (MOSI) / D12 (MISO) / D13 (SCK) |
|
||||
| Arduino Uno | `ARDUINO_SPI_ISP` | The SPI on the ISP header |
|
||||
| Arduino Uno | `ARDUINO_SPI_D11D12D13` | D11 (MOSI) / D12 (MISO) / D13 (SCK) |
|
||||
| Arduino Mega | `ARDUINO_SPI_ISP` | The SPI on the ISP header |
|
||||
| Arduino Mega | `ARDUINO_SPI_D11D12D13` | D11 (MOSI) / D12 (MISO) / D13 (SCK) |
|
||||
| Form Factor | Macro Name | Description |
|
||||
|:---------------- |:------------------------- |:------------------------------------- |
|
||||
| Arduino Nano | `ARDUINO_SPI_ISP` | The SPI on the ISP header |
|
||||
| Arduino Nano | `ARDUINO_SPI_D11D12D13` | D11 (MOSI) / D12 (MISO) / D13 (SCK) |
|
||||
| Arduino Uno | `ARDUINO_SPI_ISP` | The SPI on the ISP header |
|
||||
| Arduino Uno | `ARDUINO_SPI_D11D12D13` | D11 (MOSI) / D12 (MISO) / D13 (SCK) |
|
||||
| Arduino Mega | `ARDUINO_SPI_ISP` | The SPI on the ISP header |
|
||||
| Arduino Mega | `ARDUINO_SPI_D11D12D13` | D11 (MOSI) / D12 (MISO) / D13 (SCK) |
|
||||
| Seeedstudio XIAO | `ARDUINO_SPI_DEV` | D10 (MOSI) / D9 (MISO) / D8 (SCK) |
|
||||
|
||||
@note The original AVR based Arduinos only have a single hard SPI bus which
|
||||
is only provided via the ISP header. Many modern Arduino compatible
|
||||
@ -144,12 +147,12 @@ Modules implementing drivers for extension boards, a.k.a. shields, can express
|
||||
their mechanical and electrical requirements by depending on `arduino_shield_...`
|
||||
features. The following list of features currently exists:
|
||||
|
||||
| Feature Name | Compatibility Claim |
|
||||
|
|
||||
| `arduino_shield_nano` | Board has side headers compatible with the Arduino Nano |
|
||||
| `arduino_shield_uno` | Board has side headers compatible with the Arduino UNO |
|
||||
| `arduino_shield_mega` | Board has side headers compatible with the Arduino MEGA |
|
||||
| `arduino_shield_isp` | Board has an ISP header |
|
||||
| Feature Name | Compatibility Claim |
|
||||
|:--------------------- |:------------------------------------------------------------- |
|
||||
| `arduino_shield_nano` | Board has side headers compatible with the Arduino Nano |
|
||||
| `arduino_shield_uno` | Board has side headers compatible with the Arduino UNO |
|
||||
| `arduino_shield_mega` | Board has side headers compatible with the Arduino MEGA |
|
||||
| `xiao_shield` | Board has headers compatible with the Seeedstudio XIAO boards |
|
||||
|
||||
@note A board providing `arduino_shield_mega` **MUST** also provide
|
||||
`arduino_shield_uno`, as Arduino MEGA boards are backward compatible to
|
||||
|
@ -405,6 +405,10 @@ groups:
|
||||
Indicates that the board is mechanically and electrically compatible
|
||||
with shields developed for the Arduino Nano. (Note: Except the
|
||||
ISP header, that requires `arduino_shield_isp` in addition.)
|
||||
- name: xiao_shield
|
||||
help: >
|
||||
Indicates that the board is mechanically and electrically compatible
|
||||
with shields developed for the Seeed Studio XIAO board family.
|
||||
|
||||
- title: RAM Related Features
|
||||
help: These features indicate presence of special RAM regions or features
|
||||
|
@ -265,4 +265,5 @@ FEATURES_EXISTING := \
|
||||
tinyusb_device \
|
||||
vdd_lc_filter_reg0 \
|
||||
vdd_lc_filter_reg1 \
|
||||
xiao_shield \
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user