Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mbed_blinky-bmd-200 bmd-200_accel_demo firstRig
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_STM32F3XX/spi_api.c
- Revision:
- 556:a1b9575155a3
- Parent:
- 227:7bd0639b8911
--- a/targets/hal/TARGET_STM/TARGET_STM32F3XX/spi_api.c Wed May 27 09:30:08 2015 +0100
+++ b/targets/hal/TARGET_STM/TARGET_STM32F3XX/spi_api.c Wed May 27 13:30:08 2015 +0100
@@ -123,13 +123,10 @@
obj->cpha = SPI_CPHA_1Edge;
obj->br_presc = SPI_BaudRatePrescaler_256;
- if (ssel == NC) { // Master
- obj->mode = SPI_Mode_Master;
- obj->nss = SPI_NSS_Soft;
- } else { // Slave
+ if (ssel != NC) {
pinmap_pinout(ssel, PinMap_SPI_SSEL);
- obj->mode = SPI_Mode_Slave;
- obj->nss = SPI_NSS_Soft;
+ } else {
+ obj->nss = SPI_NSS_SOFT;
}
init_spi(obj);
@@ -167,14 +164,12 @@
break;
}
- if (slave == 0) {
- obj->mode = SPI_Mode_Master;
- obj->nss = SPI_NSS_Soft;
- } else {
- obj->mode = SPI_Mode_Slave;
- obj->nss = SPI_NSS_Hard;
+ if (obj->nss != SPI_NSS_SOFT) {
+ obj->nss = (slave) ? SPI_NSS_HARD_INPUT : SPI_NSS_HARD_OUTPUT;
}
+ obj->mode = (slave) ? SPI_MODE_SLAVE : SPI_MODE_MASTER;
+
init_spi(obj);
}
