Skip to content

Commit bb825ec

Browse files
committed
QSPI : Define default pins at drivers level
1 parent d8c2c6f commit bb825ec

File tree

4 files changed

+41
-12
lines changed

4 files changed

+41
-12
lines changed

TESTS/mbed_hal/qspi/flash_configs/flash_configs.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
#ifndef MBED_FLASH_CONFIGS_H
1818
#define MBED_FLASH_CONFIGS_H
1919

20+
#define MX25R6435F 1
21+
22+
#if defined(QSPI_FLASH_CHIP)
23+
24+
#if (QSPI_FLASH_CHIP == MX25R6435F)
25+
#include "MX25RXX35F_config.h"
26+
#endif
27+
28+
#else // QSPI_FLASH_CHIP not defined
29+
2030
#if defined(TARGET_DISCO_L475VG_IOT01A)
2131
#include "MX25RXX35F_config.h" // MX25R6435F
2232

@@ -88,5 +98,6 @@
8898
#include "S25FL128S_config.h"
8999

90100
#endif
101+
#endif // QSPI_FLASH_CHIP
91102
#endif // MBED_FLASH_CONFIGS_H
92103

TESTS/mbed_hal/qspi/main.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ uint8_t rx_buf[DATA_SIZE_1024];
7070

7171

7272
// some target defines QSPI pins as integers thus conversion needed
73-
#define QPIN_0 static_cast<PinName>(QSPI_FLASH1_IO0)
74-
#define QPIN_1 static_cast<PinName>(QSPI_FLASH1_IO1)
75-
#define QPIN_2 static_cast<PinName>(QSPI_FLASH1_IO2)
76-
#define QPIN_3 static_cast<PinName>(QSPI_FLASH1_IO3)
77-
#define QSCK static_cast<PinName>(QSPI_FLASH1_SCK)
78-
#define QCSN static_cast<PinName>(QSPI_FLASH1_CSN)
73+
#define QPIN_0 static_cast<PinName>(MBED_CONF_DRIVERS_QSPI_IO0)
74+
#define QPIN_1 static_cast<PinName>(MBED_CONF_DRIVERS_QSPI_IO1)
75+
#define QPIN_2 static_cast<PinName>(MBED_CONF_DRIVERS_QSPI_IO2)
76+
#define QPIN_3 static_cast<PinName>(MBED_CONF_DRIVERS_QSPI_IO3)
77+
#define QSCK static_cast<PinName>(MBED_CONF_DRIVERS_QSPI_SCK)
78+
#define QCSN static_cast<PinName>(MBED_CONF_DRIVERS_QSPI_CSN)
7979

8080

8181
static uint32_t gen_flash_address()

components/storage/blockdevice/COMPONENT_QSPIF/mbed_lib.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "qspif",
33
"config": {
4-
"QSPI_IO0": "QSPI_FLASH1_IO0",
5-
"QSPI_IO1": "QSPI_FLASH1_IO1",
6-
"QSPI_IO2": "QSPI_FLASH1_IO2",
7-
"QSPI_IO3": "QSPI_FLASH1_IO3",
8-
"QSPI_SCK": "QSPI_FLASH1_SCK",
9-
"QSPI_CSN": "QSPI_FLASH1_CSN",
4+
"QSPI_IO0": "MBED_CONF_DRIVERS_QSPI_IO0",
5+
"QSPI_IO1": "MBED_CONF_DRIVERS_QSPI_IO1",
6+
"QSPI_IO2": "MBED_CONF_DRIVERS_QSPI_IO2",
7+
"QSPI_IO3": "MBED_CONF_DRIVERS_QSPI_IO3",
8+
"QSPI_SCK": "MBED_CONF_DRIVERS_QSPI_SCK",
9+
"QSPI_CSN": "MBED_CONF_DRIVERS_QSPI_CSN",
1010
"QSPI_POLARITY_MODE": 0,
1111
"QSPI_FREQ": "40000000",
1212
"QSPI_MIN_READ_SIZE": "1",

drivers/mbed_lib.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@
1212
"spi_count_max": {
1313
"help": "The maximum number of SPI peripherals used at the same time. Determines RAM allocated for SPI peripheral management. If null, limit determined by hardware.",
1414
"value": null
15+
},
16+
"qspi_io0": {
17+
"value": "QSPI_FLASH1_IO0"
18+
},
19+
"qspi_io1": {
20+
"value": "QSPI_FLASH1_IO1"
21+
},
22+
"qspi_io2": {
23+
"value": "QSPI_FLASH1_IO2"
24+
},
25+
"qspi_io3": {
26+
"value": "QSPI_FLASH1_IO3"
27+
},
28+
"qspi_sck": {
29+
"value": "QSPI_FLASH1_SCK"
30+
},
31+
"qspi_csn": {
32+
"value": "QSPI_FLASH1_CSN"
1533
}
1634
}
1735
}

0 commit comments

Comments
 (0)