projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
compiler: introduce ALIGNED macro
[bertos.git]
/
boards
/
ek-lm3s1968
/
hw
/
hw_adc.h
diff --git
a/boards/ek-lm3s1968/hw/hw_adc.h
b/boards/ek-lm3s1968/hw/hw_adc.h
index 53ba119f9122cc30d70926de03d4a011530670fb..1f6aeadd6f200eaab6aa0b58214cba231df5e1e7 100644
(file)
--- a/
boards/ek-lm3s1968/hw/hw_adc.h
+++ b/
boards/ek-lm3s1968/hw/hw_adc.h
@@
-39,7
+39,7
@@
#define HW_ADC_H
#include <drv/adc.h>
#define HW_ADC_H
#include <drv/adc.h>
-#include <drv/
timer
.h>
+#include <drv/
clock_lm3s
.h>
#include <io/cm3.h>
#include <io/cm3.h>
@@
-51,6
+51,9
@@
INLINE uint16_t hw_readRawTemp(void)
/* Trig the temperature sampling */
HWREG(ADC0_BASE + ADC_O_PSSI) |= ADC_PSSI_SS3;
/* 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);
}
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;
/* 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);
}
return (uint16_t)(14750 - ADC_RANGECONV(HWREG(ADC0_BASE + ADC_O_SSFIFO3), 0, 300) * 75);
}
@@
-70,8
+76,11
@@
INLINE void hw_initIntTemp(void)
/* Enable ADC0 clock */
SYSCTL_RCGC0_R |= SYSCTL_RCGC0_ADC0;
/* Enable ADC0 clock */
SYSCTL_RCGC0_R |= SYSCTL_RCGC0_ADC0;
- /* Why this??? */
- timer_udelay(1);
+ /*
+ * We wait some time because the clock is istable
+ * and that could cause system hardfault
+ */
+ lm3s_busyWait(10);
/* Disable all sequence */
HWREG(ADC0_BASE + ADC_O_ACTSS) = 0;
/* Disable all sequence */
HWREG(ADC0_BASE + ADC_O_ACTSS) = 0;