Skip to content

Commit 139f4fb

Browse files
committed
[NUCLEO_L152RE] Add SPI api
1 parent 3c54df7 commit 139f4fb

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/device.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141

4242
#define DEVICE_SERIAL 1
4343

44-
#define DEVICE_I2C 0
44+
#define DEVICE_I2C 1
4545
#define DEVICE_I2CSLAVE 0
4646

47-
#define DEVICE_SPI 0
47+
#define DEVICE_SPI 1
4848
#define DEVICE_SPISLAVE 0
4949

5050
#define DEVICE_RTC 1

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/spi_api.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,27 @@
3737
#include "error.h"
3838

3939
static const PinMap PinMap_SPI_MOSI[] = {
40-
{PA_7, SPI_1, STM_PIN_DATA(GPIO_Mode_AF_PP, 0)},
41-
{PB_5, SPI_1, STM_PIN_DATA(GPIO_Mode_AF_PP, 1)}, // Remap
40+
{PA_7, SPI_1, STM_PIN_DATA(GPIO_Mode_AF, GPIO_OType_PP, GPIO_PuPd_UP, GPIO_AF_SPI1)},
41+
{PA_12, SPI_1, STM_PIN_DATA(GPIO_Mode_AF, GPIO_OType_PP, GPIO_PuPd_UP, GPIO_AF_SPI1)}, // REMAP
4242
{NC, NC, 0}
4343
};
4444

4545
static const PinMap PinMap_SPI_MISO[] = {
46-
{PA_6, SPI_1, STM_PIN_DATA(GPIO_Mode_AF_PP, 0)},
47-
{PB_4, SPI_1, STM_PIN_DATA(GPIO_Mode_AF_PP, 1)}, // Remap
46+
{PA_6, SPI_1, STM_PIN_DATA(GPIO_Mode_AF, GPIO_OType_PP, GPIO_PuPd_UP, GPIO_AF_SPI1)},
47+
{PA_11, SPI_1, STM_PIN_DATA(GPIO_Mode_AF, GPIO_OType_PP, GPIO_PuPd_UP, GPIO_AF_SPI1)}, // REMAP
4848
{NC, NC, 0}
4949
};
5050

5151
static const PinMap PinMap_SPI_SCLK[] = {
52-
{PA_5, SPI_1, STM_PIN_DATA(GPIO_Mode_AF_PP, 0)},
53-
{PB_3, SPI_1, STM_PIN_DATA(GPIO_Mode_AF_PP, 1)}, // Remap
52+
{PA_5, SPI_1, STM_PIN_DATA(GPIO_Mode_AF, GPIO_OType_PP, GPIO_PuPd_UP, GPIO_AF_SPI1)},
53+
{PB_3, SPI_1, STM_PIN_DATA(GPIO_Mode_AF, GPIO_OType_PP, GPIO_PuPd_UP, GPIO_AF_SPI1)}, // REMAP
5454
{NC, NC, 0}
5555
};
5656

5757
// Only used in Slave mode
5858
static const PinMap PinMap_SPI_SSEL[] = {
59-
{PB_6, SPI_1, STM_PIN_DATA(GPIO_Mode_IN_FLOATING, 0)}, // Generic IO, not real H/W NSS pin
60-
//{PA_4, SPI_1, STM_PIN_DATA(GPIO_Mode_IN_FLOATING, 0)},
61-
//{PA_15, SPI_1, STM_PIN_DATA(GPIO_Mode_IN_FLOATING, 1)}, // Remap
59+
{PA_4, SPI_1, STM_PIN_DATA(GPIO_Mode_AF, GPIO_OType_PP, GPIO_PuPd_UP, GPIO_AF_SPI1)},
60+
{PA_15, SPI_1, STM_PIN_DATA(GPIO_Mode_AF, GPIO_OType_PP, GPIO_PuPd_UP, GPIO_AF_SPI1)}, // REMAP
6261
{NC, NC, 0}
6362
};
6463

0 commit comments

Comments
 (0)