From ca9713b27517403b119c6d1c4993f13c26562545 Mon Sep 17 00:00:00 2001 From: bugobliterator Date: Tue, 17 Sep 2024 15:26:09 +1000 Subject: [PATCH] AP_BoardConfig: add option to use IO safety led switch for ProfiLED --- libraries/AP_BoardConfig/AP_BoardConfig.cpp | 2 +- libraries/AP_BoardConfig/AP_BoardConfig.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libraries/AP_BoardConfig/AP_BoardConfig.cpp b/libraries/AP_BoardConfig/AP_BoardConfig.cpp index a802f9e138..b3af55da94 100644 --- a/libraries/AP_BoardConfig/AP_BoardConfig.cpp +++ b/libraries/AP_BoardConfig/AP_BoardConfig.cpp @@ -281,7 +281,7 @@ const AP_Param::GroupInfo AP_BoardConfig::var_info[] = { // @Param: OPTIONS // @DisplayName: Board options // @Description: Board specific option flags - // @Bitmask: 0:Enable hardware watchdog, 1:Disable MAVftp, 2:Enable set of internal parameters, 3:Enable Debug Pins, 4:Unlock flash on reboot, 5:Write protect firmware flash on reboot, 6:Write protect bootloader flash on reboot, 7:Skip board validation, 8:Disable board arming gpio output change on arm/disarm + // @Bitmask: 0:Enable hardware watchdog, 1:Disable MAVftp, 2:Enable set of internal parameters, 3:Enable Debug Pins, 4:Unlock flash on reboot, 5:Write protect firmware flash on reboot, 6:Write protect bootloader flash on reboot, 7:Skip board validation, 8:Disable board arming gpio output change on arm/disarm, 9:Use safety pins as profiled // @User: Advanced AP_GROUPINFO("OPTIONS", 19, AP_BoardConfig, _options, HAL_BRD_OPTIONS_DEFAULT), diff --git a/libraries/AP_BoardConfig/AP_BoardConfig.h b/libraries/AP_BoardConfig/AP_BoardConfig.h index 3f6401d624..1ff4e2038e 100644 --- a/libraries/AP_BoardConfig/AP_BoardConfig.h +++ b/libraries/AP_BoardConfig/AP_BoardConfig.h @@ -158,7 +158,8 @@ public: WRITE_PROTECT_FLASH = (1<<5), WRITE_PROTECT_BOOTLOADER = (1<<6), SKIP_BOARD_VALIDATION = (1<<7), - DISABLE_ARMING_GPIO = (1<<8) + DISABLE_ARMING_GPIO = (1<<8), + IO_SAFETY_PINS_AS_PROFILED = (1<<9), }; //return true if arming gpio output is disabled @@ -200,6 +201,12 @@ public: return _singleton?(_singleton->_options & ALLOW_SET_INTERNAL_PARM)!=0:false; } +#if HAL_WITH_IO_MCU + static bool use_safety_as_led(void) { + return _singleton?(_singleton->_options & IO_SAFETY_PINS_AS_PROFILED)!=0:false; + } +#endif + // handle press of safety button. Return true if safety state // should be toggled bool safety_button_handle_pressed(uint8_t press_count);