3232#include "PeripheralPinMaps.h"
3333
3434
35- #if DEVICE_PWMOUT
35+ #if defined( DEVICE_PWMOUT ) && defined( PINMAP_PWM )
3636MSTD_CONSTEXPR_FN_14 PinMap get_pwm_pinmap (const PinName pin )
3737{
3838 for (const PinMap & pinmap : PINMAP_PWM ) {
@@ -44,7 +44,7 @@ MSTD_CONSTEXPR_FN_14 PinMap get_pwm_pinmap(const PinName pin)
4444}
4545#endif // DEVICE_PWMOUT
4646
47- #if DEVICE_ANALOGIN
47+ #if defined( DEVICE_ANALOGIN ) & & defined ( PINMAP_ANALOGIN )
4848MSTD_CONSTEXPR_FN_14 PinMap get_analogin_pinmap (const PinName pin )
4949{
5050 for (const PinMap & pinmap : PINMAP_ANALOGIN ) {
@@ -56,7 +56,7 @@ MSTD_CONSTEXPR_FN_14 PinMap get_analogin_pinmap(const PinName pin)
5656}
5757#endif // DEVICE_ANALOGIN
5858
59- #if DEVICE_ANALOGOUT
59+ #if defined( DEVICE_ANALOGOUT ) & & defined ( PINMAP_ANALOGOUT )
6060MSTD_CONSTEXPR_FN_14 PinMap get_analogout_pinmap (const PinName pin )
6161{
6262 for (const PinMap & pinmap : PINMAP_ANALOGOUT ) {
@@ -68,7 +68,7 @@ MSTD_CONSTEXPR_FN_14 PinMap get_analogout_pinmap(const PinName pin)
6868}
6969#endif // DEVICE_ANALOGOUT
7070
71- #if DEVICE_I2C
71+ #if defined( DEVICE_I2C ) & & defined ( PINMAP_I2C_SDA ) && defined ( PINMAP_I2C_SCL )
7272MSTD_CONSTEXPR_FN_14 i2c_pinmap_t get_i2c_pinmap (const PinName sda , const PinName scl )
7373{
7474 const PinMap * sda_map = nullptr ;
@@ -95,7 +95,7 @@ MSTD_CONSTEXPR_FN_14 i2c_pinmap_t get_i2c_pinmap(const PinName sda, const PinNam
9595}
9696#endif //DEVICE_I2C
9797
98- #if DEVICE_SERIAL
98+ #if defined( DEVICE_SERIAL ) && defined( PINMAP_UART_TX ) && defined( PINMAP_UART_RX )
9999MSTD_CONSTEXPR_FN_14 serial_pinmap_t get_uart_pinmap (const PinName tx , const PinName rx )
100100{
101101 const PinMap * tx_map = nullptr ;
@@ -125,7 +125,7 @@ MSTD_CONSTEXPR_FN_14 serial_pinmap_t get_uart_pinmap(const PinName tx, const Pin
125125 }
126126}
127127
128- #if DEVICE_SERIAL_FC
128+ #if defined( DEVICE_SERIAL_FC ) && defined( PINMAP_UART_RTS ) && defined( PINMAP_UART_CTS )
129129MSTD_CONSTEXPR_FN_14 serial_fc_pinmap_t get_uart_fc_pinmap (const PinName rxflow , const PinName txflow )
130130{
131131 const PinMap * rts_map = nullptr ;
@@ -153,7 +153,7 @@ MSTD_CONSTEXPR_FN_14 serial_fc_pinmap_t get_uart_fc_pinmap(const PinName rxflow,
153153#endif // DEVICE_SERIAL_FC
154154#endif // DEVICE_SERIAL
155155
156- #if DEVICE_SPI
156+ #if defined( DEVICE_SPI ) && defined( PINMAP_SPI_MOSI ) && defined( PINMAP_SPI_MISO ) && defined( PINMAP_SPI_SCLK ) && defined( PINMAP_SPI_SSEL )
157157MSTD_CONSTEXPR_FN_14 spi_pinmap_t get_spi_pinmap (const PinName mosi , const PinName miso , const PinName sclk , const PinName ssel )
158158{
159159 const PinMap * mosi_map = nullptr ;
@@ -198,7 +198,7 @@ MSTD_CONSTEXPR_FN_14 spi_pinmap_t get_spi_pinmap(const PinName mosi, const PinNa
198198}
199199#endif // DEVICE_SPI
200200
201- #if DEVICE_CAN
201+ #if defined( DEVICE_CAN ) && defined( PINMAP_CAN_RD ) && defined( PINMAP_CAN_TD )
202202MSTD_CONSTEXPR_FN_14 can_pinmap_t get_can_pinmap (const PinName rd , const PinName td )
203203{
204204 const PinMap * rd_map = nullptr ;
@@ -225,7 +225,7 @@ MSTD_CONSTEXPR_FN_14 can_pinmap_t get_can_pinmap(const PinName rd, const PinName
225225}
226226#endif //DEVICE_CAN
227227
228- #if DEVICE_QSPI
228+ #if defined( DEVICE_QSPI ) && defined( PINMAP_QSPI_DATA0 ) && defined( PINMAP_QSPI_DATA1 ) && defined( PINMAP_QSPI_DATA2 ) && defined( PINMAP_QSPI_DATA3 ) && defined( PINMAP_QSPI_SCLK ) && defined( PINMAP_QSPI_SSEL )
229229MSTD_CONSTEXPR_FN_14 qspi_pinmap_t get_qspi_pinmap (const PinName data0 , const PinName data1 , const PinName data2 , const PinName data3 , const PinName sclk , const PinName ssel )
230230{
231231 const PinMap * data0_map = nullptr ;
0 commit comments