This commit is contained in:
Hierophect 2019-09-18 13:44:08 -04:00
parent c9b86111f4
commit cd5ec365d3

View File

@ -119,27 +119,6 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
HAL_ADC_PollForConversion(&AdcHandle,1);
uint16_t value = (uint16_t)HAL_ADC_GetValue(&AdcHandle);
HAL_ADC_Stop(&AdcHandle);
//LL Implementation
// if (LL_ADC_IsEnabled(ADCx) == 0)
// {
// LL_ADC_REG_SetTriggerSource(ADCx, LL_ADC_REG_TRIG_SOFTWARE);
// LL_ADC_REG_SetContinuousMode(ADCx, LL_ADC_REG_CONV_SINGLE);
// LL_ADC_REG_SetSequencerLength(ADCx, LL_ADC_REG_SEQ_SCAN_DISABLE);
// //LL_ADC_REG_SetSequencerRanks(ADCx, LL_ADC_REG_RANK_1, self->pin->adc_channel);
// //^ Above is WRONG: channel value requires inserted channel information. Hard to iterate through.
// LL_ADC_REG_SetSequencerRanks(ADC1, LL_ADC_REG_RANK_1, LL_ADC_CHANNEL_4);
// LL_ADC_SetChannelSamplingTime(ADCx, self->pin->adc_channel, LL_ADC_SAMPLINGTIME_56CYCLES);
// LL_ADC_EnableIT_OVR(ADCx);
// }
// LL_ADC_Enable(ADCx);
// uint16_t uhADCxConvertedData = (__LL_ADC_DIGITAL_SCALE(LL_ADC_RESOLUTION_12B) + 1);
// LL_ADC_REG_StartConversionSWStart(ADCx);
// while (LL_ADC_IsActiveFlag_EOCS(ADCx) == 0) {}
// /* Retrieve ADC conversion data */
// /* (data scale corresponds to ADC resolution: 12 bits) */
// uhADCxConvertedData = LL_ADC_REG_ReadConversionData12(ADCx);
// // Shift the value to be 16 bit.
return value << 4;