mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
fmuv6x: Add GPIO expander to check overcurrent pins
This commit is contained in:
committed by
Daniel Agar
parent
a91aa40a3d
commit
cd231d0eed
@@ -18,6 +18,7 @@ CONFIG_DRIVERS_CDCACM_AUTOSTART=y
|
|||||||
CONFIG_COMMON_DIFFERENTIAL_PRESSURE=y
|
CONFIG_COMMON_DIFFERENTIAL_PRESSURE=y
|
||||||
CONFIG_COMMON_DISTANCE_SENSOR=y
|
CONFIG_COMMON_DISTANCE_SENSOR=y
|
||||||
CONFIG_DRIVERS_DSHOT=y
|
CONFIG_DRIVERS_DSHOT=y
|
||||||
|
CONFIG_DRIVERS_GPIO_MCP23009=y
|
||||||
CONFIG_DRIVERS_GPS=y
|
CONFIG_DRIVERS_GPS=y
|
||||||
CONFIG_DRIVERS_HEATER=y
|
CONFIG_DRIVERS_HEATER=y
|
||||||
CONFIG_DRIVERS_IMU_ANALOG_DEVICES_ADIS16470=y
|
CONFIG_DRIVERS_IMU_ANALOG_DEVICES_ADIS16470=y
|
||||||
|
|||||||
@@ -27,3 +27,14 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
safety_button start
|
safety_button start
|
||||||
|
|
||||||
|
# GPIO Expander driver on external I2C3
|
||||||
|
if ver hwbasecmp 009
|
||||||
|
then
|
||||||
|
# No USB
|
||||||
|
mcp23009 start -b 3 -X -D 0xf0 -O 0xf0 -P 0x0f -U 10
|
||||||
|
fi
|
||||||
|
if ver hwbasecmp 00a 008
|
||||||
|
then
|
||||||
|
mcp23009 start -b 3 -X -D 0xf1 -O 0xf0 -P 0x0f -U 10
|
||||||
|
fi
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ CONFIG_DEBUG_SYMBOLS=y
|
|||||||
CONFIG_DEBUG_TCBINFO=y
|
CONFIG_DEBUG_TCBINFO=y
|
||||||
CONFIG_DEFAULT_SMALL=y
|
CONFIG_DEFAULT_SMALL=y
|
||||||
CONFIG_DEV_FIFO_SIZE=0
|
CONFIG_DEV_FIFO_SIZE=0
|
||||||
|
CONFIG_DEV_GPIO=y
|
||||||
CONFIG_DEV_PIPE_MAXSIZE=1024
|
CONFIG_DEV_PIPE_MAXSIZE=1024
|
||||||
CONFIG_DEV_PIPE_SIZE=70
|
CONFIG_DEV_PIPE_SIZE=70
|
||||||
CONFIG_DEV_URANDOM=y
|
CONFIG_DEV_URANDOM=y
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ if("${PX4_BOARD_LABEL}" STREQUAL "bootloader")
|
|||||||
add_compile_definitions(BOOTLOADER)
|
add_compile_definitions(BOOTLOADER)
|
||||||
add_library(drivers_board
|
add_library(drivers_board
|
||||||
bootloader_main.c
|
bootloader_main.c
|
||||||
init.c
|
init.cpp
|
||||||
usb.c
|
usb.c
|
||||||
timer_config.cpp
|
timer_config.cpp
|
||||||
)
|
)
|
||||||
@@ -52,7 +52,7 @@ else()
|
|||||||
add_library(drivers_board
|
add_library(drivers_board
|
||||||
can.c
|
can.c
|
||||||
i2c.cpp
|
i2c.cpp
|
||||||
init.c
|
init.cpp
|
||||||
led.c
|
led.c
|
||||||
mtd.cpp
|
mtd.cpp
|
||||||
sdio.c
|
sdio.c
|
||||||
@@ -71,5 +71,6 @@ else()
|
|||||||
nuttx_arch # sdio
|
nuttx_arch # sdio
|
||||||
nuttx_drivers # sdio
|
nuttx_drivers # sdio
|
||||||
px4_layer
|
px4_layer
|
||||||
|
platform_gpio_mcp23009
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -270,6 +270,11 @@
|
|||||||
#define GPIO_VDD_3V3_SPEKTRUM_POWER_EN /* PH2 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTH|GPIO_PIN2)
|
#define GPIO_VDD_3V3_SPEKTRUM_POWER_EN /* PH2 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTH|GPIO_PIN2)
|
||||||
#define GPIO_VDD_3V3_SD_CARD_EN /* PC13 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN13)
|
#define GPIO_VDD_3V3_SD_CARD_EN /* PC13 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN13)
|
||||||
|
|
||||||
|
/* MCP23009 GPIO expander */
|
||||||
|
#define BOARD_GPIO_VDD_5V_COMP_VALID "/dev/gpio4"
|
||||||
|
#define BOARD_GPIO_VDD_5V_CAN1_GPS1_VALID "/dev/gpio5"
|
||||||
|
|
||||||
|
|
||||||
/* Spare GPIO */
|
/* Spare GPIO */
|
||||||
|
|
||||||
#define GPIO_PG6 /* PG6 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTG|GPIO_PIN6)
|
#define GPIO_PG6 /* PG6 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTG|GPIO_PIN6)
|
||||||
|
|||||||
@@ -74,6 +74,7 @@
|
|||||||
#include <px4_platform/gpio.h>
|
#include <px4_platform/gpio.h>
|
||||||
#include <px4_platform/board_determine_hw_info.h>
|
#include <px4_platform/board_determine_hw_info.h>
|
||||||
#include <px4_platform/board_dma_alloc.h>
|
#include <px4_platform/board_dma_alloc.h>
|
||||||
|
#include <px4_platform/gpio/mcp23009.hpp>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-Processor Definitions
|
* Pre-Processor Definitions
|
||||||
@@ -159,7 +160,7 @@ __EXPORT void board_on_reset(int status)
|
|||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
__EXPORT void
|
extern "C" __EXPORT void
|
||||||
stm32_boardinitialize(void)
|
stm32_boardinitialize(void)
|
||||||
{
|
{
|
||||||
board_on_reset(-1); /* Reset PWM first thing */
|
board_on_reset(-1); /* Reset PWM first thing */
|
||||||
@@ -280,6 +281,13 @@ __EXPORT int board_app_initialize(uintptr_t arg)
|
|||||||
|
|
||||||
# endif /* CONFIG_MMCSD */
|
# endif /* CONFIG_MMCSD */
|
||||||
|
|
||||||
|
ret = mcp23009_register_gpios(3, 0x25);
|
||||||
|
|
||||||
|
if (ret != OK) {
|
||||||
|
led_on(LED_RED);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* !defined(BOOTLOADER) */
|
#endif /* !defined(BOOTLOADER) */
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
Reference in New Issue
Block a user