Skip to content

Commit b12be6b

Browse files
committed
Rename SPI_COUNT to DEVICE_SPI_COUNT
Avoid collision with some HALs that already define SPI_COUNT.
1 parent df7e336 commit b12be6b

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

drivers/SPI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void SPI::_do_construct()
6868
_write_fill = SPI_FILL_CHAR;
6969

7070
// Need backwards compatibility with HALs not providing API
71-
#ifdef SPI_COUNT
71+
#ifdef DEVICE_SPI_COUNT
7272
SPIName name = spi_get_peripheral_name(_mosi, _miso, _sclk);
7373
#else
7474
SPIName name = GlobalSPI;

drivers/SPI.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
#include "platform/SingletonPtr.h"
2828
#include "platform/NonCopyable.h"
2929

30-
#if defined MBED_CONF_DRIVERS_SPI_COUNT_MAX && SPI_COUNT > MBED_CONF_DRIVERS_SPI_COUNT_MAX
30+
#if defined MBED_CONF_DRIVERS_SPI_COUNT_MAX && DEVICE_SPI_COUNT > MBED_CONF_DRIVERS_SPI_COUNT_MAX
3131
#define SPI_PERIPHERALS_USED MBED_CONF_DRIVERS_SPI_COUNT_MAX
32-
#elif defined SPI_COUNT
33-
#define SPI_PERIPHERALS_USED SPI_COUNT
32+
#elif defined DEVICE_SPI_COUNT
33+
#define SPI_PERIPHERALS_USED DEVICE_SPI_COUNT
3434
#else
35-
/* Backwards compatibility with HALs not providing SPI_COUNT */
35+
/* Backwards compatibility with HALs not providing DEVICE_SPI_COUNT */
3636
#define SPI_PERIPHERALS_USED 1
3737
#endif
3838

@@ -337,7 +337,7 @@ class SPI : private NonCopyable<SPI> {
337337

338338
#if !defined(DOXYGEN_ONLY)
339339
protected:
340-
#ifdef SPI_COUNT
340+
#ifdef DEVICE_SPI_COUNT
341341
// HAL must have defined this as a global enum
342342
typedef ::SPIName SPIName;
343343
#else

hal/spi_api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ extern "C" {
6262
* @{
6363
*/
6464

65-
#ifdef SPI_COUNT
65+
#ifdef DEVICE_SPI_COUNT
6666
/**
6767
* Returns a variant of the SPIName enum uniquely identifying a SPI peripheral of the device.
6868
* @param[in] mosi The pin to use for MOSI

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F429xI/TARGET_NUCLEO_F429ZI/PeripheralNames.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ typedef enum {
5757
UART_8 = (int)UART8_BASE
5858
} UARTName;
5959

60-
#define SPI_COUNT 6
60+
#define DEVICE_SPI_COUNT 6
6161
typedef enum {
6262
SPI_1 = (int)SPI1_BASE,
6363
SPI_2 = (int)SPI2_BASE,

0 commit comments

Comments
 (0)