From 591e0c22491f7aa922dc885ce6bd741bbcdf6c94 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 17 Jan 2018 09:08:01 +1100 Subject: [PATCH] HAL_ChibiOS: allow control of interrupt port F412 has radio IRQ on port B --- libraries/AP_HAL_ChibiOS/GPIO.cpp | 32 +++++++++---------- libraries/AP_HAL_ChibiOS/hwdef/common/board.h | 5 +++ .../hwdef/skyviper-f412/hwdef.dat | 5 +-- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/libraries/AP_HAL_ChibiOS/GPIO.cpp b/libraries/AP_HAL_ChibiOS/GPIO.cpp index 9fb366aef7..14bc41a2f7 100644 --- a/libraries/AP_HAL_ChibiOS/GPIO.cpp +++ b/libraries/AP_HAL_ChibiOS/GPIO.cpp @@ -80,22 +80,22 @@ static EXTConfig extcfg = { }; static const uint32_t irq_port_list[] = { - EXT_MODE_GPIOD, //Chan 0 - EXT_MODE_GPIOD, //Chan 1 - EXT_MODE_GPIOD, //Chan 2 - EXT_MODE_GPIOD, //Chan 3 - EXT_MODE_GPIOD, //Chan 4 - EXT_MODE_GPIOD, //Chan 5 - EXT_MODE_GPIOD, //Chan 6 - EXT_MODE_GPIOD, //Chan 7 - EXT_MODE_GPIOD, //Chan 8 - EXT_MODE_GPIOD, //Chan 9 - EXT_MODE_GPIOD, //Chan 10 - EXT_MODE_GPIOD, //Chan 11 - EXT_MODE_GPIOD, //Chan 12 - EXT_MODE_GPIOD, //Chan 13 - EXT_MODE_GPIOD, //Chan 14 - EXT_MODE_GPIOD //Chan 15 + HAL_GPIO_INTERRUPT_PORT, //Chan 0 + HAL_GPIO_INTERRUPT_PORT, //Chan 1 + HAL_GPIO_INTERRUPT_PORT, //Chan 2 + HAL_GPIO_INTERRUPT_PORT, //Chan 3 + HAL_GPIO_INTERRUPT_PORT, //Chan 4 + HAL_GPIO_INTERRUPT_PORT, //Chan 5 + HAL_GPIO_INTERRUPT_PORT, //Chan 6 + HAL_GPIO_INTERRUPT_PORT, //Chan 7 + HAL_GPIO_INTERRUPT_PORT, //Chan 8 + HAL_GPIO_INTERRUPT_PORT, //Chan 9 + HAL_GPIO_INTERRUPT_PORT, //Chan 10 + HAL_GPIO_INTERRUPT_PORT, //Chan 11 + HAL_GPIO_INTERRUPT_PORT, //Chan 12 + HAL_GPIO_INTERRUPT_PORT, //Chan 13 + HAL_GPIO_INTERRUPT_PORT, //Chan 14 + HAL_GPIO_INTERRUPT_PORT //Chan 15 }; GPIO::GPIO() diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/board.h b/libraries/AP_HAL_ChibiOS/hwdef/common/board.h index 6b99e1d66f..aa3530a38a 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/board.h +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/board.h @@ -26,6 +26,11 @@ #define HAL_BOARD_INIT_HOOK_CALL #endif +// default to interrupts on port D +#ifndef HAL_GPIO_INTERRUPT_PORT +#define HAL_GPIO_INTERRUPT_PORT EXT_MODE_GPIOD +#endif + #if !defined(_FROM_ASM_) #ifdef __cplusplus extern "C" { diff --git a/libraries/AP_HAL_ChibiOS/hwdef/skyviper-f412/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/skyviper-f412/hwdef.dat index 679b34b5a3..3a2bd87306 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/skyviper-f412/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/skyviper-f412/hwdef.dat @@ -103,8 +103,9 @@ define HAL_INS_DEFAULT_ROTATION ROTATION_NONE define HAL_INS_MPU60x0_I2C_BUS 1 define HAL_INS_MPU60x0_I2C_ADDR 0x68 -define HAL_GPIO_RADIO_RESET 1 -define HAL_GPIO_RADIO_IRQ 2 +# radio IRQ is on PB0 +define HAL_GPIO_RADIO_IRQ 0 +define HAL_GPIO_INTERRUPT_PORT EXT_MODE_GPIOB define HAL_RCINPUT_WITH_AP_RADIO 1 define STORAGE_FLASH_PAGE 1