AP_HAL: added QURT board type and header

This commit is contained in:
Andrew Tridgell 2024-07-06 09:16:56 +10:00
parent af34df2b9f
commit 4e8f1e6092
3 changed files with 115 additions and 0 deletions

View File

@ -14,6 +14,7 @@
#define HAL_BOARD_CHIBIOS 10
#define HAL_BOARD_F4LIGHT 11 // reserved
#define HAL_BOARD_ESP32 12
#define HAL_BOARD_QURT 13
#define HAL_BOARD_EMPTY 99
/* Default board subtype is -1 */
@ -139,6 +140,8 @@
#include <AP_HAL/board/chibios.h>
#elif CONFIG_HAL_BOARD == HAL_BOARD_ESP32
#include <AP_HAL/board/esp32.h>
#elif CONFIG_HAL_BOARD == HAL_BOARD_QURT
#include <AP_HAL/board/qurt.h>
#else
#error "Unknown CONFIG_HAL_BOARD type"
#endif

View File

@ -20,8 +20,12 @@
#include "AP_HAL_Namespace.h"
#include "utility/functor.h"
#include "AP_HAL_Boards.h"
#if CONFIG_HAL_BOARD != HAL_BOARD_QURT
// we need utility for std::move, but not on QURT due to a include error in hexagon SDK
#include <utility>
#endif
/*
* This is an interface abstracting I2C and SPI devices

View File

@ -0,0 +1,108 @@
#pragma once
#include <AP_HAL_QURT/AP_HAL_QURT_Main.h>
#define HAL_BOARD_NAME "QURT"
#define HAL_CPU_CLASS HAL_CPU_CLASS_1000
#define HAL_MEM_CLASS HAL_MEM_CLASS_1000
#define HAL_STORAGE_SIZE 32768
#define HAL_STORAGE_SIZE_AVAILABLE HAL_STORAGE_SIZE
// only include if compiling C++ code
#ifdef __cplusplus
#include <AP_HAL_QURT/Semaphores.h>
#define HAL_Semaphore QURT::Semaphore
#define HAL_BinarySemaphore QURT::BinarySemaphore
#endif
#ifndef HAL_HAVE_HARDWARE_DOUBLE
#define HAL_HAVE_HARDWARE_DOUBLE 0
#endif
#ifndef HAL_WITH_EKF_DOUBLE
#define HAL_WITH_EKF_DOUBLE HAL_HAVE_HARDWARE_DOUBLE
#endif
#ifndef HAL_GYROFFT_ENABLED
#define HAL_GYROFFT_ENABLED 0
#endif
/*
disable features for initial port
*/
#define HAL_HAVE_BOARD_VOLTAGE 0
#define HAL_HAVE_SERVO_VOLTAGE 0
#define HAL_HAVE_SAFETY_SWITCH 0
#define HAL_WITH_MCU_MONITORING 0
#define HAL_USE_QUADSPI 0
#define HAL_WITH_DSP 0
#define HAL_CANFD_SUPPORTED 0
#define HAL_NUM_CAN_IFACES 0
#define AP_CRASHDUMP_ENABLED 0
#define HAL_ENABLE_DFU_BOOT 0
#define HAL_LOGGING_MAVLINK_ENABLED 0
#define HAL_LOGGING_FILESYSTEM_ENABLED 1
#define AP_FILESYSTEM_POSIX_HAVE_UTIME 0
#define AP_FILESYSTEM_POSIX_HAVE_FSYNC 0
#define AP_FILESYSTEM_POSIX_HAVE_STATFS 0
#define AP_FILESYSTEM_HAVE_DIRENT_DTYPE 0
#define AP_FILESYSTEM_POSIX_MAP_FILENAME_ALLOC 1
#define AP_FILESYSTEM_POSIX_MAP_FILENAME_BASEDIR "/data"
#define HAL_BOARD_STORAGE_DIRECTORY "APM"
#define HAL_BOARD_LOG_DIRECTORY "APM/logs"
#define HAL_BOARD_TERRAIN_DIRECTORY "APM/terrain"
#define SCRIPTING_DIRECTORY "APM/scripts"
/*
a defaults file for this vehicle
*/
#ifndef HAL_PARAM_DEFAULTS_PATH
// this is an absolute path, as required by AP_Param
#define HAL_PARAM_DEFAULTS_PATH AP_FILESYSTEM_POSIX_MAP_FILENAME_BASEDIR "/APM/defaults.parm"
#endif
#define USE_LIBC_REALLOC 1
#define HAL_WITH_ESC_TELEM 1
/*
battery monitoring setup, comes in via ESCs
*/
#define HAL_BATT_VOLT_PIN 1
#define HAL_BATT_CURR_PIN 2
#define HAL_BATT_MONITOR_DEFAULT 4
#define HAL_BATT_VOLT_SCALE 1
#define HAL_BATT_CURR_SCALE 1
/*
compass list
*/
#define PROBE_MAG_I2C(driver, bus, addr, args ...) ADD_BACKEND(DRIVER_ ##driver, AP_Compass_ ## driver::probe(GET_I2C_DEVICE(bus, addr),##args))
#define HAL_MAG_PROBE_LIST PROBE_MAG_I2C(QMC5883L, 0, 0x0d, false, ROTATION_PITCH_180_YAW_90)
/*
barometer list
*/
#define PROBE_BARO_I2C(driver, bus, addr, args ...) ADD_BACKEND(AP_Baro_ ## driver::probe(*this,std::move(GET_I2C_DEVICE(bus, addr)),##args))
#define HAL_BARO_PROBE_LIST PROBE_BARO_I2C(ICP101XX, 3, 0x63)
/*
IMU list
*/
#define PROBE_IMU_SPI(driver, devname, args ...) ADD_BACKEND(AP_InertialSensor_ ## driver::probe(*this,hal.spi->get_device(devname),##args))
#define HAL_INS_PROBE_LIST PROBE_IMU_SPI(Invensensev3, "INV3", ROTATION_ROLL_180)
/*
bring in missing standard library functions
*/
#include <AP_HAL_QURT/replace.h>
#define DEFAULT_SERIAL4_PROTOCOL 23 // RC input