AP_HAL: added F4Light HAL

This commit is contained in:
night-ghost 2018-02-03 07:35:15 +11:00 committed by Andrew Tridgell
parent 61793c485a
commit f8569ac39e
4 changed files with 94 additions and 1 deletions

View File

@ -13,7 +13,8 @@
#define HAL_BOARD_VRBRAIN 8
#define HAL_BOARD_QURT 9
#define HAL_BOARD_CHIBIOS 10
#define HAL_BOARD_EMPTY 99
#define HAL_BOARD_F4LIGHT 11
#define HAL_BOARD_EMPTY 99
/* Default board subtype is -1 */
#define HAL_BOARD_SUBTYPE_NONE -1
@ -170,6 +171,8 @@
#include <AP_HAL/board/vrbrain.h>
#elif CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
#include <AP_HAL/board/chibios.h>
#elif CONFIG_HAL_BOARD == HAL_BOARD_F4LIGHT
#include <AP_HAL/board/f4light.h>
#else
#error "Unknown CONFIG_HAL_BOARD type"
#endif

View File

@ -191,6 +191,15 @@ public:
*/
virtual bool unregister_callback(PeriodicHandle h) { return false; }
/*
allows to set callback that will be called after DMA transfer complete.
if this callback is set then any read/write operation will return directly after transfer setup and
bus semaphore must not be released until register_completion_callback(0) called from callback itself
*/
virtual void register_completion_callback(AP_HAL::MemberProc proc) {}
virtual void register_completion_callback(AP_HAL::Proc proc) {}
/*
* support for direct control of SPI chip select. Needed for
* devices with unusual SPI transfer patterns that include

View File

@ -1,5 +1,7 @@
#pragma once
class AP_Param;
#include "AP_HAL_Namespace.h"
#include "AnalogIn.h"
@ -15,6 +17,12 @@
#include "CAN.h"
#endif
#if defined(HAL_NEEDS_PARAM_HELPER)
#include <AP_Param/AP_Param.h>
class AP_Param_Helper;
#endif
class AP_HAL::HAL {
public:
HAL(AP_HAL::UARTDriver* _uartA, // console

View File

@ -0,0 +1,73 @@
#include <AP_HAL_F4Light/hardware/hal/syscalls.h>
#define HAL_NEEDS_PARAM_HELPER
#define AP_HAL_BOARD_DRIVER AP_HAL_F4Light
#define HAL_SERIAL0_BAUD_DEFAULT (115200)
#define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_NONE
#define HAL_BOARD_NAME BOARD_OWN_NAME
#define HAL_CPU_CLASS HAL_CPU_CLASS_150
#define HAL_OS_POSIX_IO 0
#define HAL_STORAGE_SIZE BOARD_STORAGE_SIZE // EEPROM size
#define HAL_BARO_DEFAULT BOARD_BARO_DEFAULT
#define HAL_COMPASS_DEFAULT BOARD_COMPASS_DEFAULT
#define HAL_INS_DEFAULT BOARD_INS_DEFAULT
#define HAL_INS_DEFAULT_ROTATION BOARD_INS_ROTATION
#define HAL_INS_MPU60x0_NAME BOARD_INS_MPU60x0_NAME
#define INVENSENSE_DRDY_PIN BOARD_MPU6000_DRDY_PIN
// via interrupt
#ifdef BOARD_HMC5883_DRDY_PIN
#define HMC5883_DRDY_PIN BOARD_HMC5883_DRDY_PIN
#endif
#ifdef BOARD_DATAFLASH_NAME
#define HAL_DATAFLASH_NAME BOARD_DATAFLASH_NAME
#endif
#ifdef BOARD_BUZZER_PIN
#define BUZZER_PIN BOARD_BUZZER_PIN
#endif
# define PUSHBUTTON_PIN BOARD_PUSHBUTTON_PIN
# define USB_MUX_PIN BOARD_USB_MUX_PIN
# define BATTERY_VOLT_PIN BOARD_BATTERY_VOLT_PIN // Battery voltage on A0 (PC2) D8
# define BATTERY_CURR_PIN BOARD_BATTERY_CURR_PIN // Battery current on A1 (PC1) D7
# define CONFIG_SONAR_SOURCE_ANALOG_PIN BOARD_SONAR_SOURCE_ANALOG_PIN
#undef TOSHIBA_LED_I2C_BUS // someone placed this not in board config
#define TOSHIBA_LED_I2C_ADDR 0x55 // default I2C bus address
#define TOSHIBA_LED_I2C_BUS 2 // external I2C
#define HAL_MINIMIZE_FEATURES 1
#define AC_TERRAIN DISABLED // no SD card with POSIX IO
#define PRECISION_LANDING DISABLED
#define CONFIG_PUSHBUTTON DISABLED
#define SPRAYER DISABLED
#define EPM_ENABLED DISABLED
#define CLI_ENABLED DISABLED
#define GRIPPER_ENABLED DISABLED // not for large quads
// disable for debugging with -O0
// #define FRSKY_TELEM_ENABLED DISABLED
// #define CAMERA DISABLED
// #define CONFIG_RELAY DISABLED
// #define MOUNT DISABLED
// #define ADSB_ENABLED DISABLED
#define LOGGING_ENABLED ENABLED