File tree Expand file tree Collapse file tree
src/current_sense/hardware_specific/stm32 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -605,6 +605,14 @@ float _readRegularADCVoltage(const int pin){
605605
606606 ADC_ChannelConfTypeDef sConfig = {0 };
607607 sConfig .Channel = last_channel[adc_index];
608+ // the shortes possible sampling time
609+ // this seems to be a constant in HAL - the shortest time enum is equal to 0
610+ // G4 - 2.5 cycles
611+ // F1, H7 - 1.5 cycles
612+ // L4 - 2.5 cycles
613+ // F4, F7 - 3 cycles
614+ sConfig .SamplingTime = 0 ;
615+
608616#ifdef ADC_REGULAR_RANK_1
609617 sConfig .Rank = ADC_REGULAR_RANK_1 ;
610618#else
@@ -616,15 +624,10 @@ float _readRegularADCVoltage(const int pin){
616624#ifdef ADC_OFFSET_NONE
617625 sConfig .OffsetNumber = ADC_OFFSET_NONE ;
618626#endif
619- // the shortes possible sampling time
620- // this seems to be a constant in HAL - the shortest time enum is equal to 0
621- // G4 - 2.5 cycles
622- // F1, H7 - 1.5 cycles
623- // L4 - 2.5 cycles
624- // F4, F7 - 3 cycles
625- sConfig .SamplingTime = 0 ;
627+ #ifndef STM32F1xx
626628 sConfig .Offset = 0 ;
627-
629+ #endif
630+
628631 if (HAL_ADC_ConfigChannel (&hadc[adc_index], &sConfig ) != HAL_OK ) {
629632#ifdef SIMPLEFOC_STM32_DEBUG
630633 SIMPLEFOC_DEBUG (" STM32-CS: ERR: Failed to configure regular channel" );
You can’t perform that action at this time.
0 commit comments