aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/ex/ST/lsm303agr.c67
-rw-r--r--os/ex/ST/lsm303agr.h18
-rw-r--r--testex/STM32/STM32F4xx/I2C-LSM303AGR/Makefile3
-rw-r--r--testex/STM32/STM32F4xx/I2C-LSM303AGR/debug/STM32F4xx-I2C-LSM303AGR (OpenOCD, Flash and Run).launch2
-rw-r--r--testex/STM32/STM32F4xx/I2C-LSM303AGR/main.c2
5 files changed, 13 insertions, 79 deletions
diff --git a/os/ex/ST/lsm303agr.c b/os/ex/ST/lsm303agr.c
index e0357e7ad..5620826dd 100644
--- a/os/ex/ST/lsm303agr.c
+++ b/os/ex/ST/lsm303agr.c
@@ -314,78 +314,22 @@ static msg_t acc_reset_sensivity(void *ip) {
if(devp->config->accfullscale == LSM303AGR_ACC_FS_2G) {
for(i = 0; i < LSM303AGR_ACC_NUMBER_OF_AXES; i++) {
-#if LSM303AGR_ACC_USE_ADVANCED
- if(devp->config->accmode == LSM303AGR_ACC_MODE_NORM)
- devp->accsensitivity[i] = LSM303AGR_ACC_SENS_NORM_2G;
- else if(devp->config->accmode == LSM303AGR_ACC_MODE_LPOW)
- devp->accsensitivity[i] = LSM303AGR_ACC_SENS_LPOW_2G;
- else if(devp->config->accmode == LSM303AGR_ACC_MODE_HRES)
- devp->accsensitivity[i] = LSM303AGR_ACC_SENS_HRES_2G;
- else {
- osalDbgAssert(FALSE, "acc_reset_sensivity(), accelerometer mode issue");
- msg = MSG_RESET;
- return msg;
- }
-#else
- devp->accsensitivity[i] = LSM303AGR_ACC_SENS_NORM_2G;
-#endif
+ devp->accsensitivity[i] = LSM303AGR_ACC_SENS_2G;
}
}
else if(devp->config->accfullscale == LSM303AGR_ACC_FS_4G) {
for(i = 0; i < LSM303AGR_ACC_NUMBER_OF_AXES; i++) {
-#if LSM303AGR_ACC_USE_ADVANCED
- if(devp->config->accmode == LSM303AGR_ACC_MODE_NORM)
- devp->accsensitivity[i] = LSM303AGR_ACC_SENS_NORM_4G;
- else if(devp->config->accmode == LSM303AGR_ACC_MODE_LPOW)
- devp->accsensitivity[i] = LSM303AGR_ACC_SENS_LPOW_4G;
- else if(devp->config->accmode == LSM303AGR_ACC_MODE_HRES)
- devp->accsensitivity[i] = LSM303AGR_ACC_SENS_HRES_4G;
- else {
- osalDbgAssert(FALSE, "acc_reset_sensivity(), accelerometer mode issue");
- msg = MSG_RESET;
- return msg;
- }
-#else
- devp->accsensitivity[i] = LSM303AGR_ACC_SENS_NORM_4G;
-#endif
+ devp->accsensitivity[i] = LSM303AGR_ACC_SENS_4G;
}
}
else if(devp->config->accfullscale == LSM303AGR_ACC_FS_8G) {
for(i = 0; i < LSM303AGR_ACC_NUMBER_OF_AXES; i++) {
-#if LSM303AGR_ACC_USE_ADVANCED
- if(devp->config->accmode == LSM303AGR_ACC_MODE_NORM)
- devp->accsensitivity[i] = LSM303AGR_ACC_SENS_NORM_8G;
- else if(devp->config->accmode == LSM303AGR_ACC_MODE_LPOW)
- devp->accsensitivity[i] = LSM303AGR_ACC_SENS_LPOW_8G;
- else if(devp->config->accmode == LSM303AGR_ACC_MODE_HRES)
- devp->accsensitivity[i] = LSM303AGR_ACC_SENS_HRES_8G;
- else {
- osalDbgAssert(FALSE, "acc_reset_sensivity(), accelerometer mode issue");
- msg = MSG_RESET;
- return msg;
- }
-#else
- devp->accsensitivity[i] = LSM303AGR_ACC_SENS_NORM_8G;
-#endif
+ devp->accsensitivity[i] = LSM303AGR_ACC_SENS_8G;
}
}
else if(devp->config->accfullscale == LSM303AGR_ACC_FS_16G) {
for(i = 0; i < LSM303AGR_ACC_NUMBER_OF_AXES; i++) {
-#if LSM303AGR_ACC_USE_ADVANCED
- if(devp->config->accmode == LSM303AGR_ACC_MODE_NORM)
- devp->accsensitivity[i] = LSM303AGR_ACC_SENS_NORM_16G;
- else if(devp->config->accmode == LSM303AGR_ACC_MODE_LPOW)
- devp->accsensitivity[i] = LSM303AGR_ACC_SENS_LPOW_16G;
- else if(devp->config->accmode == LSM303AGR_ACC_MODE_HRES)
- devp->accsensitivity[i] = LSM303AGR_ACC_SENS_HRES_16G;
- else {
- osalDbgAssert(FALSE, "acc_reset_sensivity(), accelerometer mode issue");
- msg = MSG_RESET;
- return msg;
- }
-#else
- devp->accsensitivity[i] = LSM303AGR_ACC_SENS_NORM_16G;
-#endif
+ devp->accsensitivity[i] = LSM303AGR_ACC_SENS_16G;
}
}
else {
@@ -803,8 +747,7 @@ void lsm303agrStart(LSM303AGRDriver *devp, const LSM303AGRConfig *config) {
cr[4] = devp->config->accfullscale;
#if LSM303AGR_ACC_USE_ADVANCED || defined(__DOXYGEN__)
cr[4] |= devp->config->accendianess |
- devp->config->accblockdataupdate |
- devp->config->acchighresmode;
+ devp->config->accblockdataupdate;
if(devp->config->accmode == LSM303AGR_ACC_MODE_HRES)
cr[4] |= LSM303AGR_CTRL_REG4_A_HR;
#endif
diff --git a/os/ex/ST/lsm303agr.h b/os/ex/ST/lsm303agr.h
index 4f3447044..74ddc058b 100644
--- a/os/ex/ST/lsm303agr.h
+++ b/os/ex/ST/lsm303agr.h
@@ -76,20 +76,10 @@
#define LSM303AGR_ACC_8G 8.0f
#define LSM303AGR_ACC_16G 16.0f
-#define LSM303AGR_ACC_SENS_HRES_2G 1.02f
-#define LSM303AGR_ACC_SENS_HRES_4G 0.5128f
-#define LSM303AGR_ACC_SENS_HRES_8G 0.25641f
-#define LSM303AGR_ACC_SENS_HRES_16G 0.08532f
-
-#define LSM303AGR_ACC_SENS_NORM_2G 0.25641f
-#define LSM303AGR_ACC_SENS_NORM_4G 0.12787f
-#define LSM303AGR_ACC_SENS_NORM_8G 0.06397f
-#define LSM303AGR_ACC_SENS_NORM_16G 0.02132f
-
-#define LSM303AGR_ACC_SENS_LPOW_2G 0.06398f
-#define LSM303AGR_ACC_SENS_LPOW_4G 0.03199f
-#define LSM303AGR_ACC_SENS_LPOW_8G 0.01599f
-#define LSM303AGR_ACC_SENS_LPOW_16G 0.00533f
+#define LSM303AGR_ACC_SENS_2G 0.060f
+#define LSM303AGR_ACC_SENS_4G 0.120f
+#define LSM303AGR_ACC_SENS_8G 0.240f
+#define LSM303AGR_ACC_SENS_16G 0.750f
#define LSM303AGR_ACC_BIAS 0.0f
/** @} */
diff --git a/testex/STM32/STM32F4xx/I2C-LSM303AGR/Makefile b/testex/STM32/STM32F4xx/I2C-LSM303AGR/Makefile
index 9b3e220a4..c9697e206 100644
--- a/testex/STM32/STM32F4xx/I2C-LSM303AGR/Makefile
+++ b/testex/STM32/STM32F4xx/I2C-LSM303AGR/Makefile
@@ -193,7 +193,8 @@ CPPWARN = -Wall -Wextra -Wundef
# List all user C define here, like -D_DEBUG=1
UDEFS = -DCHPRINTF_USE_FLOAT=1 \
- -DLSM303AGR_USE_ADVANCED=0 -DLSM303AGR_SHARED_I2C=0
+ -DLSM303AGR_ACC_USE_ADVANCED=0 -DLSM303AGR_COMP_USE_ADVANCED=0 \
+ -DLSM303AGR_SHARED_I2C=0
# Define ASM defines here
UADEFS =
diff --git a/testex/STM32/STM32F4xx/I2C-LSM303AGR/debug/STM32F4xx-I2C-LSM303AGR (OpenOCD, Flash and Run).launch b/testex/STM32/STM32F4xx/I2C-LSM303AGR/debug/STM32F4xx-I2C-LSM303AGR (OpenOCD, Flash and Run).launch
index 41160363c..7a5a52eee 100644
--- a/testex/STM32/STM32F4xx/I2C-LSM303AGR/debug/STM32F4xx-I2C-LSM303AGR (OpenOCD, Flash and Run).launch
+++ b/testex/STM32/STM32F4xx/I2C-LSM303AGR/debug/STM32F4xx-I2C-LSM303AGR (OpenOCD, Flash and Run).launch
@@ -33,7 +33,7 @@
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
-<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;rxbuf-lsm303agrI2CReadRegister-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;null-lsm303agrI2CReadRegister-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;null-read_raw-(format)&quot; val=&quot;1&quot;/&gt;&lt;content id=&quot;null-lsm303agrStart-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;tmp-read_raw.lto_priv.21-(format)&quot; val=&quot;0&quot;/&gt;&lt;/contentList&gt;"/>
+<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;null-lsm303agrStart-(format)&quot; val=&quot;0&quot;/&gt;&lt;content id=&quot;rxbuf-lsm303agrI2CReadRegister-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;null-lsm303agrI2CReadRegister-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;null-read_raw-(format)&quot; val=&quot;1&quot;/&gt;&lt;content id=&quot;tmp-read_raw.lto_priv.21-(format)&quot; val=&quot;0&quot;/&gt;&lt;content id=&quot;cr[0]-null-lsm303agrStart-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;cr[1]-null-lsm303agrStart-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;cr[2]-null-lsm303agrStart-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;cr[3]-null-lsm303agrStart-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;cr[4]-null-lsm303agrStart-(format)&quot; val=&quot;4&quot;/&gt;&lt;/contentList&gt;"/>
<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;globalVariableList/&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList/&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="./build/ch.elf"/>
diff --git a/testex/STM32/STM32F4xx/I2C-LSM303AGR/main.c b/testex/STM32/STM32F4xx/I2C-LSM303AGR/main.c
index a97d1a38a..d2c7d6b01 100644
--- a/testex/STM32/STM32F4xx/I2C-LSM303AGR/main.c
+++ b/testex/STM32/STM32F4xx/I2C-LSM303AGR/main.c
@@ -52,7 +52,7 @@ static const LSM303AGRConfig lsm303agrcfg = {
LSM303AGR_ACC_FS_4G,
LSM303AGR_ACC_ODR_100Hz,
#if LSM303AGR_ACC_USE_ADVANCED
- LSM303AGR_ACC_MODE_HRES,
+ LSM303AGR_ACC_MODE_LPOW,
LSM303AGR_ACC_BDU_BLOCK,
LSM303AGR_ACC_END_LITTLE,
#endif