Merge remote-tracking branch 'origin/master' into master

This commit is contained in:
rusefillc 2020-10-02 20:50:07 -04:00
commit f2213ec0eb
2 changed files with 28 additions and 16 deletions

View File

@ -7,14 +7,6 @@
#define KNOCK_ADC_CH1 ADC_CHANNEL_IN3
#define KNOCK_PIN_CH1 GPIOA_3
// knock 2 - pin PF5 NOT used! - not used for MRE
#define KNOCK_ADC_CH2 ADC_CHANNEL_IN15
#define KNOCK_PIN_CH2 GPIOF_5
// Sample rate & time - depends on the exact MCU
#define KNOCK_SAMPLE_TIME ADC_SAMPLE_84
#define KNOCK_SAMPLE_RATE (STM32_PCLK2 / (4 * (84 + 12)))
#ifndef MRE_SW_KNOCK_ADC
#define MRE_SW_KNOCK_ADC
#endif

View File

@ -38,15 +38,33 @@ static void completionCallback(ADCDriver* adcp, adcsample_t*, size_t) {
static void errorCallback(ADCDriver*, adcerror_t err) {
}
static const uint32_t smpr1 =
ADC_SMPR1_SMP_AN10(KNOCK_SAMPLE_TIME) |
ADC_SMPR1_SMP_AN11(KNOCK_SAMPLE_TIME) |
ADC_SMPR1_SMP_AN12(KNOCK_SAMPLE_TIME) |
ADC_SMPR1_SMP_AN13(KNOCK_SAMPLE_TIME) |
ADC_SMPR1_SMP_AN14(KNOCK_SAMPLE_TIME) |
ADC_SMPR1_SMP_AN15(KNOCK_SAMPLE_TIME);
static const uint32_t smpr2 =
ADC_SMPR2_SMP_AN0(KNOCK_SAMPLE_TIME) |
ADC_SMPR2_SMP_AN1(KNOCK_SAMPLE_TIME) |
ADC_SMPR2_SMP_AN2(KNOCK_SAMPLE_TIME) |
ADC_SMPR2_SMP_AN3(KNOCK_SAMPLE_TIME) |
ADC_SMPR2_SMP_AN4(KNOCK_SAMPLE_TIME) |
ADC_SMPR2_SMP_AN5(KNOCK_SAMPLE_TIME) |
ADC_SMPR2_SMP_AN6(KNOCK_SAMPLE_TIME) |
ADC_SMPR2_SMP_AN7(KNOCK_SAMPLE_TIME) |
ADC_SMPR2_SMP_AN8(KNOCK_SAMPLE_TIME) |
ADC_SMPR2_SMP_AN9(KNOCK_SAMPLE_TIME);
static const ADCConversionGroup adcConvGroupCh1 = { FALSE, 1, &completionCallback, &errorCallback,
0,
ADC_CR2_SWSTART,
#ifdef MRE_SW_KNOCK_ADC
ADC_SMPR2_SMP_AN3(KNOCK_SAMPLE_TIME), // sample times for channels 10...18
#else
ADC_SMPR1_SMP_AN14(KNOCK_SAMPLE_TIME), // sample times for channels 10...18
#endif
0,
// sample times for channels 10...18
smpr1,
// sample times for channels 0...9
smpr2,
0, // htr
0, // ltr
@ -61,8 +79,10 @@ static const ADCConversionGroup adcConvGroupCh1 = { FALSE, 1, &completionCallbac
static const ADCConversionGroup adcConvGroupCh2 = { FALSE, 1, &completionCallback, &errorCallback,
0,
ADC_CR2_SWSTART,
ADC_SMPR1_SMP_AN14(KNOCK_SAMPLE_TIME), // sample times for channels 10...18
0,
// sample times for channels 10...18
smpr1,
// sample times for channels 0...9
smpr2,
0, // htr
0, // ltr