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

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

commit e9b6a5bee923042e63c87d16377b230741965506
Author: raiden00pl <[email protected]>
AuthorDate: Mon Oct 12 09:56:04 2026 +0200

    boards/arm/common/stm32: support STM32L4 in the common CAN and BMP280 setup
    
    STM32L4 provides the same CAN and I2C functions as the other families,
    but declares them in stm32l4_can.h and stm32l4_i2c.h. Include these
    headers on STM32L4, so its boards can use the common CAN and BMP280
    setup.
    
    Signed-off-by: raiden00pl <[email protected]>
    Assisted-by: Claude Code
---
 boards/arm/common/stm32/src/stm32_bmp280.c        | 6 +++++-
 boards/arm/common/stm32/src/stm32_can_setup.c     | 2 ++
 boards/arm/common/stm32/src/stm32_cansock_setup.c | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/boards/arm/common/stm32/src/stm32_bmp280.c 
b/boards/arm/common/stm32/src/stm32_bmp280.c
index 2d748ac1128..d46889db2d0 100644
--- a/boards/arm/common/stm32/src/stm32_bmp280.c
+++ b/boards/arm/common/stm32/src/stm32_bmp280.c
@@ -33,7 +33,11 @@
 #include <nuttx/sensors/bmp280.h>
 #include <nuttx/i2c/i2c_master.h>
 
-#include "stm32_i2c.h"
+#ifdef CONFIG_ARCH_CHIP_STM32L4
+#  include "stm32l4_i2c.h"
+#else
+#  include "stm32_i2c.h"
+#endif
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/boards/arm/common/stm32/src/stm32_can_setup.c 
b/boards/arm/common/stm32/src/stm32_can_setup.c
index 446d383c255..a001b444a43 100644
--- a/boards/arm/common/stm32/src/stm32_can_setup.c
+++ b/boards/arm/common/stm32/src/stm32_can_setup.c
@@ -39,6 +39,8 @@
 #endif
 #ifdef CONFIG_STM32_FDCAN_CHARDRIVER
 #  include "stm32_fdcan.h"
+#elif defined(CONFIG_ARCH_CHIP_STM32L4)
+#  include "stm32l4_can.h"
 #else
 #  include "stm32_can.h"
 #endif
diff --git a/boards/arm/common/stm32/src/stm32_cansock_setup.c 
b/boards/arm/common/stm32/src/stm32_cansock_setup.c
index 0c3dbeb659b..70b2abc128c 100644
--- a/boards/arm/common/stm32/src/stm32_cansock_setup.c
+++ b/boards/arm/common/stm32/src/stm32_cansock_setup.c
@@ -35,6 +35,8 @@
 #endif
 #ifdef CONFIG_STM32_FDCAN_SOCKET
 #  include "stm32_fdcan.h"
+#elif defined(CONFIG_ARCH_CHIP_STM32L4)
+#  include "stm32l4_can.h"
 #else
 #  include "stm32_can.h"
 #endif

Reply via email to