mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 15:38:52 +08:00
Pull v2 pieces up to build with the merge
This commit is contained in:
@@ -59,9 +59,9 @@
|
||||
#include <nuttx/mmcsd.h>
|
||||
#include <nuttx/analog/adc.h>
|
||||
|
||||
#include "stm32_internal.h"
|
||||
#include <stm32.h>
|
||||
#include "px4fmu_internal.h"
|
||||
#include "stm32_uart.h"
|
||||
#include <stm32_uart.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* these headers are not C++ safe */
|
||||
#include <stm32_internal.h>
|
||||
#include <stm32.h>
|
||||
|
||||
|
||||
/****************************************************************************************************
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#include <arch/board/board.h>
|
||||
#include <drivers/drv_pwm_output.h>
|
||||
|
||||
#include <stm32_internal.h>
|
||||
#include <stm32.h>
|
||||
#include <stm32_gpio.h>
|
||||
#include <stm32_tim.h>
|
||||
|
||||
|
||||
@@ -50,9 +50,9 @@
|
||||
#include <nuttx/spi.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "chip.h"
|
||||
#include "stm32_internal.h"
|
||||
#include <up_arch.h>
|
||||
#include <chip.h>
|
||||
#include <stm32.h>
|
||||
#include "px4fmu_internal.h"
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
@@ -51,8 +51,8 @@
|
||||
#include <nuttx/usb/usbdev.h>
|
||||
#include <nuttx/usb/usbdev_trace.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "stm32_internal.h"
|
||||
#include <up_arch.h>
|
||||
#include <stm32.h>
|
||||
#include "px4fmu_internal.h"
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "stm32_internal.h"
|
||||
#include <stm32.h>
|
||||
#include "px4iov2_internal.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
/* these headers are not C++ safe */
|
||||
#include <stm32_internal.h>
|
||||
#include <stm32.h>
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#include <arch/board/board.h>
|
||||
#include <drivers/drv_pwm_output.h>
|
||||
|
||||
#include <stm32_internal.h>
|
||||
#include <stm32.h>
|
||||
#include <stm32_gpio.h>
|
||||
#include <stm32_tim.h>
|
||||
|
||||
|
||||
+9
-31
@@ -42,7 +42,7 @@
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#ifdef CONFIG_ARCH_BOARD_PX4FMU
|
||||
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V1
|
||||
/*
|
||||
* PX4FMU GPIO numbers.
|
||||
*
|
||||
@@ -67,7 +67,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARCH_BOARD_PX4FMUV2
|
||||
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V2
|
||||
/*
|
||||
* PX4FMUv2 GPIO numbers.
|
||||
*
|
||||
@@ -93,36 +93,14 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARCH_BOARD_PX4IO
|
||||
/*
|
||||
* PX4IO GPIO numbers.
|
||||
*
|
||||
* XXX note that these are here for reference/future use; currently
|
||||
* there is no good way to wire these up without a common STM32 GPIO
|
||||
* driver, which isn't implemented yet.
|
||||
*/
|
||||
/* outputs */
|
||||
# define GPIO_ACC1_POWER (1<<0) /**< accessory power 1 */
|
||||
# define GPIO_ACC2_POWER (1<<1) /**< accessory power 2 */
|
||||
# define GPIO_SERVO_POWER (1<<2) /**< servo power */
|
||||
# define GPIO_RELAY1 (1<<3) /**< relay 1 */
|
||||
# define GPIO_RELAY2 (1<<4) /**< relay 2 */
|
||||
# define GPIO_LED_BLUE (1<<5) /**< blue LED */
|
||||
# define GPIO_LED_AMBER (1<<6) /**< amber/red LED */
|
||||
# define GPIO_LED_SAFETY (1<<7) /**< safety LED */
|
||||
|
||||
/* inputs */
|
||||
# define GPIO_ACC_OVERCURRENT (1<<8) /**< accessory 1/2 overcurrent detect */
|
||||
# define GPIO_SERVO_OVERCURRENT (1<<9) /**< servo overcurrent detect */
|
||||
# define GPIO_SAFETY_BUTTON (1<<10) /**< safety button pressed */
|
||||
|
||||
/**
|
||||
* Default GPIO device - other devices may also support this protocol if
|
||||
* they also export GPIO-like things. This is always the GPIOs on the
|
||||
* main board.
|
||||
*/
|
||||
# define GPIO_DEVICE_PATH "/dev/px4io"
|
||||
#ifdef CONFIG_ARCH_BOARD_PX4IO_V1
|
||||
/* no GPIO driver on the PX4IOv1 board */
|
||||
# define GPIO_DEVICE_PATH "/nonexistent"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARCH_BOARD_PX4IO_V2
|
||||
/* no GPIO driver on the PX4IOv2 board */
|
||||
# define GPIO_DEVICE_PATH "/nonexistent"
|
||||
#endif
|
||||
|
||||
#ifndef GPIO_DEVICE_PATH
|
||||
|
||||
+14
-14
@@ -59,10 +59,10 @@
|
||||
#include <drivers/drv_gpio.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU)
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V1)
|
||||
# include <drivers/boards/px4fmu/px4fmu_internal.h>
|
||||
# define FMU_HAVE_PPM
|
||||
#elif defined(CONFIG_ARCH_BOARD_PX4FMUV2)
|
||||
#elif defined(CONFIG_ARCH_BOARD_PX4FMU_V2)
|
||||
# include <drivers/boards/px4fmuv2/px4fmu_internal.h>
|
||||
# undef FMU_HAVE_PPM
|
||||
#else
|
||||
@@ -158,7 +158,7 @@ private:
|
||||
};
|
||||
|
||||
const PX4FMU::GPIOConfig PX4FMU::_gpio_tab[] = {
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU)
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V1)
|
||||
{GPIO_GPIO0_INPUT, GPIO_GPIO0_OUTPUT, 0},
|
||||
{GPIO_GPIO1_INPUT, GPIO_GPIO1_OUTPUT, 0},
|
||||
{GPIO_GPIO2_INPUT, GPIO_GPIO2_OUTPUT, GPIO_USART2_CTS_1},
|
||||
@@ -168,7 +168,7 @@ const PX4FMU::GPIOConfig PX4FMU::_gpio_tab[] = {
|
||||
{GPIO_GPIO6_INPUT, GPIO_GPIO6_OUTPUT, GPIO_CAN2_TX_2},
|
||||
{GPIO_GPIO7_INPUT, GPIO_GPIO7_OUTPUT, GPIO_CAN2_RX_2},
|
||||
#endif
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMUV2)
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V2)
|
||||
{GPIO_GPIO0_INPUT, GPIO_GPIO0_OUTPUT, 0},
|
||||
{GPIO_GPIO1_INPUT, GPIO_GPIO1_OUTPUT, 0},
|
||||
{GPIO_GPIO2_INPUT, GPIO_GPIO2_OUTPUT, 0},
|
||||
@@ -873,7 +873,7 @@ PX4FMU::gpio_reset(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU)
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V1)
|
||||
/* if we have a GPIO direction control, set it to zero (input) */
|
||||
stm32_gpiowrite(GPIO_GPIO_DIR, 0);
|
||||
stm32_configgpio(GPIO_GPIO_DIR);
|
||||
@@ -883,7 +883,7 @@ PX4FMU::gpio_reset(void)
|
||||
void
|
||||
PX4FMU::gpio_set_function(uint32_t gpios, int function)
|
||||
{
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU)
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V1)
|
||||
/*
|
||||
* GPIOs 0 and 1 must have the same direction as they are buffered
|
||||
* by a shared 2-port driver. Any attempt to set either sets both.
|
||||
@@ -918,7 +918,7 @@ PX4FMU::gpio_set_function(uint32_t gpios, int function)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU)
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V1)
|
||||
/* flip buffer to input mode if required */
|
||||
if ((GPIO_SET_INPUT == function) && (gpios & 3))
|
||||
stm32_gpiowrite(GPIO_GPIO_DIR, 0);
|
||||
@@ -1024,17 +1024,17 @@ fmu_new_mode(PortMode new_mode)
|
||||
break;
|
||||
|
||||
case PORT_FULL_PWM:
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU)
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V1)
|
||||
/* select 4-pin PWM mode */
|
||||
servo_mode = PX4FMU::MODE_4PWM;
|
||||
#endif
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMUV2)
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V2)
|
||||
servo_mode = PX4FMU::MODE_6PWM;
|
||||
#endif
|
||||
break;
|
||||
|
||||
/* mixed modes supported on v1 board only */
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU)
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V1)
|
||||
case PORT_FULL_SERIAL:
|
||||
/* set all multi-GPIOs to serial mode */
|
||||
gpio_bits = GPIO_MULTI_1 | GPIO_MULTI_2 | GPIO_MULTI_3 | GPIO_MULTI_4;
|
||||
@@ -1116,7 +1116,7 @@ test(void)
|
||||
|
||||
if (ioctl(fd, PWM_SERVO_SET(3), 1600) < 0) err(1, "servo 4 set failed");
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMUV2)
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V2)
|
||||
if (ioctl(fd, PWM_SERVO_SET(4), 1800) < 0) err(1, "servo 5 set failed");
|
||||
|
||||
if (ioctl(fd, PWM_SERVO_SET(5), 2000) < 0) err(1, "servo 6 set failed");
|
||||
@@ -1183,7 +1183,7 @@ fmu_main(int argc, char *argv[])
|
||||
} else if (!strcmp(verb, "mode_pwm")) {
|
||||
new_mode = PORT_FULL_PWM;
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU)
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V1)
|
||||
} else if (!strcmp(verb, "mode_serial")) {
|
||||
new_mode = PORT_FULL_SERIAL;
|
||||
|
||||
@@ -1217,9 +1217,9 @@ fmu_main(int argc, char *argv[])
|
||||
fake(argc - 1, argv + 1);
|
||||
|
||||
fprintf(stderr, "FMU: unrecognised command, try:\n");
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU)
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V1)
|
||||
fprintf(stderr, " mode_gpio, mode_serial, mode_pwm, mode_gpio_serial, mode_pwm_serial, mode_pwm_gpio\n");
|
||||
#elif defined(CONFIG_ARCH_BOARD_PX4FMUV2)
|
||||
#elif defined(CONFIG_ARCH_BOARD_PX4FMU_V2)
|
||||
fprintf(stderr, " mode_gpio, mode_pwm\n");
|
||||
#endif
|
||||
exit(1);
|
||||
|
||||
@@ -56,7 +56,6 @@
|
||||
#include <chip.h>
|
||||
#include <up_internal.h>
|
||||
#include <up_arch.h>
|
||||
#include <stm32_internal.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
|
||||
@@ -1604,9 +1604,9 @@ start(int argc, char *argv[])
|
||||
|
||||
PX4IO_interface *interface;
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMUV2)
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V2)
|
||||
interface = io_serial_interface();
|
||||
#elif defined(CONFIG_ARCH_BOARD_PX4FMU)
|
||||
#elif defined(CONFIG_ARCH_BOARD_PX4FMU_V1)
|
||||
interface = io_i2c_interface(PX4_I2C_BUS_ONBOARD, PX4_I2C_OBDEV_PX4IO);
|
||||
#else
|
||||
# error Unknown board - cannot select interface.
|
||||
@@ -1741,9 +1741,9 @@ if_test(unsigned mode)
|
||||
{
|
||||
PX4IO_interface *interface;
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMUV2)
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V2)
|
||||
interface = io_serial_interface();
|
||||
#elif defined(CONFIG_ARCH_BOARD_PX4FMU)
|
||||
#elif defined(CONFIG_ARCH_BOARD_PX4FMU_V1)
|
||||
interface = io_i2c_interface(PX4_I2C_BUS_ONBOARD, PX4_I2C_OBDEV_PX4IO);
|
||||
#else
|
||||
# error Unknown board - cannot select interface.
|
||||
|
||||
@@ -56,10 +56,10 @@
|
||||
|
||||
#include "uploader.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_BOARD_PX4FMUV2
|
||||
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V2
|
||||
#include <drivers/boards/px4fmuv2/px4fmu_internal.h>
|
||||
#endif
|
||||
#ifdef CONFIG_ARCH_BOARD_PX4FMU
|
||||
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V1
|
||||
#include <drivers/boards/px4fmu/px4fmu_internal.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
#include "stm32_gpio.h"
|
||||
#include "stm32_tim.h"
|
||||
|
||||
#ifdef CONFIG_HRT_TIMER
|
||||
#ifdef HRT_TIMER
|
||||
|
||||
/* HRT configuration */
|
||||
#if HRT_TIMER == 1
|
||||
@@ -275,7 +275,7 @@ static void hrt_call_invoke(void);
|
||||
/*
|
||||
* Specific registers and bits used by PPM sub-functions
|
||||
*/
|
||||
#ifdef CONFIG_HRT_PPM
|
||||
#ifdef HRT_PPM_CHANNEL
|
||||
/*
|
||||
* If the timer hardware doesn't support GTIM_CCER_CCxNP, then we will work around it.
|
||||
*
|
||||
@@ -377,7 +377,7 @@ static void hrt_ppm_decode(uint32_t status);
|
||||
# define CCMR1_PPM 0
|
||||
# define CCMR2_PPM 0
|
||||
# define CCER_PPM 0
|
||||
#endif /* CONFIG_HRT_PPM */
|
||||
#endif /* HRT_PPM_CHANNEL */
|
||||
|
||||
/*
|
||||
* Initialise the timer we are going to use.
|
||||
@@ -907,4 +907,4 @@ hrt_latency_update(void)
|
||||
}
|
||||
|
||||
|
||||
#endif /* CONFIG_HRT_TIMER */
|
||||
#endif /* HRT_TIMER */
|
||||
|
||||
@@ -117,10 +117,6 @@
|
||||
|
||||
#include <systemlib/err.h>
|
||||
|
||||
#ifndef CONFIG_HRT_TIMER
|
||||
# error This driver requires CONFIG_HRT_TIMER
|
||||
#endif
|
||||
|
||||
/* Tone alarm configuration */
|
||||
#if TONE_ALARM_TIMER == 2
|
||||
# define TONE_ALARM_BASE STM32_TIM2_BASE
|
||||
|
||||
Reference in New Issue
Block a user