AP_Periph: airspeed add support for CAN/I2C switch and LED
This commit is contained in:
parent
9f7aa715b1
commit
a867e04116
@ -27,6 +27,7 @@
|
|||||||
#if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
|
#if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
|
||||||
#include <AP_HAL_ChibiOS/hwdef/common/stm32_util.h>
|
#include <AP_HAL_ChibiOS/hwdef/common/stm32_util.h>
|
||||||
#include <AP_HAL_ChibiOS/hwdef/common/watchdog.h>
|
#include <AP_HAL_ChibiOS/hwdef/common/watchdog.h>
|
||||||
|
#include <AP_HAL_ChibiOS/I2CDevice.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const AP_HAL::HAL &hal;
|
extern const AP_HAL::HAL &hal;
|
||||||
@ -180,10 +181,24 @@ void AP_Periph_FW::init()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAL_PERIPH_ENABLE_AIRSPEED
|
#ifdef HAL_PERIPH_ENABLE_AIRSPEED
|
||||||
if (airspeed.enabled()) {
|
if (airspeed.enabled()){
|
||||||
// Note: logging of ARSPD is not enabled currently. To enable, call airspeed.set_log_bit();
|
#if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
|
||||||
|
const bool pins_enabled = ChibiOS::I2CBus::check_select_pins(0x01);
|
||||||
|
if (pins_enabled) {
|
||||||
|
ChibiOS::I2CBus::set_bus_to_floating(0);
|
||||||
|
#ifdef HAL_GPIO_PIN_LED_CAN_I2C
|
||||||
|
palWriteLine(HAL_GPIO_PIN_LED_CAN_I2C, 1);
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
// Note: logging of ARSPD is not enabled currently. To enable, call airspeed.set_log_bit(); here
|
||||||
|
airspeed.init();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// Note: logging of ARSPD is not enabled currently. To enable, call airspeed.set_log_bit(); here
|
||||||
airspeed.init();
|
airspeed.init();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAL_PERIPH_ENABLE_RANGEFINDER
|
#ifdef HAL_PERIPH_ENABLE_RANGEFINDER
|
||||||
|
Loading…
Reference in New Issue
Block a user