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.
Fork of mbed-dev by
Diff: targets/TARGET_STM/stm_spi_api.c
- Revision:
- 179:b0033dcd6934
- Parent:
- 173:e131a1973e81
- Child:
- 181:57724642e740
--- a/targets/TARGET_STM/stm_spi_api.c Thu Nov 23 11:57:25 2017 +0000
+++ b/targets/TARGET_STM/stm_spi_api.c Thu Dec 07 14:01:42 2017 +0000
@@ -29,6 +29,7 @@
*/
#include "mbed_assert.h"
#include "mbed_error.h"
+#include "mbed_debug.h"
#include "spi_api.h"
#if DEVICE_SPI
@@ -286,6 +287,16 @@
handle->Init.Mode = (slave) ? SPI_MODE_SLAVE : SPI_MODE_MASTER;
+ if (slave && (handle->Init.Direction == SPI_DIRECTION_1LINE)) {
+ /* SPI slave implemtation in MBED does not support the 3 wires SPI.
+ * (e.g. when MISO is not connected). So we're forcing slave in
+ * 2LINES mode. As MISO is not connected, slave will only read
+ * from master, and cannot write to it. Inform user.
+ */
+ debug("3 wires SPI slave not supported - slave will only read\r\n");
+ handle->Init.Direction = SPI_DIRECTION_2LINES;
+ }
+
init_spi(obj);
}
