From 88fe047556da00467fae9d671a2e11b276fcad10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Thu, 14 Jan 2021 13:36:42 +0100 Subject: [PATCH] px4/v5x: enable mcp23009 GPIO driver --- boards/px4/fmu-v5x/base_phy_DP83848C.cmake | 1 + .../px4/fmu-v5x/nuttx-config/base_phy_DP83848C/defconfig | 1 + boards/px4/fmu-v5x/nuttx-config/nsh/defconfig | 1 + boards/px4/fmu-v5x/src/CMakeLists.txt | 5 +++-- boards/px4/fmu-v5x/src/{init.c => init.cpp} | 8 +++++--- 5 files changed, 11 insertions(+), 5 deletions(-) rename boards/px4/fmu-v5x/src/{init.c => init.cpp} (97%) diff --git a/boards/px4/fmu-v5x/base_phy_DP83848C.cmake b/boards/px4/fmu-v5x/base_phy_DP83848C.cmake index 5794d5b6ab..50a8c31665 100644 --- a/boards/px4/fmu-v5x/base_phy_DP83848C.cmake +++ b/boards/px4/fmu-v5x/base_phy_DP83848C.cmake @@ -93,6 +93,7 @@ px4_add_board( dmesg dumpfile esc_calib + gpio hardfault_log i2cdetect led_control diff --git a/boards/px4/fmu-v5x/nuttx-config/base_phy_DP83848C/defconfig b/boards/px4/fmu-v5x/nuttx-config/base_phy_DP83848C/defconfig index 7cb4727a07..5663698156 100644 --- a/boards/px4/fmu-v5x/nuttx-config/base_phy_DP83848C/defconfig +++ b/boards/px4/fmu-v5x/nuttx-config/base_phy_DP83848C/defconfig @@ -57,6 +57,7 @@ CONFIG_DEBUG_HARDFAULT_ALERT=y CONFIG_DEBUG_SYMBOLS=y CONFIG_DEFAULT_SMALL=y CONFIG_DEV_FIFO_SIZE=0 +CONFIG_DEV_GPIO=y CONFIG_DEV_PIPE_MAXSIZE=1024 CONFIG_DEV_PIPE_SIZE=70 CONFIG_ETH0_PHY_DP83848C=y diff --git a/boards/px4/fmu-v5x/nuttx-config/nsh/defconfig b/boards/px4/fmu-v5x/nuttx-config/nsh/defconfig index e0190ceb49..2b4e93495f 100644 --- a/boards/px4/fmu-v5x/nuttx-config/nsh/defconfig +++ b/boards/px4/fmu-v5x/nuttx-config/nsh/defconfig @@ -57,6 +57,7 @@ CONFIG_DEBUG_HARDFAULT_ALERT=y CONFIG_DEBUG_SYMBOLS=y CONFIG_DEFAULT_SMALL=y CONFIG_DEV_FIFO_SIZE=0 +CONFIG_DEV_GPIO=y CONFIG_DEV_PIPE_MAXSIZE=1024 CONFIG_DEV_PIPE_SIZE=70 CONFIG_ETH0_PHY_LAN8742A=y diff --git a/boards/px4/fmu-v5x/src/CMakeLists.txt b/boards/px4/fmu-v5x/src/CMakeLists.txt index b5aa3dc75a..3dbc72879f 100644 --- a/boards/px4/fmu-v5x/src/CMakeLists.txt +++ b/boards/px4/fmu-v5x/src/CMakeLists.txt @@ -34,7 +34,7 @@ add_library(drivers_board can.c i2c.cpp - init.c + init.cpp led.c manifest.c mtd.cpp @@ -43,7 +43,7 @@ add_library(drivers_board timer_config.cpp usb.c ) -add_dependencies(drivers_board arch_board_hw_info) +add_dependencies(drivers_board arch_board_hw_info platform_gpio_mcp23009) target_link_libraries(drivers_board PRIVATE @@ -53,4 +53,5 @@ target_link_libraries(drivers_board nuttx_arch # sdio nuttx_drivers # sdio px4_layer + platform_gpio_mcp23009 ) diff --git a/boards/px4/fmu-v5x/src/init.c b/boards/px4/fmu-v5x/src/init.cpp similarity index 97% rename from boards/px4/fmu-v5x/src/init.c rename to boards/px4/fmu-v5x/src/init.cpp index 1a9727f3ec..fee67d3d80 100644 --- a/boards/px4/fmu-v5x/src/init.c +++ b/boards/px4/fmu-v5x/src/init.cpp @@ -54,7 +54,9 @@ #include #include +extern "C" { #include +} #include #include #include @@ -73,6 +75,7 @@ #include #include #include +#include /**************************************************************************** * Pre-Processor Definitions @@ -158,7 +161,7 @@ __EXPORT void board_on_reset(int status) * ************************************************************************************/ -__EXPORT void +extern "C" __EXPORT void stm32_boardinitialize(void) { board_on_reset(-1); /* Reset PWM first thing */ @@ -174,7 +177,7 @@ stm32_boardinitialize(void) /* configure SPI interfaces (we can do this here as long as we only have a single SPI hw config version - * otherwise we need to move this after board_determine_hw_info()) */ - _Static_assert(BOARD_NUM_SPI_CFG_HW_VERSIONS == 1, "Need to move the SPI initialization for multi-version support"); + static_assert(BOARD_NUM_SPI_CFG_HW_VERSIONS == 1, "Need to move the SPI initialization for multi-version support"); stm32_spiinitialize(); @@ -211,7 +214,6 @@ stm32_boardinitialize(void) * ****************************************************************************/ - __EXPORT int board_app_initialize(uintptr_t arg) { /* Power on Interfaces */