AP_HAL: remove more px4 remnants

This commit is contained in:
Andrew Tridgell 2019-02-25 16:13:47 +11:00
parent 70e445d040
commit 20d762293d
6 changed files with 3 additions and 345 deletions

View File

@ -8,7 +8,7 @@
#define HAL_BOARD_SITL 3 #define HAL_BOARD_SITL 3
#define HAL_BOARD_SMACCM 4 // unused #define HAL_BOARD_SMACCM 4 // unused
#define HAL_BOARD_PX4 5 #define HAL_BOARD_PX4 5 // unused
#define HAL_BOARD_LINUX 7 #define HAL_BOARD_LINUX 7
#define HAL_BOARD_VRBRAIN 8 #define HAL_BOARD_VRBRAIN 8
#define HAL_BOARD_CHIBIOS 10 #define HAL_BOARD_CHIBIOS 10
@ -39,25 +39,6 @@
#define HAL_BOARD_SUBTYPE_LINUX_RST_ZYNQ 1021 #define HAL_BOARD_SUBTYPE_LINUX_RST_ZYNQ 1021
#define HAL_BOARD_SUBTYPE_LINUX_POCKET 1022 #define HAL_BOARD_SUBTYPE_LINUX_POCKET 1022
/* HAL PX4 sub-types, starting at 2000 */
#define HAL_BOARD_SUBTYPE_PX4_V1 2000
#define HAL_BOARD_SUBTYPE_PX4_V2 2001
#define HAL_BOARD_SUBTYPE_PX4_V4 2002
#define HAL_BOARD_SUBTYPE_PX4_V3 2003
#define HAL_BOARD_SUBTYPE_PX4_AEROFC_V1 2004
#define HAL_BOARD_SUBTYPE_PX4_V4PRO 2005
/* HAL VRBRAIN sub-types, starting at 4000 */
#define HAL_BOARD_SUBTYPE_VRBRAIN_V45 4000
#define HAL_BOARD_SUBTYPE_VRBRAIN_V51 4001
#define HAL_BOARD_SUBTYPE_VRBRAIN_V52 4002
#define HAL_BOARD_SUBTYPE_VRUBRAIN_V51 4003
#define HAL_BOARD_SUBTYPE_VRUBRAIN_V52 4004
#define HAL_BOARD_SUBTYPE_VRCORE_V10 4005
#define HAL_BOARD_SUBTYPE_VRBRAIN_V54 4006
#define HAL_BOARD_SUBTYPE_VRBRAIN_V52E 4007
/* HAL CHIBIOS sub-types, starting at 5000 */ /* HAL CHIBIOS sub-types, starting at 5000 */
#define HAL_BOARD_SUBTYPE_CHIBIOS_SKYVIPER_F412 5000 #define HAL_BOARD_SUBTYPE_CHIBIOS_SKYVIPER_F412 5000
#define HAL_BOARD_SUBTYPE_CHIBIOS_FMUV3 5001 #define HAL_BOARD_SUBTYPE_CHIBIOS_FMUV3 5001
@ -170,8 +151,6 @@
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL #if CONFIG_HAL_BOARD == HAL_BOARD_SITL
#include <AP_HAL/board/sitl.h> #include <AP_HAL/board/sitl.h>
#elif CONFIG_HAL_BOARD == HAL_BOARD_PX4
#include <AP_HAL/board/px4.h>
#elif CONFIG_HAL_BOARD == HAL_BOARD_LINUX #elif CONFIG_HAL_BOARD == HAL_BOARD_LINUX
#include <AP_HAL/board/linux.h> #include <AP_HAL/board/linux.h>
#elif CONFIG_HAL_BOARD == HAL_BOARD_EMPTY #elif CONFIG_HAL_BOARD == HAL_BOARD_EMPTY

View File

@ -18,10 +18,6 @@
#include "HAL.h" #include "HAL.h"
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4 || CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN
#define AP_MAIN __EXPORT ArduPilot_main
#endif
#ifndef AP_MAIN #ifndef AP_MAIN
#define AP_MAIN main #define AP_MAIN main
#endif #endif

View File

