rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
knock_config.h
Go to the documentation of this file.
1#pragma once
2
3// knock 1 - pin PA2
4#define KNOCK_PIN_CH1 Gpio::A2
5
6// Sample rate & time - depends on the exact MCU
7#if defined(STM32H7XX)
8 // TODO: ADC1 and ADC2 are tightly coupled and ChibiOS represent both as single ADC12 devide...
9 // H7
10 // Knock is on ADC2
11 #define KNOCK_ADC ADCD2
12
13 // ADC12_INP14
14 #define KNOCK_ADC_CH1 14
15
16 #define H7_KNOCK_OVERSAMPLE 4
17 #define KNOCK_SAMPLE_TIME ADC_SMPR_SMP_8P5
18 #define KNOCK_SAMPLE_RATE (STM32_ADC3_CLOCK / (H7_KNOCK_OVERSAMPLE * (8 + 8)))
19#else
20 // F4/F7
21 // Knock is on ADC3
22 #define KNOCK_ADC ADCD3
23
24 #define KNOCK_ADC_CH1 ADC_CHANNEL_IN2
25
26 #define KNOCK_SAMPLE_TIME ADC_SAMPLE_84
27 #define KNOCK_SAMPLE_RATE (STM32_PCLK2 / (4 * (84 + 12)))
28#endif