Skip to content

Commit

Permalink
explicit struct fields
Browse files Browse the repository at this point in the history
  • Loading branch information
rusefillc committed Jan 10, 2024
1 parent eef536e commit cdeed0e
Showing 1 changed file with 32 additions and 24 deletions.
56 changes: 32 additions & 24 deletions firmware/controllers/sensors/impl/software_knock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,38 +55,46 @@ static const uint32_t smpr2 =
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,
static const ADCConversionGroup adcConvGroupCh1 = {
.circular = FALSE,
.num_channels = 1,
.end_cb = &completionCallback,
.error_cb = &errorCallback,
.cr1 = 0,
.cr2 = ADC_CR2_SWSTART,
// sample times for channels 10...18
smpr1,
.smpr1 = smpr1,
// sample times for channels 0...9
smpr2,
.smpr2 = smpr2,

0, // htr
0, // ltr
.htr = 0,
.ltr = 0,

0, // sqr1
0, // sqr2
ADC_SQR3_SQ1_N(KNOCK_ADC_CH1)
.sqr1 = 0,
.sqr2 = 0,
.sqr3 = ADC_SQR3_SQ1_N(KNOCK_ADC_CH1)
};

// Not all boards have a second channel - configure it if it exists
#if KNOCK_HAS_CH2
static const ADCConversionGroup adcConvGroupCh2 = { FALSE, 1, &completionCallback, &errorCallback,
0,
ADC_CR2_SWSTART,
// sample times for channels 10...18
smpr1,
// sample times for channels 0...9
smpr2,

0, // htr
0, // ltr

0, // sqr1
0, // sqr2
ADC_SQR3_SQ1_N(KNOCK_ADC_CH2)
static const ADCConversionGroup adcConvGroupCh2 = {
.circular = FALSE,
.num_channels = 1,
.end_cb = &completionCallback,
.error_cb = &errorCallback,
.cr1 = 0,
.cr2 = ADC_CR2_SWSTART,
// sample times for channels 10...18
.smpr1 = smpr1,
// sample times for channels 0...9
.smpr2 = smpr2,

.htr = 0,
.ltr = 0,

.sqr1 = 0,
.sqr2 = 0,
.sqr3 = ADC_SQR3_SQ1_N(KNOCK_ADC_CH2)
};
#endif // KNOCK_HAS_CH2

Expand Down

0 comments on commit cdeed0e

Please sign in to comment.