Closed wwwwwwzj closed 1 year ago
` / Sampe ADCs / / Handle phase order swapping so that voltage/current/torque match encoder direction / if(!PHASE_ORDER){ controller->adc_a_raw = HAL_ADC_GetValue(&ADC_CH_IA); controller->adc_b_raw = HAL_ADC_GetValue(&ADC_CH_IB); //adc_ch_ic = ADC_CH_IC; } else{ controller->adc_a_raw = HAL_ADC_GetValue(&ADC_CH_IB); controller->adc_b_raw = HAL_ADC_GetValue(&ADC_CH_IA); //adc_ch_ic = ADC_CH_IB; }
HAL_ADC_Start(&ADC_CH_MAIN); HAL_ADC_PollForConversion(&ADC_CH_MAIN, HAL_MAX_DELAY); controller->adc_vbus_raw = HAL_ADC_GetValue(&ADC_CH_VBUS); controller->v_bus = (float)controller->adc_vbus_raw*V_SCALE;
`
Why not open ADC first and then get ADC value of current?
` / Sampe ADCs / / Handle phase order swapping so that voltage/current/torque match encoder direction / if(!PHASE_ORDER){ controller->adc_a_raw = HAL_ADC_GetValue(&ADC_CH_IA); controller->adc_b_raw = HAL_ADC_GetValue(&ADC_CH_IB); //adc_ch_ic = ADC_CH_IC; } else{ controller->adc_a_raw = HAL_ADC_GetValue(&ADC_CH_IB); controller->adc_b_raw = HAL_ADC_GetValue(&ADC_CH_IA); //adc_ch_ic = ADC_CH_IB; }
`
Why not open ADC first and then get ADC value of current?