mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-26 23:11:19 +01:00
- Move common code for USART (shared SPI / UART peripheral) to its
own file and allow sharing the USART peripheral to provide both
UART and SPI in round-robin fashion.
- Configure both UART and SPI bus via a `struct` in the board's
`periph_conf.h`
- this allows allocating the two UARTs as needed by the use case
- since both USARTs signals have a fixed connection to a single
GPIO, most configuration is moved to the CPU
- the board now only needs to decide which bus is provided by
which USART
Note: Sharing an USART used as UART requires cooperation from the app:
- If the UART is used in TX-only mode (no RX callback), the driver
will release the USART while not sending
- If the UART is used to also receive, the application needs to power
the UART down while not expecting something to send. An
`spi_acquire()` will be blocked while the UART is powered up.
25 lines
684 B
Makefile
25 lines
684 B
Makefile
MODULE = periph
|
|
|
|
# All supported MSP430 families use special serial IP block that implements
|
|
# various serial bus interfaces using the same hardware block. For the
|
|
# MSP430 x1xx family, the block is called USART. For the MSP430 F2xx/G2xx
|
|
# family it is the (incompatible) USCI.
|
|
ifeq (msp430_x1xx,$(CPU_FAM))
|
|
SERIAL_IP_BLOCK := usart
|
|
SRC += $(SERIAL_IP_BLOCK).c
|
|
endif
|
|
ifeq (msp430_f2xx_g2xx,$(CPU_FAM))
|
|
SERIAL_IP_BLOCK := usci
|
|
endif
|
|
|
|
# select family specific peripheral drivers.
|
|
ifneq (,$(filter periph_uart,$(USEMODULE)))
|
|
SRC += uart_$(SERIAL_IP_BLOCK).c
|
|
endif
|
|
|
|
ifneq (,$(filter periph_spi,$(USEMODULE)))
|
|
SRC += spi_$(SERIAL_IP_BLOCK).c
|
|
endif
|
|
|
|
include $(RIOTMAKE)/periph.mk
|