1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00

Merge pull request #21463 from dpproto/21462-seeedstudio-xiao-esp32c3-fix-pin-conflict

boards/seeedstudio-xiao-esp32c3: fix pin conflict
This commit is contained in:
Gunar Schorcht 2025-05-19 13:55:25 +00:00 committed by GitHub
commit 99b4dd5abe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 38 additions and 14 deletions

View File

@ -1,9 +1,17 @@
ifneq (,$(filter periph_spi, $(USEMODULE)))
ifeq (,$(filter periph_init_buttons, $(DISABLE_MODULE)))
DISABLE_MODULE += periph_init_buttons
MSG="Warning: Using periph_spi on Seeed Studio Xiao ESP32C3 board will disable BUTTON0 due to pin conflict."
$(shell $(COLOR_ECHO) "$(COLOR_YELLOW)$(MSG)$(COLOR_RESET)" 1>&2)
endif
else ifneq (,$(filter saul_default,$(USEMODULE)))
# The button is the only SAUL device. Enable it only when SPI is not enabled.
USEMODULE += saul_gpio
endif
ifeq (,$(filter stdio_% slipdev_stdio,$(USEMODULE)))
USEMODULE += stdio_usb_serial_jtag
endif
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif
include $(RIOTBOARD)/common/esp32c3/Makefile.dep

View File

@ -14,4 +14,7 @@ FEATURES_PROVIDED += esp_jtag
# Various other features (if any)
FEATURES_PROVIDED += arduino_pins
FEATURES_PROVIDED += arduino_analog
FEATURES_PROVIDED += arduino_i2c
FEATURES_PROVIDED += arduino_spi
FEATURES_PROVIDED += xiao_shield

View File

@ -74,7 +74,7 @@ GPIO overview:
- 1 x SPI
- 1 x I2C
- 1 x UART
- 11 x PWM channels (only 4 defined by default)
- 11 x PWM channels (only 3 defined by default)
The purpose for which a GPIO is used depends on which module
or function is used first. For example, if module `periph_spi` is not used,
@ -91,7 +91,7 @@ BUTTON0 | GPIO9 | GPIO9 is a [strapping pin](https://doc
ADC | GPIO2, GPIO3, GPIO4 | \ref esp32_adc_channels "ADC Channels"
I2C_DEV(0):SCL | GPIO7 | \ref esp32_i2c_interfaces "I2C Interfaces"
I2C_DEV(0):SDA | GPIO6 | \ref esp32_i2c_interfaces "I2C Interfaces"
PWM_DEV(0) | GPIO2, GPIO3, GPIO4, GPIO5 | \ref esp32_pwm_channels "PWM Channels"
PWM_DEV(0) | GPIO2, GPIO3, GPIO4 | \ref esp32_pwm_channels "PWM Channels"
SPI_DEV(0):SCK | GPIO8 | \ref esp32_spi_interfaces "SPI Interfaces"
SPI_DEV(0):MISO | GPIO9 | \ref esp32_spi_interfaces "SPI Interfaces"
SPI_DEV(0):MOSI | GPIO10 | \ref esp32_spi_interfaces "SPI Interfaces"
@ -103,6 +103,9 @@ UART_DEV(0):RxD | GPIO20 | \ref esp32_uart_interfaces "UART inter
@note The configuration of ADC channels contains all ESP32-C3 GPIOs that could
be used as ADC channels.
@note BUTTON0 conflicts with the SPI MISO line. If the SPI
module is enabled, the button will be automatically disabled.
For detailed information about the peripheral configurations of ESP32-C3
boards, see section \ref esp32_peripherals "Common Peripherals".

View File

@ -42,16 +42,18 @@ extern "C" {
#define ARDUINO_PIN_9 GPIO9 /**< Arduino pin 0 (SPI MISO)*/
#define ARDUINO_PIN_10 GPIO10 /**< Arduino pin 0 (SPI MOSI) */
#define ARDUINO_PIN_LAST 10
#define ARDUINO_PIN_LAST 10 /**< Last Arduino pin index. */
/** @} */
/**
* @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_A0 ADC_LINE(0) /**< ADC line for Arduino pin A0 */
#define ARDUINO_A1 ADC_LINE(1) /**< ADC line for Arduino pin A1 */
#define ARDUINO_A2 ADC_LINE(2) /**< ADC line for Arduino pin A2 */
#define ARDUINO_ANALOG_PIN_LAST 2 /**< Last Arduino analog pin index */
/** @} */
#ifdef __cplusplus

View File

@ -20,6 +20,7 @@
#include <stdint.h>
#if MODULE_PERIPH_INIT_BUTTONS || DOXYGEN
/**
* @name Button pin definitions
* @{
@ -31,8 +32,11 @@
* Pressing the button will give a low signal.
*
* @note GPIO9 is a strapping pin that must be pulled up a boot time
* in order to boot the user application.
* After boot, it can be used as user button.
* in order to boot the user application.
* After boot, it can be used as user button.
*
* @note \c BTN0_PIN conflicts with the SPI MISO line. If the SPI
* module is enabled, the button will be automatically disabled.
*/
#define BTN0_PIN GPIO9
@ -59,6 +63,7 @@
#define BUTTON0_PIN BTN0_PIN
/** @} */
#endif
/* include common board definitions as last step */
#include "board_common.h"

View File

@ -25,15 +25,17 @@ extern "C" {
#endif
/**
* @brief LED and Button configuration
* @brief Button configuration
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
{
#ifdef MODULE_PERIPH_INIT_BUTTONS
.name = "BOOT",
.pin = BTN0_PIN,
.mode = BTN0_MODE,
.flags = SAUL_GPIO_INVERTED
#endif
},
};

View File

@ -98,7 +98,7 @@ extern "C" {
* at maximum PWM_CHANNEL_NUM_DEV_MAX.
*/
#ifndef PWM0_GPIOS
#define PWM0_GPIOS { GPIO2, GPIO3, GPIO4, GPIO5 }
#define PWM0_GPIOS { GPIO2, GPIO3, GPIO4 }
#endif
/** @} */

View File

@ -15,3 +15,4 @@ DEFAULT_MODULE += periph_init_led4
DEFAULT_MODULE += periph_init_led5
DEFAULT_MODULE += periph_init_led6
DEFAULT_MODULE += periph_init_led7
DEFAULT_MODULE += periph_init_buttons