Skip to content

Commit

Permalink
Support prescaler==1
Browse files Browse the repository at this point in the history
The delay was previously insufficient for the minimal possible
prescaler.
  • Loading branch information
jpieper committed May 26, 2023
1 parent 5fb82c3 commit 79b79c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fw/stm32g4_adc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void EnableAdc(MillisecondTimer* timer, ADC_TypeDef* adc, int prescaler) {
const uint32_t initial_cyccnt = DWT->CYCCNT;
const uint32_t desired_cyccnt =
static_cast<uint32_t>(initial_cyccnt / prescaler) * prescaler +
prescaler * 32;
prescaler * 64;

// Clear the instruction and data cache, to help get the same
// results every time.
Expand Down

0 comments on commit 79b79c0

Please sign in to comment.