From: asterix Date: Tue, 28 Sep 2010 10:39:29 +0000 (+0000) Subject: Wait the acquisition ends. X-Git-Tag: 2.6.0~77 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=40ba6f2fce8f3cecc68a04cac0b949b08e4cba3a;p=bertos.git Wait the acquisition ends. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4324 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/boards/ek-lm3s1968/hw/hw_adc.h b/boards/ek-lm3s1968/hw/hw_adc.h index 53ba119f..66d64365 100644 --- a/boards/ek-lm3s1968/hw/hw_adc.h +++ b/boards/ek-lm3s1968/hw/hw_adc.h @@ -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); }