feat(radio): refactor of switch handling to better support customisable switches (#6095)

Co-authored-by: philmoz <phil.a.mitchell@gmail.com>
Co-authored-by: 3djc <3djc@gh.com>
Co-authored-by: elecpower <elecpower@users.noreply.github.com>
This commit is contained in:
philmoz
2025-07-28 12:59:22 +10:00
committed by GitHub
co-authored by philmoz 3djc elecpower
parent 28833f42e6
commit 0c8c39b134
155 changed files with 4538 additions and 2306 deletions
@@ -24,7 +24,7 @@
SwitchHwPos stm32_switch_get_position(const stm32_switch_t* sw)
{
bool inv = sw->flags & SWITCH_HW_INVERTED;
bool inv = sw->inverted;
SwitchHwPos ret = SWITCH_HW_UP;
switch (sw->type) {
@@ -21,20 +21,29 @@
#pragma once
#include "hal.h"
#include "stm32_hal_ll.h"
#include "hal/switch_driver.h"
#include "edgetx_constants.h"
struct stm32_switch_t
{
const char* name;
GPIO_TypeDef* GPIOx_high;
uint32_t Pin_high;
GPIO_TypeDef* GPIOx_low;
uint32_t Pin_low;
SwitchHwType type;
uint8_t flags;
SwitchHwType type;
bool inverted;
SwitchConfig defaultType;
#if defined(FUNCTION_SWITCHES)
bool isCustomSwitch;
uint8_t customSwitchIdx;
#endif
};
SwitchHwPos stm32_switch_get_position(const stm32_switch_t* sw);