Skip to content

Commit c2f0dcd

Browse files
stevew817c1728p9
authored andcommitted
Avoid the FPGA tester using hardware CS which is not supported
Also implement rudimentary spi_free...
1 parent 3fbeefa commit c2f0dcd

File tree

1 file changed

+9
-1
lines changed
  • targets/TARGET_Silicon_Labs/TARGET_EFM32

1 file changed

+9
-1
lines changed

targets/TARGET_Silicon_Labs/TARGET_EFM32/spi_api.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,12 @@ void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName clk, PinName cs)
274274
spi_enable(obj, true);
275275
}
276276

277+
void spi_free(spi_t *obj)
278+
{
279+
spi_enable(obj, false);
280+
USART_Reset(obj->spi.spi);
281+
}
282+
277283
void spi_enable_event(spi_t *obj, uint32_t event, uint8_t enable)
278284
{
279285
if(enable) obj->spi.event |= event;
@@ -1434,7 +1440,9 @@ const PinMap *spi_master_miso_pinmap()
14341440

14351441
const PinMap *spi_master_clk_pinmap()
14361442
{
1437-
return PinMap_SPI_CLK;
1443+
// We don't currently support hardware CS in master mode.
1444+
static const PinMap PinMap_SPI_CLK_mod[] = {NC , NC , NC};
1445+
return PinMap_SPI_CLK_mod;
14381446
}
14391447

14401448
const PinMap *spi_master_cs_pinmap()

0 commit comments

Comments
 (0)