Wait the acquisition ends.
[bertos.git] / boards / ek-lm3s1968 / hw / hw_adc.h
index 53ba119f9122cc30d70926de03d4a011530670fb..66d643656bd8cce3340ec8847f12dd0076919071 100644 (file)
@@ -51,6 +51,9 @@ INLINE uint16_t hw_readRawTemp(void)
        /* Trig the temperature sampling */
        HWREG(ADC0_BASE + ADC_O_PSSI) |= ADC_PSSI_SS3;
 
+       /* Poll untill acquisition end */
+       while (!(HWREG(ADC0_BASE + ADC_O_SSFSTAT3) & ADC_SSFSTAT3_FULL));
+
        return (uint16_t)HWREG(ADC0_BASE + ADC_O_SSFIFO3);
 }
 
@@ -62,6 +65,9 @@ INLINE uint16_t hw_readIntTemp(void)
        /* Trig the temperature sampling */
        HWREG(ADC0_BASE + ADC_O_PSSI) |= ADC_PSSI_SS3;
 
+       /* Poll untill acquisition end */
+       while (!(HWREG(ADC0_BASE + ADC_O_SSFSTAT3) & ADC_SSFSTAT3_FULL));
+
        return (uint16_t)(14750 - ADC_RANGECONV(HWREG(ADC0_BASE + ADC_O_SSFIFO3), 0, 300) * 75);
 }