Skip to content

Commit

Permalink
boards/adafruit-metro-m4-express: make use of SERCOM sharing
Browse files Browse the repository at this point in the history
Now that time-sharing SERCOMs is possible, we can provide the SPI on
D11/D12/D13 (backed by SERCOM3) also when the UART on D0/D1 (also backed
by SERCOM3) is used.
  • Loading branch information
maribu committed Nov 27, 2024
1 parent 2b0d81b commit 6d8d1bd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
8 changes: 1 addition & 7 deletions boards/adafruit-metro-m4-express/include/arduino_iomap.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,8 @@ extern "C" {

/**
* @brief SPI_DEV(1) is connected to D11/D12/D13
*
* The SPI on D11/D12/D13 is only available when `periph_uart` is not used due
* to a conflicting use of the same SERCOM. If it is available, it is the last
* SPI bus.
*/
#if !MODULE_PERIPH_UART
# define ARDUINO_SPI_D11D12D13 SPI_DEV(1)
#endif
#define ARDUINO_SPI_D11D12D13 SPI_DEV(1)
/** @} */

/**
Expand Down
6 changes: 2 additions & 4 deletions boards/adafruit-metro-m4-express/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ static const spi_conf_t spi_config[] = {
.rx_trigger = SERCOM2_DMAC_ID_RX,
#endif
},
#if !MODULE_PERIPH_UART
{ /* D11=MOSI, D12=MISO, D13=SCK */
.dev = &(SERCOM3->SPI),
.miso_pin = GPIO_PIN(PA, 17), /* C: SERCOM1.1, D: SERCOM3.0 */
Expand All @@ -181,12 +180,11 @@ static const spi_conf_t spi_config[] = {
.miso_pad = SPI_PAD_MISO_0,
.mosi_pad = SPI_PAD_MOSI_3_SCK_1,
.gclk_src = SAM0_GCLK_PERIPH,
# if MODULE_PERIPH_DMA
#if MODULE_PERIPH_DMA
.tx_trigger = SERCOM3_DMAC_ID_TX,
.rx_trigger = SERCOM3_DMAC_ID_RX,
# endif
},
#endif
},
#if MODULE_PERIPH_SPI_ON_QSPI
{ /* QSPI in SPI mode */
.dev = QSPI,
Expand Down

0 comments on commit 6d8d1bd

Please sign in to comment.