This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 7f5e0285a88c35dcfea0230d2c4b3b1722cc8e3c
Author: Jiri Vlasak <[email protected]>
AuthorDate: Thu Mar 26 12:26:31 2026 +0100

    kinetis/pinmux: Do not redefine PIN_UART2_RTS
    
    When a developer working on BSP wants UART1 with RTS, the following
    needs to be added in the BSP's include/board.h file:
    
            #define PIN_UART1_RTS PIN_UART1_RTS_1
    
    which says that PIN_UART1_RTS_1 -- the first alternative pin with UART1
    RTS function -- should be used for the UART1's RTS.
    
    There are no alternative pins for PIN_UART2_RTS, therefore a similar
    definition is not used for PIN_UART2_RTS.
    
    However, that is a complication when we want PIN_UART2_RTS to be defined
    as GPIO, for example:
    
            #define PIN_UART2_RTS (GPIO_OUTPUT | PIN_PORTB | PIN2)
    
    In such a case, PIN_UART2_RTS is later redefined to the only alternative
    function from hardware/kinetis_???pinmux.h file.
    
    This patch avoids the redefinition of already defined names.
    
    We considered renaming PIN_UART2_RTS to PIN_UART2_RTS_1 in the
    hardware/kinetis_???pinmux.h file, but that is breaking change. We try
    to avoid breaking change.
    
    Signed-off-by: Jiri Vlasak <[email protected]>
---
 arch/arm/src/kinetis/hardware/kinetis_k40pinmux.h | 4 +++-
 arch/arm/src/kinetis/hardware/kinetis_k60pinmux.h | 4 +++-
 arch/arm/src/kinetis/hardware/kinetis_k64pinmux.h | 4 +++-
 arch/arm/src/kinetis/hardware/kinetis_k66pinmux.h | 4 +++-
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/arm/src/kinetis/hardware/kinetis_k40pinmux.h 
b/arch/arm/src/kinetis/hardware/kinetis_k40pinmux.h
index ad647509d39..8d274df1df2 100644
--- a/arch/arm/src/kinetis/hardware/kinetis_k40pinmux.h
+++ b/arch/arm/src/kinetis/hardware/kinetis_k40pinmux.h
@@ -351,7 +351,9 @@
 
 #define PIN_LCD_P40              (PIN_ANALOG | PIN_PORTD | PIN0)
 #define PIN_SPI0_PCS0_3          (PIN_ALT2   | PIN_PORTD | PIN0)
-#define PIN_UART2_RTS            (PIN_ALT3   | PIN_PORTD | PIN0)
+#if !defined(PIN_UART2_RTS)
+#  define PIN_UART2_RTS          (PIN_ALT3   | PIN_PORTD | PIN0)
+#endif
 #define PIN_LCD_P40F             (PIN_ALT7   | PIN_PORTD | PIN0)
 #define PIN_LCD_P41              (PIN_ANALOG | PIN_PORTD | PIN1)
 #define PIN_ADC0_SE5B            (PIN_ANALOG | PIN_PORTD | PIN1)
diff --git a/arch/arm/src/kinetis/hardware/kinetis_k60pinmux.h 
b/arch/arm/src/kinetis/hardware/kinetis_k60pinmux.h
index f2afdbe118a..8b2f7381596 100644
--- a/arch/arm/src/kinetis/hardware/kinetis_k60pinmux.h
+++ b/arch/arm/src/kinetis/hardware/kinetis_k60pinmux.h
@@ -346,7 +346,9 @@
 #define PIN_FB_TA                (PIN_ALT6   | PIN_PORTC | PIN19)
 
 #define PIN_SPI0_PCS0_3          (PIN_ALT2   | PIN_PORTD | PIN0)
-#define PIN_UART2_RTS            (PIN_ALT3   | PIN_PORTD | PIN0)
+#if !defined(PIN_UART2_RTS)
+#  define PIN_UART2_RTS          (PIN_ALT3   | PIN_PORTD | PIN0)
+#endif
 #define PIN_FTM3_CH0_2           (PIN_ALT4   | PIN_PORTD | PIN0)
 #define PIN_FB_ALE               (PIN_ALT5   | PIN_PORTD | PIN0)
 #define PIN_FB_CS1               (PIN_ALT5   | PIN_PORTD | PIN0)
diff --git a/arch/arm/src/kinetis/hardware/kinetis_k64pinmux.h 
b/arch/arm/src/kinetis/hardware/kinetis_k64pinmux.h
index dd71e6a5cef..76a93c5b875 100644
--- a/arch/arm/src/kinetis/hardware/kinetis_k64pinmux.h
+++ b/arch/arm/src/kinetis/hardware/kinetis_k64pinmux.h
@@ -563,7 +563,9 @@
 #define PIN_UART1_TX_2            (PIN_ALT3   | PIN_PORTE | PIN0)
 
 #define PIN_UART2_CTS             (PIN_ALT3   | PIN_PORTD | PIN1)
-#define PIN_UART2_RTS             (PIN_ALT3   | PIN_PORTD | PIN0)
+#if !defined(PIN_UART2_RTS)
+#  define PIN_UART2_RTS           (PIN_ALT3   | PIN_PORTD | PIN0)
+#endif
 #define PIN_UART2_RX              (PIN_ALT3   | PIN_PORTD | PIN2)
 #define PIN_UART2_TX              (PIN_ALT3   | PIN_PORTD | PIN3)
 
diff --git a/arch/arm/src/kinetis/hardware/kinetis_k66pinmux.h 
b/arch/arm/src/kinetis/hardware/kinetis_k66pinmux.h
index ab9960f4e94..089e8563081 100644
--- a/arch/arm/src/kinetis/hardware/kinetis_k66pinmux.h
+++ b/arch/arm/src/kinetis/hardware/kinetis_k66pinmux.h
@@ -678,7 +678,9 @@
 #define PIN_UART1_TX_2            (PIN_ALT3   | PIN_PORTE | PIN0)
 
 #define PIN_UART2_CTS             (PIN_ALT3   | PIN_PORTD | PIN1)
-#define PIN_UART2_RTS             (PIN_ALT3   | PIN_PORTD | PIN0)
+#if !defined(PIN_UART2_RTS)
+#  define PIN_UART2_RTS           (PIN_ALT3   | PIN_PORTD | PIN0)
+#endif
 #define PIN_UART2_RX              (PIN_ALT3   | PIN_PORTD | PIN2)
 #define PIN_UART2_TX              (PIN_ALT3   | PIN_PORTD | PIN3)
 

Reply via email to