Preliminary T18 support (#7581)

This commit is contained in:
3djc
2020-06-22 21:15:47 +02:00
committed by GitHub
parent 02b61fff24
commit 2d01916055
76 changed files with 952 additions and 426 deletions
@@ -51,6 +51,12 @@ void pwrInit()
GPIO_InitStructure.GPIO_Pin = PWR_SWITCH_GPIO_PIN;
GPIO_Init(PWR_SWITCH_GPIO, &GPIO_InitStructure);
#if defined(PWR_EXTRA_SWITCH_GPIO)
// PWR Extra switch
GPIO_InitStructure.GPIO_Pin = PWR_EXTRA_SWITCH_GPIO_PIN;
GPIO_Init(PWR_EXTRA_SWITCH_GPIO, &GPIO_InitStructure);
#endif
#if defined(PCBREV_HARDCODED)
hardwareOptions.pcbrev = PCBREV_HARDCODED;
#elif defined(PCBREV_GPIO_PIN)
@@ -101,9 +107,20 @@ void pwrOff()
GPIO_ResetBits(PWR_ON_GPIO, PWR_ON_GPIO_PIN);
}
#if defined(PWR_EXTRA_SWITCH_GPIO)
bool pwrForcePressed()
{
return (GPIO_ReadInputDataBit(PWR_SWITCH_GPIO, PWR_SWITCH_GPIO_PIN) == Bit_RESET && GPIO_ReadInputDataBit(PWR_EXTRA_SWITCH_GPIO, PWR_EXTRA_SWITCH_GPIO_PIN) == Bit_RESET);
}
#endif
bool pwrPressed()
{
#if defined(PWR_EXTRA_SWITCH_GPIO)
return (GPIO_ReadInputDataBit(PWR_SWITCH_GPIO, PWR_SWITCH_GPIO_PIN) == Bit_RESET || GPIO_ReadInputDataBit(PWR_EXTRA_SWITCH_GPIO, PWR_EXTRA_SWITCH_GPIO_PIN) == Bit_RESET);
#else
return GPIO_ReadInputDataBit(PWR_SWITCH_GPIO, PWR_SWITCH_GPIO_PIN) == Bit_RESET;
#endif
}
void pwrResetHandler()