Skip to content

Commit 8c4e1e2

Browse files
RSATomdexter93
authored andcommitted
sn32: spi: cosmetic refactoring
1 parent 687ae28 commit 8c4e1e2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

os/hal/ports/SN32/LLD/SN32F2xx/SPI/hal_spi_v2_lld.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,13 @@ SPIDriver SPID1;
5858

5959
static void spi_lld_configure(SPIDriver *spip) {
6060
spip->spi->CTRL0 = spip->config->ctrl0;
61+
spip->spi->CTRL0_b.SELDIS = SPI_SELECT_MODE != SPI_SELECT_MODE_LLD;
62+
spip->spi->CTRL0_b.MS = spip->config->slave;
63+
spip->spi->CTRL0_b.SDODIS = false;
64+
6165
spip->spi->CTRL1 = (uint32_t)spip->config->ctrl1;
62-
spip->spi->CLKDIV = (uint32_t)spip->config->clkdiv;
6366

64-
spip->spi->CTRL0 |= (spip->config->slave << 3);
65-
spip->spi->CTRL0_b.SDODIS = false;
66-
spip->spi->CTRL0_b.SELDIS = SPI_SELECT_MODE != SPI_SELECT_MODE_LLD;
67+
spip->spi->CLKDIV = (uint32_t)spip->config->clkdiv;
6768

6869
uint32_t sn32_spi_clock = (SN32_HCLK / ((2 * spip->config->clkdiv) + 2));
6970
if (sn32_spi_clock > 6000000) {

0 commit comments

Comments
 (0)