@ -1,161 +0,0 @@
#pragma once
#define HAL_BOARD_NAME "PX4"
#define HAL_CPU_CLASS HAL_CPU_CLASS_150
#define HAL_OS_POSIX_IO 1
// put all storage of files under /fs/microsd/APM directory
#ifndef HAL_BOARD_STORAGE_DIRECTORY
#define HAL_BOARD_STORAGE_DIRECTORY "/fs/microsd/APM"
#endif
#define HAL_BOARD_LOG_DIRECTORY HAL_BOARD_STORAGE_DIRECTORY "/LOGS"
#define HAL_BOARD_TERRAIN_DIRECTORY HAL_BOARD_STORAGE_DIRECTORY "/TERRAIN"
#define HAL_PARAM_DEFAULTS_PATH "/etc/defaults.parm"
#define HAL_INS_DEFAULT HAL_INS_PX4
#define HAL_BARO_DEFAULT HAL_BARO_PX4
#define HAL_COMPASS_DEFAULT HAL_COMPASS_PX4
#define HAL_HAVE_GETTIME_SETTIME 1
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V1
#define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_PX4_V1
#define HAL_STORAGE_SIZE 8192
#define HAL_MINIMIZE_FEATURES 1
#elif defined(CONFIG_ARCH_BOARD_PX4FMU_V3)
// check for V3 before V2 as V3 also defines V2
#define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_PX4_V3
#define HAL_STORAGE_SIZE 16384
#define HAL_HAVE_IMU_HEATER 1 // for Pixhawk2
#define HAL_IMU_TEMP_DEFAULT -1 // disabled
#define HAL_WITH_UAVCAN 1
#elif defined(CONFIG_ARCH_BOARD_PX4FMU_V2)
#define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_PX4_V2
#define HAL_STORAGE_SIZE 16384
#define HAL_HAVE_IMU_HEATER 1 // for Pixhawk2
#define HAL_IMU_TEMP_DEFAULT -1 // disabled
#define HAL_WITH_UAVCAN 1
#define HAL_MINIMIZE_FEATURES 1
#elif defined(CONFIG_ARCH_BOARD_PX4FMU_V4)
#define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_PX4_V4
#define HAL_STORAGE_SIZE 16384
#define HAL_WITH_UAVCAN 1
#elif defined(CONFIG_ARCH_BOARD_PX4FMU_V4PRO)
#define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_PX4_V4PRO
#define HAL_STORAGE_SIZE 16384
#define HAL_WITH_UAVCAN 1
#elif defined(CONFIG_ARCH_BOARD_AEROFC_V1)
#define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_PX4_AEROFC_V1
#define HAL_STORAGE_SIZE 16384
#define USE_FLASH_STORAGE 1
#define HAL_RCOUTPUT_TAP_DEVICE "/dev/ttyS0"
// we don't have any sdcard
#undef HAL_BOARD_LOG_DIRECTORY
#undef HAL_BOARD_TERRAIN_DIRECTORY
#else
#error "Unknown PX4 board type"
#endif
#define HAL_GPIO_A_LED_PIN 27
#define HAL_GPIO_B_LED_PIN 26
#define HAL_GPIO_C_LED_PIN 25
#define HAL_GPIO_LED_ON 1
#define HAL_GPIO_LED_OFF 0
#define HAL_BARO_MS5611_NAME "ms5611"
#define HAL_BARO_MS5611_SPI_INT_NAME "ms5611_int"
#define HAL_BARO_MS5611_SPI_EXT_NAME "ms5611_ext"
#define HAL_INS_MPU60x0_NAME "mpu6000"
#define HAL_INS_MPU60x0_EXT_NAME "mpu6000_ext"
#define HAL_INS_LSM9DS0_G_NAME "lsm9ds0_g"
#define HAL_INS_LSM9DS0_A_NAME "lsm9ds0_am"
#define HAL_INS_LSM9DS0_EXT_G_NAME "lsm9ds0_ext_g"
#define HAL_INS_LSM9DS0_EXT_A_NAME "lsm9ds0_ext_am"
#define HAL_INS_MPU9250_NAME "mpu9250"
#define HAL_INS_MPU9250_EXT_NAME "mpu9250_ext"
#define HAL_INS_MPU6500_NAME "mpu6500"
#define HAL_INS_ICM20608_NAME "icm20608"
#define HAL_INS_ICM20608_AM_NAME "icm20608-am"
#define HAL_INS_ICM20608_EXT_NAME "icm20608_ext"
#define HAL_COMPASS_HMC5843_NAME "hmc5843"
#define HAL_COMPASS_LIS3MDL_NAME "lis3mdl"
/* px4fmu-v1 */
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V1
#define HAL_BARO_MS5611_I2C_ADDR 0x76
#define HAL_BARO_MS5611_I2C_BUS 0
#define HAL_HAVE_BOARD_VOLTAGE 0
#define HAL_PX4_HAVE_PWM_INPUT 0
#endif
/* px4fmu-v4 */
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V4
#define HAL_PX4_HAVE_PX4IO 0
#endif
/* aerofc-v1 */
#ifdef CONFIG_ARCH_BOARD_AEROFC_V1
#define HAL_BARO_MS5607_I2C_ADDR 0x77
#define HAL_BARO_MS5607_I2C_BUS 0
#define HAL_COMPASS_IST8310_I2C_ADDR 0x0E
#define HAL_COMPASS_IST8310_I2C_BUS 1
#define HAL_SERIAL0_BAUD_DEFAULT 921600
#define HAL_HAVE_BOARD_VOLTAGE 0
#define HAL_HAVE_SAFETY_SWITCH 0
#define HAL_PX4_HAVE_MTD_SUPPORT 0
#define HAL_PX4_HAVE_PX4IO 0
#define HAL_PX4_HAVE_PWM_INPUT 0
#endif
/* default values */
#ifndef HAL_SERIAL0_BAUD_DEFAULT
#define HAL_SERIAL0_BAUD_DEFAULT 115200
#endif
#ifndef HAL_HAVE_BOARD_VOLTAGE
#define HAL_HAVE_BOARD_VOLTAGE 1
#endif
#ifndef HAL_HAVE_SERVO_VOLTAGE
#define HAL_HAVE_SERVO_VOLTAGE 1
#endif
#ifndef HAL_PX4_HAVE_MTD_SUPPORT
#define HAL_PX4_HAVE_MTD_SUPPORT 1
#endif
#ifndef HAL_PX4_HAVE_PX4IO
#define HAL_PX4_HAVE_PX4IO 1
#endif
#ifndef HAL_PX4_HAVE_PWM_INPUT
#define HAL_PX4_HAVE_PWM_INPUT 1
#endif
#ifndef HAL_HAVE_SAFETY_SWITCH
#define HAL_HAVE_SAFETY_SWITCH 1
#endif
#ifndef AP_FEATURE_RTSCTS
#define AP_FEATURE_RTSCTS 1
#endif
#ifndef AP_FEATURE_SBUS_OUT
#define AP_FEATURE_SBUS_OUT 1
#endif
#ifndef HAL_WITH_UAVCAN
#define HAL_WITH_UAVCAN 0
#endif
#include <AP_HAL_PX4/Semaphores.h>
#define HAL_Semaphore PX4::Semaphore
#define HAL_Semaphore_Recursive PX4::Semaphore_Recursive

