From ace88aa8808d323f47287c158a8ce277f723ce1f Mon Sep 17 00:00:00 2001 From: Steven Cooreman Date: Tue, 9 Jul 2019 22:48:37 +0100 Subject: [PATCH] Avoid the FPGA tester using hardware CS which is not supported Also implement rudimentary spi_free... --- targets/TARGET_Silicon_Labs/TARGET_EFM32/spi_api.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/spi_api.c b/targets/TARGET_Silicon_Labs/TARGET_EFM32/spi_api.c index 0b0e2de7a4..c7a2b76d09 100644 --- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/spi_api.c +++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/spi_api.c @@ -274,6 +274,12 @@ void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName clk, PinName cs) spi_enable(obj, true); } +void spi_free(spi_t *obj) +{ + spi_enable(obj, false); + USART_Reset(obj->spi.spi); +} + void spi_enable_event(spi_t *obj, uint32_t event, uint8_t enable) { if(enable) obj->spi.event |= event; @@ -1434,7 +1440,9 @@ const PinMap *spi_master_miso_pinmap() const PinMap *spi_master_clk_pinmap() { - return PinMap_SPI_CLK; + // We don't currently support hardware CS in master mode. + static const PinMap PinMap_SPI_CLK_mod[] = {NC , NC , NC}; + return PinMap_SPI_CLK_mod; } const PinMap *spi_master_cs_pinmap()