From 5b90d785183b05a2973acdfd70c87ebf7799becd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Mon, 21 May 2018 02:21:30 +0200 Subject: [PATCH] Add IsFactoryResetModeEnabled. --- lib/agent | 2 +- right/src/main.c | 3 ++- right/src/peripherals/reset_button.c | 2 ++ right/src/peripherals/reset_button.h | 4 ++++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/agent b/lib/agent index e294727..6c4f580 160000 --- a/lib/agent +++ b/lib/agent @@ -1 +1 @@ -Subproject commit e294727ac53da2bf3bc59ac666d7ba719fefdc6a +Subproject commit 6c4f580fc2dc6da2c0b8b92f96b4f164b89db6e1 diff --git a/right/src/main.c b/right/src/main.c index 6101268..834fc23 100644 --- a/right/src/main.c +++ b/right/src/main.c @@ -30,7 +30,8 @@ int main(void) InitClock(); InitPeripherals(); - if (RESET_BUTTON_IS_PRESSED) { + IsFactoryResetModeEnabled = RESET_BUTTON_IS_PRESSED; + if (IsFactoryResetModeEnabled) { HardwareConfig->signatureLength = HARDWARE_CONFIG_SIGNATURE_LENGTH; strncpy(HardwareConfig->signature, "FTY", HARDWARE_CONFIG_SIGNATURE_LENGTH); } else { diff --git a/right/src/peripherals/reset_button.c b/right/src/peripherals/reset_button.c index d9e3a87..4e450fd 100644 --- a/right/src/peripherals/reset_button.c +++ b/right/src/peripherals/reset_button.c @@ -2,6 +2,8 @@ #include "fsl_port.h" #include "bootloader/wormhole.h" +bool IsFactoryResetModeEnabled = false; + void RESET_BUTTON_IRQ_HANDLER(void) { Wormhole.magicNumber = WORMHOLE_MAGIC_NUMBER; diff --git a/right/src/peripherals/reset_button.h b/right/src/peripherals/reset_button.h index 1c3bdfa..5313afd 100644 --- a/right/src/peripherals/reset_button.h +++ b/right/src/peripherals/reset_button.h @@ -16,6 +16,10 @@ #define RESET_BUTTON_IS_PRESSED !GPIO_ReadPinInput(RESET_BUTTON_GPIO, RESET_BUTTON_PIN) +// Variables: + + extern bool IsFactoryResetModeEnabled; + // Functions: void InitResetButton(void);