View File

@ -1,104 +0,0 @@
#pragma once
#define HAL_BOARD_NAME "VRBRAIN"
#define HAL_CPU_CLASS HAL_CPU_CLASS_150
#define HAL_OS_POSIX_IO 1
#define HAL_BOARD_LOG_DIRECTORY "/fs/microsd/APM/LOGS"
#define HAL_BOARD_TERRAIN_DIRECTORY "/fs/microsd/APM/TERRAIN"
#define HAL_PARAM_DEFAULTS_PATH "/etc/defaults.parm"
#define HAL_INS_DEFAULT HAL_INS_VRBRAIN
#define HAL_BARO_DEFAULT HAL_BARO_VRBRAIN
#define HAL_COMPASS_DEFAULT HAL_COMPASS_VRBRAIN
#define HAL_HAVE_GETTIME_SETTIME 1
#ifdef CONFIG_ARCH_BOARD_VRBRAIN_V45
#define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_VRBRAIN_V45
#define HAL_STORAGE_SIZE 8192
#elif defined(CONFIG_ARCH_BOARD_VRBRAIN_V51)
#define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_VRBRAIN_V51
#define HAL_STORAGE_SIZE 16384
#elif defined(CONFIG_ARCH_BOARD_VRBRAIN_V52)
#define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_VRBRAIN_V52
#define HAL_STORAGE_SIZE 16384
#elif defined(CONFIG_ARCH_BOARD_VRBRAIN_V52E)
#define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_VRBRAIN_V52E
#define HAL_STORAGE_SIZE 8192
#elif defined(CONFIG_ARCH_BOARD_VRUBRAIN_V51)
#define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_VRUBRAIN_V51
#define HAL_STORAGE_SIZE 8192
#elif defined(CONFIG_ARCH_BOARD_VRUBRAIN_V52)
#define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_VRUBRAIN_V52
#define HAL_STORAGE_SIZE 8192
#elif defined(CONFIG_ARCH_BOARD_VRCORE_V10)
#define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_VRCORE_V10
#define HAL_STORAGE_SIZE 16384
#elif defined(CONFIG_ARCH_BOARD_VRBRAIN_V54)
#define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_VRBRAIN_V54
#define HAL_STORAGE_SIZE 16384
#else
#error "Unknown VRBRAIN board type"
#endif
#define HAL_GPIO_A_LED_PIN 25
#define HAL_GPIO_B_LED_PIN 26
#define HAL_GPIO_C_LED_PIN 27
#define HAL_GPIO_LED_ON 1
#define HAL_GPIO_LED_OFF 0
#define EXTERNAL_LED_GPS 28 // GPS LED - AN10
#define EXTERNAL_LED_ARMED 29 // Armed LED - AN11
#define EXTERNAL_LED_MOTOR1 30 // Motor1 LED - AN8
#define EXTERNAL_LED_MOTOR2 31 // Motor2 LED - AN12
#define HAL_BUZZER_PIN 32
#define HAL_BARO_MS5611_NAME "ms5611"
#define HAL_BARO_MS5611_SPI_INT_NAME "ms5611_int"
#define HAL_BARO_MS5611_SPI_EXT_NAME "ms5611_ext"
#define HAL_BARO_MS5611_SPI_IMU_NAME "ms5611_imu"
#define HAL_INS_MPU60x0_NAME "mpu6000"
#define HAL_INS_MPU60x0_EXT_NAME "mpu6000_ext"
#define HAL_INS_MPU60x0_IMU_NAME "mpu6000_imu"
#define HAL_INS_LSM9DS0_G_NAME "lsm9ds0_g"
#define HAL_INS_LSM9DS0_A_NAME "lsm9ds0_am"
#define HAL_INS_LSM9DS0_EXT_G_NAME "lsm9ds0_ext_g"
#define HAL_INS_LSM9DS0_EXT_A_NAME "lsm9ds0_ext_am"
#define HAL_INS_MPU9250_NAME "mpu9250"
#define HAL_INS_MPU9250_EXT_NAME "mpu9250_ext"
#define HAL_INS_MPU6500_NAME "mpu6500"
#define HAL_INS_ICM20608_NAME "icm20608"
#define HAL_INS_ICM20608_AM_NAME "icm20608-am"
#define HAL_INS_ICM20608_EXT_NAME "icm20608_ext"
#define HAL_COMPASS_HMC5843_NAME "hmc5843"
#define HAL_COMPASS_HMC5843_EXT_NAME "hmc5843_ext"
#define HAL_COMPASS_HMC5843_IMU_NAME "hmc5843_imu"
#define HAL_COMPASS_LIS3MDL_NAME "lis3mdl"
#ifndef HAL_HAVE_BOARD_VOLTAGE
#define HAL_HAVE_BOARD_VOLTAGE 0
#endif
#ifndef HAL_HAVE_BOARD_VOLTAGE
#define HAL_HAVE_SERVO_VOLTAGE 1
#endif
#ifndef HAL_PX4_HAVE_MTD_SUPPORT
#define HAL_PX4_HAVE_MTD_SUPPORT 1
#endif
#ifndef HAL_PX4_HAVE_PWM_INPUT
#define HAL_PX4_HAVE_PWM_INPUT 1
#endif
#ifndef HAL_HAVE_SAFETY_SWITCH
#define HAL_HAVE_SAFETY_SWITCH 1
#endif
#include <AP_HAL_VRBRAIN/Semaphores.h>
#define HAL_Semaphore VRBRAIN::Semaphore

