1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-15 07:29:15 +01:00

Flight/ADC: If there is a DMA error for the ADC transfer dont copy those values

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2359 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2011-01-09 20:49:39 +00:00 committed by peabody124
parent 148ea6fdc1
commit 0175e25ddf

View File

@ -187,17 +187,21 @@ void DMA1_Channel1_IRQHandler(void)
{
int32_t i;
uint16_t *src_ptr;
bool bad_xfr = DMA_GetFlagStatus(DMA1_FLAG_TE1);
/* Clear the pending flag(s) */
DMA_ClearFlag(DMA1_FLAG_TC1 | DMA1_FLAG_TE1 | DMA1_FLAG_HT1 | DMA1_FLAG_GL1);
src_ptr = (uint16_t *) adc_conversion_values;
/* Copy conversion values to adc_pin_values */
for (i = 0; i < PIOS_ADC_NUM_CHANNELS; ++i) {
/* Takeover new value */
adc_pin_values[i] = *src_ptr;
++src_ptr;
if(! bad_xfr ) {
/* Copy conversion values to adc_pin_values */
for (i = 0; i < PIOS_ADC_NUM_CHANNELS; ++i) {
/* Takeover new value */
adc_pin_values[i] = *src_ptr;
++src_ptr;
}
}
/* Request next conversion */