SPRacingF3Mini - Quick hack to allow configuration to be reset when

holding buttons A and B down for 5 seconds when powering on.
This commit is contained in:
Dominic Clifton 2015-10-07 01:08:31 +01:00 committed by borisbstyle
parent b030d494c8
commit 180e1cb7b6
2 changed files with 42 additions and 3 deletions

View File

@ -193,6 +193,41 @@ void init(void)
ledInit(false);
#endif
#ifdef SPRACINGF3MINI
gpio_config_t buttonAGpioConfig = {
BUTTON_A_PIN,
Mode_IPU,
Speed_2MHz
};
gpioInit(BUTTON_A_PORT, &buttonAGpioConfig);
gpio_config_t buttonBGpioConfig = {
BUTTON_B_PIN,
Mode_IPU,
Speed_2MHz
};
gpioInit(BUTTON_B_PORT, &buttonBGpioConfig);
// Check status of bind plug and exit if not active
delayMicroseconds(10); // allow GPIO configuration to settle
if (!isMPUSoftReset()) {
uint8_t secondsRemaining = 5;
bool bothButtonsHeld;
do {
bothButtonsHeld = !digitalIn(BUTTON_A_PORT, BUTTON_A_PIN) && !digitalIn(BUTTON_B_PORT, BUTTON_B_PIN);
if (bothButtonsHeld) {
if (--secondsRemaining == 0) {
resetEEPROM();
systemReset();
}
delay(1000);
LED0_TOGGLE;
}
} while (bothButtonsHeld);
}
#endif
#ifdef SPEKTRUM_BIND
if (feature(FEATURE_RX_SERIAL)) {
switch (masterConfig.rxConfig.serialrx_provider) {

View File

@ -180,12 +180,16 @@
#define USE_SERVOS
#define USE_CLI
#define BUTTON_A_PORT GPIOB
#define BUTTON_A_PIN Pin_1
#define BUTTON_B_PORT GPIOB
#define BUTTON_B_PIN Pin_0
#define SPEKTRUM_BIND
// USART3,
#define BIND_PORT GPIOB
#define BIND_PIN Pin_11
#define HARDWARE_BIND_PLUG
// Hardware bind plug at PB1
#define BINDPLUG_PORT GPIOB
#define BINDPLUG_PIN Pin_1
#define BINDPLUG_PORT BUTTON_B_PORT
#define BINDPLUG_PIN BUTTON_B_PIN