View File

@ -6,7 +6,7 @@
// we need a boardconfig created so that the io processor's enable // we need a boardconfig created so that the io processor's enable
// parameter is available // parameter is available
#if HAL_WITH_IO_MCU || CONFIG_HAL_BOARD == HAL_BOARD_PX4 || CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN #if HAL_WITH_IO_MCU
#include <AP_BoardConfig/AP_BoardConfig.h> #include <AP_BoardConfig/AP_BoardConfig.h>
#include <AP_IOMCU/AP_IOMCU.h> #include <AP_IOMCU/AP_IOMCU.h>
AP_BoardConfig BoardConfig; AP_BoardConfig BoardConfig;
@ -25,7 +25,7 @@ static uint16_t last_value[MAX_CHANNELS];
void setup(void) void setup(void)
{ {
hal.console->printf("Starting RCInput test\n"); hal.console->printf("Starting RCInput test\n");
#if HAL_WITH_IO_MCU || CONFIG_HAL_BOARD == HAL_BOARD_PX4 || CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN #if HAL_WITH_IO_MCU
BoardConfig.init(); BoardConfig.init();
#endif #endif
} }

View File

@ -1,52 +0,0 @@
/*
* Copyright (C) 2017 Intel Corporation. All rights reserved.
*
* This file is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <AP_HAL/AP_HAL.h>
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4 && CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_PX4_AEROFC_V1
#include "RCOutput_Tap.h"
#include <termios.h>
#include <string.h>
namespace ap {
bool RCOutput_Tap::_uart_set_speed(int speed)
{
if (_uart_fd < 0) {
return false;
}
struct termios uart_config;
memset(&uart_config, 0, sizeof(uart_config));
tcgetattr(_uart_fd, &uart_config);
// set baud rate
if (cfsetispeed(&uart_config, speed) < 0 || cfsetospeed(&uart_config, speed) < 0) {
return false;
}
if (tcsetattr(_uart_fd, TCSANOW, &uart_config) < 0) {
return false;
}
return true;
}
}
#endif