feat: H7 support (#5738)
Co-authored-by: Richard Li <richard.li@ces.hk> Co-authored-by: philmoz <phil.a.mitchell@gmail.com> Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com>
This commit is contained in:
co-authored by
Richard Li
philmoz
raphaelcoeffic
parent
5a15ffb017
commit
3d25c2a0f8
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "hal/switch_driver.h"
|
||||
#include "bsp_io.h"
|
||||
#include "stm32_switch_driver.h"
|
||||
#include "stm32_gpio_driver.h"
|
||||
|
||||
@@ -36,17 +37,21 @@ __weak void boardInitSwitches()
|
||||
_init_switches();
|
||||
}
|
||||
|
||||
__weak SwitchHwPos boardSwitchGetPosition(uint8_t cat, uint8_t idx)
|
||||
__weak SwitchHwPos boardSwitchGetPosition(SwitchCategory cat, uint8_t idx)
|
||||
{
|
||||
return stm32_switch_get_position(&_switch_offsets[cat][idx]);
|
||||
const stm32_switch_t* sw = &_switch_offsets[cat][idx];
|
||||
if(sw->type != SWITCH_HW_ADC && sw->GPIOx_high == nullptr)
|
||||
return bsp_get_switch_position(sw, cat, idx);
|
||||
|
||||
return stm32_switch_get_position(sw);
|
||||
}
|
||||
|
||||
const char* boardSwitchGetName(uint8_t cat, uint8_t idx)
|
||||
const char* boardSwitchGetName(SwitchCategory cat, uint8_t idx)
|
||||
{
|
||||
return _switch_offsets[cat][idx].name;
|
||||
}
|
||||
|
||||
SwitchHwType boardSwitchGetType(uint8_t cat, uint8_t idx)
|
||||
SwitchHwType boardSwitchGetType(SwitchCategory cat, uint8_t idx)
|
||||
{
|
||||
return _switch_offsets[cat][idx].type;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user