From 5051448a3a648ac0f8ccdc63eff5ecd1e61e6817 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Thu, 11 May 2023 23:38:35 -0700 Subject: [PATCH] enable software knock on PA3 for F407 #105 --- firmware/config/boards/f407-discovery/board.mk | 2 ++ .../config/boards/f407-discovery/knock_config.h | 16 ++++++++++++++++ .../config/boards/f407-discovery/prepend.txt | 1 + 3 files changed, 19 insertions(+) create mode 100644 firmware/config/boards/f407-discovery/knock_config.h diff --git a/firmware/config/boards/f407-discovery/board.mk b/firmware/config/boards/f407-discovery/board.mk index 6ddbf50492..b7d121aedc 100644 --- a/firmware/config/boards/f407-discovery/board.mk +++ b/firmware/config/boards/f407-discovery/board.mk @@ -28,6 +28,8 @@ DDEFS += -DTS_SECONDARY_UxART_PORT=SD3 DDEFS += -DSTM32_I2C_USE_I2C3=TRUE +DDEFS += -DEFI_SOFTWARE_KNOCK=TRUE -DSTM32_ADC_USE_ADC3=TRUE + ifndef IS_RE_BOOTLOADER DDEFS += -DHAL_USE_EEPROM=TRUE endif \ No newline at end of file diff --git a/firmware/config/boards/f407-discovery/knock_config.h b/firmware/config/boards/f407-discovery/knock_config.h new file mode 100644 index 0000000000..73e5185d56 --- /dev/null +++ b/firmware/config/boards/f407-discovery/knock_config.h @@ -0,0 +1,16 @@ +/** + * @file knock_config.h + */ + +#pragma once + +// Knock is on ADC3 +#define KNOCK_ADC ADCD3 + +// knock 1 - pin PA3 +#define KNOCK_ADC_CH1 ADC_CHANNEL_IN3 +#define KNOCK_PIN_CH1 Gpio::A3 + +// Sample rate & time - depends on the exact MCU +#define KNOCK_SAMPLE_TIME ADC_SAMPLE_84 +#define KNOCK_SAMPLE_RATE (STM32_PCLK2 / (4 * (84 + 12))) diff --git a/firmware/config/boards/f407-discovery/prepend.txt b/firmware/config/boards/f407-discovery/prepend.txt index e46d9f7612..73f5beaaf3 100644 --- a/firmware/config/boards/f407-discovery/prepend.txt +++ b/firmware/config/boards/f407-discovery/prepend.txt @@ -1,2 +1,3 @@ ! see also FLEXIBLE_CRITICAL_LED #define ts_show_critical_led true +#define ts_show_software_knock true