Use new custom switch framework.
This commit is contained in:
committed by
Malte Langermann
parent
f8e70c6a67
commit
dfdbdf023c
@@ -56,12 +56,12 @@ __weak SwitchHwType boardSwitchGetType(SwitchCategory cat, uint8_t idx)
|
|||||||
return _switch_offsets[cat][idx].type;
|
return _switch_offsets[cat][idx].type;
|
||||||
}
|
}
|
||||||
|
|
||||||
__weak uint8_t boardGetMaxSwitches() { return n_switches; }
|
uint8_t boardGetMaxSwitches() { return n_switches; }
|
||||||
__weak uint8_t boardGetMaxFctSwitches() { return n_fct_switches; }
|
uint8_t boardGetMaxFctSwitches() { return n_fct_switches; }
|
||||||
|
|
||||||
__weak swconfig_t boardSwitchGetDefaultConfig() { return _switch_default_config; }
|
swconfig_t boardSwitchGetDefaultConfig() { return _switch_default_config; }
|
||||||
|
|
||||||
__weak switch_display_pos_t switchGetDisplayPosition(uint8_t idx)
|
switch_display_pos_t switchGetDisplayPosition(uint8_t idx)
|
||||||
{
|
{
|
||||||
// TODO: find a solution for FLEX switches so they can be displayed on main view
|
// TODO: find a solution for FLEX switches so they can be displayed on main view
|
||||||
if (idx >= DIM(_switch_display)) return {0, 0};
|
if (idx >= DIM(_switch_display)) return {0, 0};
|
||||||
|
|||||||
@@ -63,10 +63,8 @@
|
|||||||
#define TRIMS_GPIO_PIN_T2R
|
#define TRIMS_GPIO_PIN_T2R
|
||||||
|
|
||||||
// Switches
|
// Switches
|
||||||
#define SWITCHES_GPIO_REG_A
|
#define SWITCHES_A_2POS
|
||||||
#define SWITCHES_GPIO_PIN_A
|
#define SWITCHES_B_2POS
|
||||||
#define SWITCHES_GPIO_REG_B
|
|
||||||
#define SWITCHES_GPIO_PIN_B
|
|
||||||
|
|
||||||
// Keys
|
// Keys
|
||||||
#define KEYS_GPIO_PIN_ENTER
|
#define KEYS_GPIO_PIN_ENTER
|
||||||
|
|||||||
@@ -30,51 +30,7 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define __weak __attribute__((weak))
|
static const char _switch_names[][4] = {"SW2", "SW3"};
|
||||||
|
|
||||||
static const stm32_switch_t _switch_defs[] = {
|
|
||||||
/* {
|
|
||||||
"SW1L",
|
|
||||||
nullptr, 0,
|
|
||||||
nullptr, 0,
|
|
||||||
SWITCH_HW_2POS, 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SW1R",
|
|
||||||
nullptr, 0,
|
|
||||||
nullptr, 0,
|
|
||||||
SWITCH_HW_2POS, 0
|
|
||||||
},*/
|
|
||||||
{
|
|
||||||
"SW2",
|
|
||||||
nullptr, 0,
|
|
||||||
nullptr, 0,
|
|
||||||
SWITCH_HW_2POS, 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SW3",
|
|
||||||
nullptr, 0,
|
|
||||||
nullptr, 0,
|
|
||||||
SWITCH_HW_2POS, 0
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr uint8_t n_switches = 2;
|
|
||||||
constexpr uint8_t n_fct_switches = 0;
|
|
||||||
|
|
||||||
constexpr swconfig_t _switch_default_config = (swconfig_t)0
|
|
||||||
| ((swconfig_t)SWITCH_2POS << (0 * SW_CFG_BITS))
|
|
||||||
| ((swconfig_t)SWITCH_2POS << (1 * SW_CFG_BITS))
|
|
||||||
/* | ((swconfig_t)SWITCH_2POS << (2 * SW_CFG_BITS))
|
|
||||||
| ((swconfig_t)SWITCH_2POS << (3 * SW_CFG_BITS))*/
|
|
||||||
;
|
|
||||||
|
|
||||||
const switch_display_pos_t _switch_display[] = {
|
|
||||||
{ 0, 0 },
|
|
||||||
{ 0, 0 },
|
|
||||||
/* { 0, 0 },
|
|
||||||
{ 0, 0 },*/
|
|
||||||
};
|
|
||||||
|
|
||||||
SwitchHwPos boardSwitchGetPosition(uint8_t cat, uint8_t idx)
|
SwitchHwPos boardSwitchGetPosition(uint8_t cat, uint8_t idx)
|
||||||
{
|
{
|
||||||
@@ -101,23 +57,5 @@ SwitchHwPos boardSwitchGetPosition(uint8_t cat, uint8_t idx)
|
|||||||
|
|
||||||
const char* boardSwitchGetName(uint8_t cat, uint8_t idx)
|
const char* boardSwitchGetName(uint8_t cat, uint8_t idx)
|
||||||
{
|
{
|
||||||
return _switch_defs[idx].name;
|
return _switch_names[idx];
|
||||||
}
|
|
||||||
|
|
||||||
SwitchHwType boardSwitchGetType(uint8_t cat, uint8_t idx)
|
|
||||||
{
|
|
||||||
return _switch_defs[idx].type;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t boardGetMaxSwitches() { return n_switches; }
|
|
||||||
uint8_t boardGetMaxFctSwitches() { return n_fct_switches; }
|
|
||||||
|
|
||||||
swconfig_t boardSwitchGetDefaultConfig() { return _switch_default_config; }
|
|
||||||
|
|
||||||
switch_display_pos_t switchGetDisplayPosition(uint8_t idx)
|
|
||||||
{
|
|
||||||
// TODO: find a solution for FLEX switches so they can be displayed on main view
|
|
||||||
if (idx >= DIM(_switch_display)) return {0, 0};
|
|
||||||
|
|
||||||
return _switch_display[idx];
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user